Bug 849654: Kill nsRefPtrHashtableMT. r=bsmedberg

This commit is contained in:
Kyle Huey 2013-04-03 09:54:35 -07:00
parent cc065084bc
commit 76dd9d18d6

View File

@ -63,34 +63,6 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
&userData);
}
/**
* Thread-safe version of nsRefPtrHashtable
* @param KeyClass a wrapper-class for the hashtable key, see nsHashKeys.h
* for a complete specification.
* @param RefPtr the reference-type being wrapped
*/
template<class KeyClass, class RefPtr>
class nsRefPtrHashtableMT :
public nsBaseHashtableMT< KeyClass, nsRefPtr<RefPtr> , RefPtr* >
{
public:
typedef typename KeyClass::KeyType KeyType;
typedef RefPtr* UserDataType;
typedef nsBaseHashtableMT< KeyClass, nsRefPtr<RefPtr> , RefPtr* > base_type;
/**
* @copydoc nsBaseHashtable::Get
* @param pData This is an XPCOM getter, so pData is already_addrefed.
* If the key doesn't exist, pData will be set to nullptr.
*/
bool Get(KeyType aKey, UserDataType* pData) const;
// GetWeak does not make sense on a multi-threaded hashtable, where another
// thread may remove the entry (and hence release it) as soon as GetWeak
// returns
};
//
// nsRefPtrHashtable definitions
//
@ -143,41 +115,4 @@ nsRefPtrHashtable<KeyClass,RefPtr>::GetWeak
return nullptr;
}
//
// nsRefPtrHashtableMT definitions
//
template<class KeyClass, class RefPtr>
bool
nsRefPtrHashtableMT<KeyClass,RefPtr>::Get
(KeyType aKey, UserDataType* pRefPtr) const
{
PR_Lock(this->mLock);
typename base_type::EntryType* ent = this->GetEntry(aKey);
if (ent)
{
if (pRefPtr)
{
*pRefPtr = ent->mData;
NS_IF_ADDREF(*pRefPtr);
}
PR_Unlock(this->mLock);
return true;
}
// if the key doesn't exist, set *pRefPtr to null
// so that it is a valid XPCOM getter
if (pRefPtr)
*pRefPtr = nullptr;
PR_Unlock(this->mLock);
return false;
}
#endif // nsRefPtrHashtable_h__