Bug 1424834 - LinkedList::sizeOfExcludingThis should use ConstRawType instead of T* r=nnethercote draft
authorValentin Gosu <valentin.gosu@gmail.com>
Wed, 20 Dec 2017 01:13:53 +0100
changeset 713268 b6e99e20db84993c0141573d6957e1723b81ed92
parent 713267 67adcbd20a29803e5abbb3d16324f9cac6771d28
child 744298 3d8ec555ff4735fff91e52b4eb5725622b4a87d1
push id93601
push uservalentin.gosu@gmail.com
push dateWed, 20 Dec 2017 00:17:24 +0000
reviewersnnethercote
bugs1424834
milestone59.0a1
Bug 1424834 - LinkedList::sizeOfExcludingThis should use ConstRawType instead of T* r=nnethercote MozReview-Commit-ID: 2EM9cEOAkIl
mfbt/LinkedList.h
netwerk/dns/nsHostResolver.cpp
--- a/mfbt/LinkedList.h
+++ b/mfbt/LinkedList.h
@@ -546,17 +546,17 @@ public:
    * Measures the memory consumption of the list excluding |this|.  Note that
    * it only measures the list elements themselves.  If the list elements
    * contain pointers to other memory blocks, those blocks must be measured
    * separately during a subsequent iteration over the list.
    */
   size_t sizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
   {
     size_t n = 0;
-    for (const T* t = getFirst(); t; t = t->getNext()) {
+    for (ConstRawType t = getFirst(); t; t = t->getNext()) {
       n += aMallocSizeOf(t);
     }
     return n;
   }
 
   /*
    * Like sizeOfExcludingThis(), but measures |this| as well.
    */
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -325,17 +325,17 @@ nsHostRecord::HasUsableResult(const mozi
 
     return addr_info || addr || negative;
 }
 
 static size_t
 SizeOfResolveHostCallbackListExcludingHead(const mozilla::LinkedList<RefPtr<nsResolveHostCallback>>& aCallbacks,
                                            MallocSizeOf mallocSizeOf)
 {
-    size_t n = 0; // TODO: should be aCallbacks.sizeOfIncludingThis(mallocSizeOf);
+    size_t n = aCallbacks.sizeOfExcludingThis(mallocSizeOf);
 
     for (const nsResolveHostCallback* t = aCallbacks.getFirst(); t; t = t->getNext()) {
       n += t->SizeOfIncludingThis(mallocSizeOf);
     }
 
     return n;
 }