32 NS_DECL_NSIWEAKREFERENCE
38 : mReferentLock(nsnull)
39 , mReferent(referent) {
41 mReferentLock = nsAutoLock::NewLock(
"sbWeakReference::mReferentLock");
42 NS_WARN_IF_FALSE(mReferentLock,
"Failed to create lock.");
48 mReferent->NoticeProxyDestruction();
52 nsAutoLock::DestroyLock(mReferentLock);
56 void NoticeReferentDestruction() {
57 NS_ENSURE_TRUE(mReferentLock, );
58 nsAutoLock lock(mReferentLock);
63 PRLock *mReferentLock;
68 sbSupportsWeakReference::GetWeakReference(nsIWeakReference** aInstancePtr)
70 NS_ENSURE_ARG_POINTER(aInstancePtr);
71 NS_ENSURE_TRUE(mProxyLock, NS_ERROR_NOT_INITIALIZED);
73 nsAutoLock lock(mProxyLock);
79 *aInstancePtr = mProxy;
81 if ( !*aInstancePtr ) {
82 return NS_ERROR_OUT_OF_MEMORY;
85 NS_ADDREF(*aInstancePtr);
95 NS_ENSURE_TRUE(mReferentLock, NS_ERROR_NOT_INITIALIZED);
97 nsAutoLock lock(mReferentLock);
99 mReferent->QueryInterface(aIID, aInstancePtr) : NS_ERROR_NULL_POINTER;
105 NS_ENSURE_TRUE(mProxyLock, );
107 nsAutoLock lock(mProxyLock);
110 mProxy->NoticeReferentDestruction();
friend class sbWeakReference
NS_IMPL_THREADSAFE_ISUPPORTS1(sbDeviceCapsCompatibility, sbIDeviceCapsCompatibility) sbDeviceCapsCompatibility
void ClearWeakReferences()