Bug 1168007 (part 5) - Use PLDHashTable2 in nsTemplateMap. r=froydnj.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 18 May 2015 20:48:21 -0700
changeset 246473 d16b320fedd5a20b9cd5fb5d0de7fd7cea7692f6
parent 246472 e044d8526a1abd215c8c3aca632b02827bf9cb7c
child 246474 92f0ccedd767be148ed528f520c66f277b14f636
push id28830
push usercbook@mozilla.com
push dateMon, 01 Jun 2015 13:02:44 +0000
treeherdermozilla-central@39c85ec2d644 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1168007
milestone41.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 1168007 (part 5) - Use PLDHashTable2 in nsTemplateMap. r=froydnj.
dom/xul/templates/nsTemplateMap.h
--- a/dom/xul/templates/nsTemplateMap.h
+++ b/dom/xul/templates/nsTemplateMap.h
@@ -11,31 +11,22 @@
 
 class nsTemplateMap {
 protected:
     struct Entry : public PLDHashEntryHdr {
         nsIContent*     mContent;
         nsIContent*     mTemplate;
     };
 
-    PLDHashTable mTable;
-
-    void
-    Init()
-    {
-        PL_DHashTableInit(&mTable, PL_DHashGetStubOps(), sizeof(Entry));
-    }
-
-    void
-    Finish() { PL_DHashTableFinish(&mTable); }
+    PLDHashTable2 mTable;
 
 public:
-    nsTemplateMap() { Init(); }
+    nsTemplateMap() : mTable(PL_DHashGetStubOps(), sizeof(Entry)) { }
 
-    ~nsTemplateMap() { Finish(); }
+    ~nsTemplateMap() { }
 
     void
     Put(nsIContent* aContent, nsIContent* aTemplate) {
         NS_ASSERTION(!PL_DHashTableSearch(&mTable, aContent),
                      "aContent already in map");
 
         Entry* entry = static_cast<Entry*>
             (PL_DHashTableAdd(&mTable, aContent, fallible));
@@ -65,13 +56,13 @@ public:
 
         if (entry)
             NS_IF_ADDREF(*aResult = entry->mTemplate);
         else
             *aResult = nullptr;
     }
 
     void
-    Clear() { Finish(); Init(); }
+    Clear() { mTable.Clear(); }
 };
 
 #endif // nsTemplateMap_h__