STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Attributes | List of all members
__abi_FTMWeakRefData Class Reference

#include <vccorlib.h>

Public Member Functions

 __declspec (non_user_code) __abi_FTMWeakRefData(
 
 __declspec (non_user_code) __abi_FTMWeakRefData(
 
 __declspec (non_user_code) void __abi_dtor()
 
unsigned long __stdcall Increment () volatile
 
unsigned long __stdcall Decrement () volatile
 
__abi_FTMWeakRefDataGetFreeThreadedMarshaler ()
 
inline::Platform::Details::IWeakReference GetWeakReference ()
 
long __stdcall Get () volatile
 
long __stdcall __abi_QueryInterface (::Platform::Guid &__guid, void **__pOut)
 
void ReleaseControlBlock ()
 

Private Attributes

::Platform::Details::ControlBlock * __weakRefSource
 
__abi_IUnknown *volatile __pUnkMarshal
 

Member Function Documentation

long __stdcall __abi_FTMWeakRefData::__abi_QueryInterface ( ::Platform::Guid &  __guid,
void **  __pOut 
)
inline
1738 {
1739  if (__pUnkMarshal == nullptr || __guid.Equals(__uuidof(__abi_IMarshal)) == false)
1740  {
1741  return 0x80004002;
1742  }
1743  if (__pUnkMarshal == reinterpret_cast<__abi_IUnknown*>(-1))
1744  {
1745  __abi_IUnknown* __pUnkMarshalLocal;
1746 
1747 #if !defined(VCWINRT_DLL)
1748  long __hr = ::__Platform_CoCreateFreeThreadedMarshaler(reinterpret_cast<::Platform::Object^>(__weakRefSource->__target), reinterpret_cast< ::Platform::Object^*>(&__pUnkMarshalLocal));
1749 #else
1750  long __hr = ::CoCreateFreeThreadedMarshaler(reinterpret_cast<IUnknown*>(__weakRefSource->__target), reinterpret_cast<IUnknown**>(&__pUnkMarshalLocal));
1751 #endif
1752  __abi_ThrowIfFailed(__hr);
1753 
1754  if (::_InterlockedCompareExchangePointer(reinterpret_cast<void* volatile*>(&__pUnkMarshal), __pUnkMarshalLocal, reinterpret_cast<void*>(-1)) != reinterpret_cast<void*>(-1))
1755  {
1756  __pUnkMarshalLocal->__abi_Release();
1757  }
1758  }
1759  return __pUnkMarshal->__abi_QueryInterface(__guid, __pOut);
1760 }
void __abi_ThrowIfFailed(long __hrArg)
Definition: vccorlib.h:91
long __stdcall __Platform_CoCreateFreeThreadedMarshaler(::Platform::Object^,::Platform::Object^*)
void * _InterlockedCompareExchangePointer(void *volatile *, void *, void *)
__abi_IUnknown *volatile __pUnkMarshal
Definition: vccorlib.h:702
::Platform::Details::ControlBlock * __weakRefSource
Definition: vccorlib.h:701
__abi_FTMWeakRefData::__declspec ( non_user_code  )
inline
706  {
707  __pUnkMarshal = reinterpret_cast<__abi_IUnknown*>(-1);
708 
709  if (__abi_module != nullptr)
710  {
711  __abi_module->__abi_IncrementObjectCount();
712  }
713  }
__abi_Module * __abi_module
__abi_IUnknown *volatile __pUnkMarshal
Definition: vccorlib.h:702
__abi_FTMWeakRefData::__declspec ( non_user_code  )
inline
716  {
717  if (__contextArg == ::Platform::CallbackContext::Any)
718  {
719  __pUnkMarshal = reinterpret_cast<__abi_IUnknown*>(-1);
720  }
721  else
722  {
723  __pUnkMarshal = nullptr;
724  }
725 
726  if (__abi_module != nullptr)
727  {
728  __abi_module->__abi_IncrementObjectCount();
729  }
730  }
__abi_Module * __abi_module
__abi_IUnknown *volatile __pUnkMarshal
Definition: vccorlib.h:702
__abi_FTMWeakRefData::__declspec ( non_user_code  )
inline
734  {
735  if (__pUnkMarshal && __pUnkMarshal != reinterpret_cast<__abi_IUnknown*>(-1))
736  {
737  __pUnkMarshal->__abi_Release();
738  __pUnkMarshal = nullptr;
739  }
740 
741  if (__abi_module != nullptr)
742  {
743  __abi_module->__abi_DecrementObjectCount();
744  }
745  __weakRefSource->DecrementStrongReference();
746  __weakRefSource->__abi_Release();
747  }
__abi_Module * __abi_module
__abi_IUnknown *volatile __pUnkMarshal
Definition: vccorlib.h:702
::Platform::Details::ControlBlock * __weakRefSource
Definition: vccorlib.h:701
unsigned long __stdcall __abi_FTMWeakRefData::Decrement ( ) volatile
inline
760  {
761  if (__weakRefSource == nullptr || __weakRefSource->GetRefcount() < 0)
762  {
763  return static_cast<unsigned long>(-1); // Called during destruction
764  }
765 
766  unsigned long __refCount = __weakRefSource->DecrementStrongReference();
767  if (__refCount == 0)
768  {
769  if (__pUnkMarshal && __pUnkMarshal != reinterpret_cast<__abi_IUnknown*>(-1))
770  {
771  __pUnkMarshal->__abi_Release();
772  __pUnkMarshal = nullptr;
773  }
774 
775  // When destructing objects at the end of the program, we might be freeing
776  // objects across dlls, and the dll this object is in might have already freed its module object.
777  if (__abi_module != nullptr)
778  {
779  __abi_module->__abi_DecrementObjectCount();
780  }
781  }
782 
783  return __refCount;
784  }
__abi_Module * __abi_module
__abi_IUnknown *volatile __pUnkMarshal
Definition: vccorlib.h:702
::Platform::Details::ControlBlock * __weakRefSource
Definition: vccorlib.h:701
long __stdcall __abi_FTMWeakRefData::Get ( ) volatile
inline
801  {
802  if (__weakRefSource == nullptr)
803  {
804  return static_cast<unsigned long>(-1); // Called during destruction
805  }
806  return __weakRefSource->GetRefcount();
807  }
::Platform::Details::ControlBlock * __weakRefSource
Definition: vccorlib.h:701
__abi_FTMWeakRefData* __abi_FTMWeakRefData::GetFreeThreadedMarshaler ( )
inline
787  {
788  if (__pUnkMarshal == nullptr)
789  {
790  return nullptr;
791  }
792  return this;
793  }
__abi_IUnknown *volatile __pUnkMarshal
Definition: vccorlib.h:702
inline ::Platform::Details::IWeakReference __abi_FTMWeakRefData::GetWeakReference ( )
inline
796  {
797  return reinterpret_cast< ::Platform::Details::IWeakReference^>(__weakRefSource);
798  }
::Platform::Details::ControlBlock * __weakRefSource
Definition: vccorlib.h:701
unsigned long __stdcall __abi_FTMWeakRefData::Increment ( ) volatile
inline
750  {
751  if (__weakRefSource == nullptr || __weakRefSource->GetRefcount() < 0)
752  {
753  return static_cast<unsigned long>(-1); // Called during destruction
754  }
755 
756  return __weakRefSource->IncrementStrongReference();
757  }
::Platform::Details::ControlBlock * __weakRefSource
Definition: vccorlib.h:701
void __abi_FTMWeakRefData::ReleaseControlBlock ( )
inline
812  {
813  auto __localWeakRefSource = __weakRefSource;
814  __localWeakRefSource->ReleaseTarget();
815  __localWeakRefSource->__abi_Release();
816  }
::Platform::Details::ControlBlock * __weakRefSource
Definition: vccorlib.h:701

Member Data Documentation

__abi_IUnknown* volatile __abi_FTMWeakRefData::__pUnkMarshal
private
::Platform::Details::ControlBlock* __abi_FTMWeakRefData::__weakRefSource
private

The documentation for this class was generated from the following file: