[mq]: dup-static-atoms-PRINTFs draft
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 13 Mar 2018 10:22:26 +1100
changeset 766587 4a2985fcb2ac2c0a567d827c1ab3b53df0dda562
parent 766513 837b409fa5b4dfc230641376f53cdf7e18d66448
child 766588 a91abaf04280a3a7ce6f8a25b3b502b2daf0b9b7
child 766590 bc35efcddd07531011cc23991dd8ed6a89b259dd
push id102361
push usernnethercote@mozilla.com
push dateTue, 13 Mar 2018 02:51:05 +0000
milestone60.0a1
[mq]: dup-static-atoms-PRINTFs MozReview-Commit-ID: 857f2k3o0uX
xpcom/ds/nsAtomTable.cpp
--- a/xpcom/ds/nsAtomTable.cpp
+++ b/xpcom/ds/nsAtomTable.cpp
@@ -666,16 +666,18 @@ nsAtomSubTable::AddSizeOfExcludingThisLo
   mLock.AssertCurrentThreadOwns();
   aSizes.mTable += mTable.ShallowSizeOfExcludingThis(aMallocSizeOf);
   for (auto iter = mTable.Iter(); !iter.Done(); iter.Next()) {
     auto entry = static_cast<AtomTableEntry*>(iter.Get());
     entry->mAtom->AddSizeOfIncludingThis(aMallocSizeOf, aSizes);
   }
 }
 
+#include "nsXULAppAPI.h"
+
 void
 nsAtomTable::RegisterStaticAtoms(const nsStaticAtomSetup* aSetup,
                                  uint32_t aCount)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_RELEASE_ASSERT(!gStaticAtomsDone, "Static atom insertion is finished!");
 
   for (uint32_t i = 0; i < aCount; ++i) {
@@ -699,16 +701,20 @@ nsAtomTable::RegisterStaticAtoms(const n
       // causes subtle bugs, and we're programming in C++ here, not Smalltalk.
       if (!he->mAtom->IsStatic()) {
         nsAutoCString name;
         he->mAtom->ToUTF8String(name);
         MOZ_CRASH_UNSAFE_PRINTF(
           "Static atom registration for %s should be pushed back", name.get());
       }
       atom = static_cast<nsStaticAtom*>(he->mAtom);
+      if (XRE_IsParentProcess()) {
+        fprintf(stderr, "dup static atom: '%s'\n",
+                NS_ConvertUTF16toUTF8(atom->mString).get());
+      }
     } else {
       atom = new nsStaticAtom(string, stringLen, hash);
       he->mAtom = atom;
     }
     *atomp = atom;
   }
 }