mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 984008, part 4 - Remove nsISupportsKey. r=froydnj
This commit is contained in:
parent
a6cb4627c1
commit
1b4258e0b5
@ -410,26 +410,6 @@ nsHashtable::Write(nsIObjectOutputStream* aStream,
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsISupportsKey::nsISupportsKey(nsIObjectInputStream* aStream, nsresult *aResult)
|
||||
: mKey(nullptr)
|
||||
{
|
||||
bool nonnull;
|
||||
nsresult rv = aStream->ReadBoolean(&nonnull);
|
||||
if (NS_SUCCEEDED(rv) && nonnull)
|
||||
rv = aStream->ReadObject(true, &mKey);
|
||||
*aResult = rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsISupportsKey::Write(nsIObjectOutputStream* aStream) const
|
||||
{
|
||||
bool nonnull = (mKey != nullptr);
|
||||
nsresult rv = aStream->WriteBoolean(nonnull);
|
||||
if (NS_SUCCEEDED(rv) && nonnull)
|
||||
rv = aStream->WriteObject(mKey, true);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Copy Constructor
|
||||
// We need to free mStr if the object is passed with mOwnership as OWN. As the
|
||||
// destructor here is freeing mStr in that case, mStr is NOT getting leaked here.
|
||||
|
@ -153,51 +153,6 @@ class nsObjectHashtable : public nsHashtable {
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupportsKey: Where keys are nsISupports objects that get refcounted.
|
||||
|
||||
class nsISupportsKey : public nsHashKey {
|
||||
protected:
|
||||
nsISupports* mKey;
|
||||
|
||||
public:
|
||||
nsISupportsKey(const nsISupportsKey& aKey) : mKey(aKey.mKey) {
|
||||
#ifdef DEBUG
|
||||
mKeyType = SupportsKey;
|
||||
#endif
|
||||
NS_IF_ADDREF(mKey);
|
||||
}
|
||||
|
||||
nsISupportsKey(nsISupports* key) {
|
||||
#ifdef DEBUG
|
||||
mKeyType = SupportsKey;
|
||||
#endif
|
||||
mKey = key;
|
||||
NS_IF_ADDREF(mKey);
|
||||
}
|
||||
|
||||
~nsISupportsKey(void) {
|
||||
NS_IF_RELEASE(mKey);
|
||||
}
|
||||
|
||||
uint32_t HashCode(void) const {
|
||||
return NS_PTR_TO_INT32(mKey);
|
||||
}
|
||||
|
||||
bool Equals(const nsHashKey *aKey) const {
|
||||
NS_ASSERTION(aKey->GetKeyType() == SupportsKey, "mismatched key types");
|
||||
return (mKey == ((nsISupportsKey *) aKey)->mKey);
|
||||
}
|
||||
|
||||
nsHashKey *Clone() const {
|
||||
return new nsISupportsKey(mKey);
|
||||
}
|
||||
|
||||
nsISupportsKey(nsIObjectInputStream* aStream, nsresult *aResult);
|
||||
nsresult Write(nsIObjectOutputStream* aStream) const;
|
||||
|
||||
nsISupports* GetValue() { return mKey; }
|
||||
};
|
||||
|
||||
|
||||
class nsPRUint32Key : public nsHashKey {
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user