This changes the interface so that the code which determines the flags
can live in one place, but checking the flags doesn't need to call into
another library.
Also removes the no-op wrappers for Set*Sandbox when disabled at build
time; nothing used them, one of them was unusable due to having the wrong
type, and all they really accomplish is allowing sloppiness with ifdefs
(which could hide actual mistakes).
This is to give better contrast with |DeadBlock|, which will be added in the
next patch.
--HG--
extra : rebase_source : cbc767fcc5667cfed108ca7c4ebf1d7e82aa185e
This also effectively changes how DMD is enabled from requiring both
replace-malloc initialization and the DMD environment variable to
requiring only the former. The DMD environment variable can still be
used to specify options, but not to disable entirely.
This however doesn't touch all the parts that do enable DMD by setting
the DMD environment variable to 1, so the code to handle this value
is kept.
Doing this means that instantiations of nsRefPtr<T> won't require
nsCOMPtr_helper::operator() to be defined. Only actual uses of the
overloads will require the definition.
Forward declaring functions with default arguments is difficult. If you try to say:
template<typename T>
inline void
CycleCollectionNoteChild(nsCycleCollectionTraversalCallback& aCallback,
T* aChild, const char* aName, uint32_t aFlags);
and then later have:
template<typename T>
inline void
CycleCollectionNoteChild(nsCycleCollectionTraversalCallback& aCallback,
T* aChild, const char* aName, uint32_t aFlags = 0);
{
...
}
the compiler complains that default arguments cannot be added to a
function template that has already been declared. If you attempt to
mollify the compiler by declaring instead:
template<typename T>
inline void
CycleCollectionNoteChild(nsCycleCollectionTraversalCallback& aCallback,
T* aChild, const char* aName, uint32_t aFlags = 0);
the compiler then complains about redefining the default argument (!)
when an actual definition is found.
To circumvent this, manually implement "default" arguments by providing
a three-argument form of CycleCollectionNoteChild, which simply forwards
to the four-argument version.
The interesting feature JSONWriteFunc has, contrary to JSONWriter, is that it
only has virtual methods, which makes it a better candidate to be passed
around between libraries not linked against each other.
This will allow to make dmd and libxul independent from each other.
This patch does the following.
- Moves the logic for computing the ideal capacity for a SegmentedArray out of
SnowWhiteKiller into its own class, SegmentedArrayCapacity.
- Replaces the nsTArray in CollectWhite(), which can be very large and is
complicit in ~1% of OOM crashes, with a SegmentedArray.
--HG--
extra : rebase_source : 732743311a08fcc3dfe43a1b308846b93d30e6ed
This patch generalizes SegmentedArray a little, and then uses it instead of
nsTArray in SnowWhiteKiller. This avoids some large (sometimes 1 MiB or more)
allocations which were usually mostly unused.