Bug 984008, part 4 - Remove nsISupportsKey. r=froydnj
authorAndrew McCreight <continuation@gmail.com>
Mon, 17 Mar 2014 10:21:26 -0700
changeset 173905 409036268a8eef4600410ac1b98f6c7990b3c023
parent 173904 eb0d9222174b457bfd0d354d010a6dcc87414740
child 173906 b239389ec1e6dc842168fe906743c03b28ef6547
push id41132
push useramccreight@mozilla.com
push dateMon, 17 Mar 2014 17:21:45 +0000
treeherdermozilla-inbound@409036268a8e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs984008
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 984008, part 4 - Remove nsISupportsKey. r=froydnj
xpcom/ds/nsHashtable.cpp
xpcom/ds/nsHashtable.h
--- a/xpcom/ds/nsHashtable.cpp
+++ b/xpcom/ds/nsHashtable.cpp
@@ -405,36 +405,16 @@ nsHashtable::Write(nsIObjectOutputStream
     // Write all key/value pairs in the table.
     WriteEntryArgs args = {aStream, aWriteDataFunc};
     const_cast<nsHashtable*>(this)->Enumerate(WriteEntry, (void*) &args);
     return args.mRetVal;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 
-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.
 
 nsCStringKey::nsCStringKey(const nsCStringKey& aKey)
     : mStr(aKey.mStr), mStrLen(aKey.mStrLen), mOwnership(aKey.mOwnership)
 {
     if (mOwnership != NEVER_OWN) {
--- a/xpcom/ds/nsHashtable.h
+++ b/xpcom/ds/nsHashtable.h
@@ -148,61 +148,16 @@ class nsObjectHashtable : public nsHasht
 
     nsHashtableCloneElementFunc mCloneElementFun;
     void*                       mCloneElementClosure;
     nsHashtableEnumFunc         mDestroyElementFun;
     void*                       mDestroyElementClosure;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
-// 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:
     uint32_t mKey;
 public:
     nsPRUint32Key(uint32_t key) {
 #ifdef DEBUG
         mKeyType = PRUint32Key;