gecko-dev/xpcom/ds
Andrew McCreight d6f0453414 Bug 1350729 - Implement fake refcount logging for nsFakeStringBuffer. r=dbaron
Running with XPCOM_MEM_LOG_CLASSES=nsStringBuffer triggers an
assertion in refcount logging for nsFakeStringBuffers. These are given
an initial refcount of 1, without calling NS_LOG_ADDREF. Then,
AddRef() is called on these objects in StaticAtom::StaticAtom(), and
we tell the refcount logging system about the fake buffer, and that it
has a refcount of 0, triggering the assertion.

The first part of the fix is to call NS_LOG_ADDREF for this initial
refcount, in StaticAtom().

This first fix causes refcount logging to start reporting that the
fake string buffers leak, when XPCOM_MEM_LOG_CLASSES is not set. This
is because refcount logging is now getting told about these objects
being AddRefed at 1, which it takes to mean that an object is created.

To work around this issue, I add an array gFakeBuffers that contains
every fake string buffer we create, and tell the refcount logging
system that these objects are all being destroyed, when the atom table
is being shut down. This could result in some bogosity if the fake
buffers are "leaked" but hopefully this is still an improvement over
the current state.

MozReview-Commit-ID: 5AxoBYAlYRU

--HG--
extra : rebase_source : ba0763cb494894918141774025db525cea9f9c75
2017-07-14 10:20:23 -07:00
..
ArenaAllocator.h Bug 943156 - Add a templated ArenaAllocator. r=froydnj 2017-03-30 16:46:55 -07:00
ArenaAllocatorExtensions.h Bug 1351732 - Part 1: Add an ArenaAllocator strdup extension. r=froydnj 2017-03-30 16:46:56 -07:00
ArrayIterator.h Bug 1342303 part 1 - Make nsTArrayIterator an independent class. r=erahm 2017-02-24 16:14:06 +11:00
IncrementalTokenizer.cpp Bug 1339537 - Part 6: Pass std::function values tree by const reference instead of by value, r=ehsan 2017-04-27 12:44:57 -04:00
IncrementalTokenizer.h Bug 1339537 - Part 6: Pass std::function values tree by const reference instead of by value, r=ehsan 2017-04-27 12:44:57 -04:00
Observer.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
PLDHashTable.cpp Bug 1377333 - Make PLDHashNumber 64-bit on x86-64; r=froydnj 2017-07-04 11:05:21 -04:00
PLDHashTable.h Bug 1377333 - Make PLDHashNumber 64-bit on x86-64; r=froydnj 2017-07-04 11:05:21 -04:00
StickyTimeDuration.h
Tokenizer.cpp Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
Tokenizer.h Bug 1322825 - Incremental tokenizer. r=froydnj 2017-02-06 10:49:00 -05:00
moz.build Bug 1351732 - Part 2: Replace use of PLArena with ArenaAllocator in xpcom. r=froydnj 2017-03-30 16:46:58 -07:00
nsArray.cpp Bug 1311191 - Part 1: Add nsISupportsArray-like iteration to nsArray. r=froydnj 2016-10-24 13:24:26 -07:00
nsArray.h Bug 1311191 - Part 1: Add nsISupportsArray-like iteration to nsArray. r=froydnj 2016-10-24 13:24:26 -07:00
nsArrayEnumerator.cpp Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsArrayEnumerator.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsArrayUtils.cpp Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsArrayUtils.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsAtomService.cpp
nsAtomService.h
nsAtomTable.cpp Bug 1350729 - Implement fake refcount logging for nsFakeStringBuffer. r=dbaron 2017-07-14 10:20:23 -07:00
nsAtomTable.h
nsBaseHashtable.h Bug 1376498 part 1 - Unify the ns[Base|Interface|RefPtr]Hashtable::Remove() signatures for consistency. Make it return true if an entry was removed, with an optional out param to move the value. r=froydnj 2017-07-05 02:01:44 +02:00
nsCOMArray.cpp Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsCOMArray.h Bug 1342303 part 6 - Remove nsCOMArray::Enumerate{Forwards,Backwards}. r=erahm 2017-02-24 21:37:07 +11:00
nsCRT.cpp
nsCRT.h Bug 1232696 - Remove NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW as it causes segfaulting for GCC 6 builds (5 of 5, fixes for docshell/). r=bzbarsky. 2017-01-24 17:12:10 +01:00
nsCharSeparatedTokenizer.h Bug 1374580 (part 3) - Remove ns{,C}Substring typedefs. r=froydnj. 2017-06-20 19:19:52 +10:00
nsCheapSets.h
nsClassHashtable.h Bug 1376498 part 5 - Remove nsClassHashtable::RemoveAndForget(). r=froydnj 2017-07-05 02:01:45 +02:00
nsDataHashtable.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsDeque.cpp Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
nsDeque.h Bug 1336215 - Optimize iterator if nsDeque is const - r=froydnj 2017-02-03 13:08:10 +11:00
nsEnumeratorUtils.cpp Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsEnumeratorUtils.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsExpirationTracker.h Bug 1311425 - Avoid expiration timers when scheduling idle runnables, r=froydnj 2017-05-24 21:17:06 -04:00
nsHashKeys.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsHashPropertyBag.cpp Bug 1376498 part 2 - Use plain Remove(key) in some places instead of Lookup(key).Remove() for simplicity. r=froydnj 2017-07-05 02:01:44 +02:00
nsHashPropertyBag.h Bug 1353660 - proxy destruction of nsHashPropertyBag's hash table to the main thread; r=mccr8 2017-04-05 15:31:20 -04:00
nsIArray.idl
nsIArrayExtensions.idl Bug 1311191 - Part 1: Add nsISupportsArray-like iteration to nsArray. r=froydnj 2016-10-24 13:24:26 -07:00
nsIAtom.idl Bug 1351303, add main thread only cache for nsIAtoms to speed up atomization, r=froydnj 2017-04-03 23:13:18 +03:00
nsIAtomService.idl
nsIHashable.idl
nsIINIParser.idl
nsIMutableArray.idl Bug 1355216 - Mark last parameters that are almost always falsy as optional, r=froydnj. 2017-04-12 00:07:30 +02:00
nsINIParserImpl.cpp
nsINIParserImpl.h
nsINIProcessor.js
nsINIProcessor.manifest
nsIObserver.idl
nsIObserverService.idl Bug 1355216 - Mark last parameters that are almost always falsy as optional, r=froydnj. 2017-04-12 00:07:30 +02:00
nsIPersistentProperties.h
nsIPersistentProperties2.idl
nsIProperties.idl
nsIProperty.idl
nsIPropertyBag.idl
nsIPropertyBag2.idl
nsISerializable.idl
nsISimpleEnumerator.idl
nsIStringEnumerator.idl
nsISupportsIterators.idl
nsISupportsPrimitives.idl Bug 1329718 - remove nsISupportsVoid and associated machinery; r=erahm 2017-01-10 16:31:48 -05:00
nsIVariant.idl
nsIWindowsRegKey.idl
nsIWritablePropertyBag.idl
nsIWritablePropertyBag2.idl
nsInterfaceHashtable.h Bug 1376498 part 1 - Unify the ns[Base|Interface|RefPtr]Hashtable::Remove() signatures for consistency. Make it return true if an entry was removed, with an optional out param to move the value. r=froydnj 2017-07-05 02:01:44 +02:00
nsJSThingHashtable.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsMathUtils.h Bug 1354510 - Firefox build should recognize Solaris. r=glandium 2017-04-11 00:01:32 -07:00
nsObserverList.cpp Backed out changeset 491237dbcb5d (bug 1323207) 2016-12-16 20:06:43 +01:00
nsObserverList.h
nsObserverService.cpp Bug 1372405 - Provide names for all runnables in the tree (r=froydnj) 2017-06-26 14:19:58 -07:00
nsObserverService.h
nsPersistentProperties.cpp Bug 1374580 (part 2) - Remove nsAFlat{,C}String typedefs. r=froydnj. 2017-06-20 19:19:05 +10:00
nsPersistentProperties.h Bug 1351732 - Part 2: Replace use of PLArena with ArenaAllocator in xpcom. r=froydnj 2017-03-30 16:46:58 -07:00
nsPointerHashKeys.h Bug 1377333 - Make PLDHashNumber 64-bit on x86-64; r=froydnj 2017-07-04 11:05:21 -04:00
nsProperties.cpp Bug 1376498 part 2 - Use plain Remove(key) in some places instead of Lookup(key).Remove() for simplicity. r=froydnj 2017-07-05 02:01:44 +02:00
nsProperties.h
nsQuickSort.cpp Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsQuickSort.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsRefPtrHashtable.h Bug 1376498 part 1 - Unify the ns[Base|Interface|RefPtr]Hashtable::Remove() signatures for consistency. Make it return true if an entry was removed, with an optional out param to move the value. r=froydnj 2017-07-05 02:01:44 +02:00
nsStaticAtom.h
nsStaticNameTable.cpp Bug 1374580 (part 2) - Remove nsAFlat{,C}String typedefs. r=froydnj. 2017-06-20 19:19:05 +10:00
nsStaticNameTable.h Bug 1374580 (part 2) - Remove nsAFlat{,C}String typedefs. r=froydnj. 2017-06-20 19:19:05 +10:00
nsStringEnumerator.cpp
nsStringEnumerator.h
nsSupportsPrimitives.cpp Bug 1329718 - remove nsISupportsVoid and associated machinery; r=erahm 2017-01-10 16:31:48 -05:00
nsSupportsPrimitives.h Bug 1329718 - remove nsISupportsVoid and associated machinery; r=erahm 2017-01-10 16:31:48 -05:00
nsTArray-inl.h Bug 1348123 - Add release bounds checking when inserting and replacing. r=froydnj 2017-03-17 16:40:53 -07:00
nsTArray.cpp Bug 1338574 - Part 7: Use MOZ_CRASH_UNSAFE_PRINTF in XPCOM. r=froydnj 2017-02-21 18:02:03 +01:00
nsTArray.h Bug 1368326: Don't bother calling Clear() in destructor for empty nsTArrays. r=froydnj 2017-06-01 14:38:13 -07:00
nsTArrayForwardDeclare.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsTHashtable.h Bug 1371928 - Add a new EnsureInserted() method that return true if a new entry was created, and EnsureRemoved() that return true if an existing entry was removed. r=froydnj 2017-06-17 00:06:04 +02:00
nsTObserverArray.cpp Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsTObserverArray.h Bug 1373996 - Make nsTObserverArray::RemoveElementsBy() take a template argument; r=froydnj 2017-06-19 14:27:39 -04:00
nsTPriorityQueue.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsVariant.cpp Bug 1334318 - remove last uses of PR_smprintf; r=froydnj 2017-04-28 10:13:26 -06:00
nsVariant.h
nsWhitespaceTokenizer.h Bug 1374580 (part 3) - Remove ns{,C}Substring typedefs. r=froydnj. 2017-06-20 19:19:52 +10:00
nsWindowsRegKey.cpp Bug 1353593 - Part 2: Remove wwc functions. r=froydnj 2017-06-12 16:20:49 -07:00
nsWindowsRegKey.h