Bug 1124973 (part 6) - Delete some incorrect comments about PL_DHashTableLookup. r=froydnj.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 26 Jan 2015 15:13:56 -0800
changeset 239568 fd36ee6e8307bfe6e5ff49adb1ac64ccca5cf3dc
parent 239567 332e69cd3273c05f1c75cb85d37d80dc3f69f1ce
child 239569 1a087d928c9d9f2a6c9735e73fa5e2db6a954b7e
push id500
push userjoshua.m.grant@gmail.com
push dateThu, 29 Jan 2015 01:48:36 +0000
reviewersfroydnj
bugs1124973
milestone38.0a1
Bug 1124973 (part 6) - Delete some incorrect comments about PL_DHashTableLookup. r=froydnj. The comments about PL_DHashTableLookup in nsContentList.cpp aren't quite correct -- Add() can OOM even if the looked-for key is already in the table. More generally, they don't seem worth correcting, so I just removed them.
dom/base/nsContentList.cpp
--- a/dom/base/nsContentList.cpp
+++ b/dom/base/nsContentList.cpp
@@ -218,19 +218,16 @@ NS_GetContentList(nsINode* aRootNode,
   if (!gContentListHashTable.IsInitialized()) {
     PL_DHashTableInit(&gContentListHashTable, &hash_table_ops,
                       sizeof(ContentListHashEntry));
   }
 
   ContentListHashEntry *entry = nullptr;
   // First we look in our hashtable.  Then we create a content list if needed
   if (gContentListHashTable.IsInitialized()) {
-
-    // A PL_DHashTableAdd is equivalent to a PL_DHashTableLookup for cases
-    // when the entry is already in the hashtable.
     entry = static_cast<ContentListHashEntry *>
                        (PL_DHashTableAdd(&gContentListHashTable, &hashKey));
     if (entry)
       list = entry->mContentList;
   }
 
   if (!list) {
     // We need to create a ContentList and add it to our new entry, if
@@ -239,18 +236,17 @@ NS_GetContentList(nsINode* aRootNode,
     nsCOMPtr<nsIAtom> htmlAtom;
     if (aMatchNameSpaceId == kNameSpaceID_Unknown) {
       nsAutoString lowercaseName;
       nsContentUtils::ASCIIToLower(aTagname, lowercaseName);
       htmlAtom = do_GetAtom(lowercaseName);
     } else {
       htmlAtom = xmlAtom;
     }
-    list = new nsContentList(aRootNode, aMatchNameSpaceId,
-                             htmlAtom, xmlAtom);
+    list = new nsContentList(aRootNode, aMatchNameSpaceId, htmlAtom, xmlAtom);
     if (entry) {
       entry->mContentList = list;
     }
   }
 
   sRecentlyUsedContentLists[recentlyUsedCacheIndex] = list;
   return list.forget();
 }
@@ -330,18 +326,16 @@ GetFuncStringContentList(nsINode* aRootN
                       sizeof(FuncStringContentListHashEntry));
   }
 
   FuncStringContentListHashEntry *entry = nullptr;
   // First we look in our hashtable.  Then we create a content list if needed
   if (gFuncStringContentListHashTable.IsInitialized()) {
     nsFuncStringCacheKey hashKey(aRootNode, aFunc, aString);
 
-    // A PL_DHashTableAdd is equivalent to a PL_DHashTableLookup for cases
-    // when the entry is already in the hashtable.
     entry = static_cast<FuncStringContentListHashEntry *>
                        (PL_DHashTableAdd(&gFuncStringContentListHashTable,
                                          &hashKey));
     if (entry) {
       list = entry->mContentList;
 #ifdef DEBUG
       MOZ_ASSERT_IF(list, list->mType == ListType::sType);
 #endif