Граф коммитов

184 Коммитов

Автор SHA1 Сообщение Дата
Andi-Bogdan Postelnicu 78304aaf0d Bug 1453795 - XPCOM - Initialize member fields in classes/ structures. r=froydnj
--HG--
extra : rebase_source : c9d9e80b83ad52d8ac9203f491f1c9469a7e9b0c
extra : amend_source : ca502ae98ff21a2e3d1ab2d389310f3a5aded5ed
2018-06-15 14:41:20 +03:00
Karl Tomlinson 9e0c1c7c2b bug 1442776 make CycleCollectedJSContext accessible from JSContext private r=peterv
Inheriting PerThreadAtomCache on CycleCollectedJSContext permits use of
static_cast, avoiding one level of indirection compared to adding a
CycleCollectedJSContext* to PerThreadAtomCache.

PerThreadAtomCache is over 18kB, and so WorkerJSContext and WorkletJSContext
are moved from the stack to the heap.

MozReview-Commit-ID: 6jdJeZcviK4

--HG--
extra : rebase_source : 3c2accb71faf3f017a44c405ae0484e57aaf039c
2018-05-10 17:04:12 +12:00
Nathan Froyd 32dc58b2ba Bug 1451255 - make nsTraceRefcnt handle multibyte characters in log files; r=mccr8
...on Windows, at least.  Apparently if you have environment variables
set that contain multibyte characters, and ask for them with getenv, you
get garbage.  Or perhaps you get something sensible, but then passing it
to fopen produces garbage.  Either way, the most reasonable way to
handle this is to use the Windows wide-character APIs all over.
2018-04-17 10:13:42 -04:00
Sebastian Hengst 0819f35e51 Backed out 4 changesets (bug 525063) on request from Andi. a=backout
Backed out changeset 516c4fb1e4b8 (bug 525063)
Backed out changeset 6ff8aaef2866 (bug 525063)
Backed out changeset bf13e4103150 (bug 525063)
Backed out changeset d7d2f08e051c (bug 525063)
2018-04-13 16:01:28 +03:00
Karl Tomlinson 2405fe930c bug 1328964 use nsContentUtils::GetCurrentJSContext() on all threads r=smaug
nsContentUtils::GetCurrentJSContextForThread() originally needed to use
workers::GetCurrentThreadJSContext() in
https://hg.mozilla.org/mozilla-central/rev/366a45b41539#l2.18
because CycleCollectedJS*()->Context() did not exist until
https://hg.mozilla.org/mozilla-central/rev/1a0cd542e1e9#l7.12

nsContentUtils::GetCurrentJSContext() is thread-safe since these changes:
https://hg.mozilla.org/mozilla-central/rev/e636c7186286#l3.12
https://hg.mozilla.org/mozilla-central/rev/c8029c072776#l2.12

MozReview-Commit-ID: 2f1eGS9uBBO

--HG--
extra : rebase_source : dad1d2084a63413c3975f9e7c66c6b06857c9f23
2018-04-09 12:11:18 +12:00
Tristan Bourvon a3a77c0312 Bug 525063 - Initialize uninitialized class attributes in m-c. r=ehsan 2018-04-10 21:11:02 +02:00
Andrew McCreight 9d063bfac8 Bug 1420975 - Add a environment variable to record JS stack for leaks. r=froydnj,mrbkap
This patch adds a new environment variable XPCOM_MEM_LOG_JS_STACK that
changes XPCOM leakchecking to record a JS stack for all objects, in
addition to a C++ stack. This is useful when a C++ object is being
leaked due to JS. The JS stack will be printed if the object leaks, if
it is used in combination with XPCOM_MEM_BLOAT_LOG=1 and
XPCOM_MEM_LOG_CLASSES=nsFoo, if nsFoo is the class of interest.

This patch moves a few XPConnect functions for recording the stack
into xpcpublic.h so they can be called from nsTraceRefcnt.cpp.

MozReview-Commit-ID: FX2QVCSXz4f

--HG--
extra : rebase_source : 5bd4e341072f4cf7d3be774b63d2107479fe9985
2018-01-10 14:02:45 -08:00
Andrew McCreight 4e452aadbf Bug 1410209, part 3 - Use Runnable::mName for the class name with XPCOM leak checking. r=smaug
Most subclasses of Runnable don't bother to override AddRef and
Release, so XPCOM leak checking ends up reporting Runnable, which
makes it impossible to know what is actually leaking.

Each subclass of Runnable is already required to pass in the name of
the class, which is stored in the field mName. This patch changes
Runnable to use mName as the class name for XPCOM leak checking, thus
giving each subclass a specific name without needing to change the
hundreds of existing subclasses of Runnable.

The limitation of this approach is the classes that DO use
NS_IMPL_ADDREF/RELEASE_INHERITED end up using the same class name that
is used by the superclass AddRef/Release, but with a different size,
which causes assertions in the leak checker. To work around this, I
change NS_IMPL_ADDREF/RELEASE_INHERITED to not call into
NS_LOG_ADDREF/RELEASE for classes that are a subclass of
Runnable. This needs to use IsConvertible<> and not IsBaseOf<> because
the latter requires the classes involved to be defined, and headers
can use nsISupportsImpl.h without nsThreadUtils.h.

MozReview-Commit-ID: H0pgvwQSZAE

--HG--
extra : rebase_source : 0be13fe2e649e62be1f9471fc03fac43024eb0aa
2017-10-25 13:51:17 -07:00
Chris Peterson 73037a0f6a Bug 1412048 - Replace NS_RUNTIMEABORT(var) with MOZ_CRASH_UNSAFE_OOL(var). r=froydnj data-review=francois
And remove unreachable code after MOZ_CRASH_UNSAFE_OOL().

MOZ_CRASH_UNSAFE_OOL causes data collection because crash strings are annotated to crash-stats and are publicly visible. Firefox data stewards must do data review on usages of this macro. However, all the crash strings this patch collects with MOZ_CRASH_UNSAFE_OOL are already collected with NS_RUNTIMEABORT.

MozReview-Commit-ID: IHmJfuxXSqw

--HG--
extra : rebase_source : 031f30934b58a7b87f960e57179641d44aefe5c5
extra : source : fe9f638a56a53c8721eecc4273dcc074c988546e
2017-10-24 23:38:38 -07:00
Nicholas Nethercote a6fede36c2 Bug 1384814 - Remove critical address machinery from Mac implementation of MozStackWalk(). r=glandium.
It seemingly hasn't been needed since Mac OS 10.7. A diagnostic assertion that
has been in place for a while hasn't caught any uses of it.

--HG--
extra : rebase_source : 9834849eec9174267c7df8de7fd22840ffa36d8f
2017-10-03 13:53:14 +11:00
Nicholas Nethercote 08e54b7c13 Bug 1384819 (part 1) - Split MozStackWalk(). r=glandium.
MozStackWalk() is different on Windows to the other platforms. It has two extra
arguments, which can be used to walk the stack of a different thread.

This patch makes those differences clearer. Instead of having a single function
and forbidding those two arguments on non-Windows, it removes those arguments
from MozStackWalk, and splits off MozStackWalkThread() which retains them. This
also allows those arguments to have more appropriate types (HANDLE instead of
uintptr_t; CONTEXT* instead of than void*) and names (aContext instead of
aPlatformData).

The patch also removes unnecessary reinterpret_casts for the aClosure argument
at a couple of MozStackWalk() callsites.

--HG--
extra : rebase_source : 111ab7d6426d7be921facc2264f6db86c501d127
2017-07-27 12:46:47 +10:00
Nicholas Nethercote 3e439bb4f8 Bug 1376638 - Minimize uses of prmem.h. r=glandium.
It's silly to use prmem.h within Firefox code given that in our configuration
its functions are just wrappers for malloc() et al. (Indeed, in some places we
mix PR_Malloc() with free(), or malloc() with PR_Free().)

This patch removes all uses, except for the places where we need to use
PR_Free() to free something allocated by another NSPR function; in those cases
I've added a comment explaining which function did the allocation.

--HG--
extra : rebase_source : 0f781bca68b5bf3c4c191e09e277dfc8becffa09
2017-06-30 19:05:41 -07:00
Eric Rahm 807d2c062b Bug 1353544 - Replace usage of PR_BEGIN_MACRO in xpcom. r=froydnj 2017-04-05 18:06:44 -07:00
Eric Rahm 87cfbc1b65 Bug 1322735 - Remove MOZ_STACKWALKING define. r=glandium
With frame pointer omission disabled we should always have usable stacks on Windows. This allows us to remove the MOZ_STACKWALKING define as it will always be enabled.

MozReview-Commit-ID: 54xs3Hf1r4P

--HG--
extra : rebase_source : dfaf13fb4c2185985f4f074c338ccf1fef8f3c94
2016-12-20 15:11:36 -08:00
Phil Ringnalda 1c2d0d367f Backed out 3 changesets (bug 1322735) for ASan leaks and xpcshell/selftest.py failures
CLOSED TREE

Backed out changeset 01cfc71ce542 (bug 1322735)
Backed out changeset 84c729c41230 (bug 1322735)
Backed out changeset b419aaefae95 (bug 1322735)
2017-01-10 20:17:34 -08:00
Eric Rahm 2e195de610 Bug 1322735 - Remove MOZ_STACKWALKING define. r=glandium
With frame pointer omission disabled we should always have usable stacks on Windows. This allows us to remove the MOZ_STACKWALKING define as it will always be enabled.

MozReview-Commit-ID: 54xs3Hf1r4P

--HG--
extra : rebase_source : 5fe27cdeeb464d81fbedc8c02ac187658bd759e7
2016-12-20 15:11:36 -08:00
Joel Maher 5b50e3503d Bug 1324024 - unable to see fprintf on assertion due to stdout vs stderr. r=ted
MozReview-Commit-ID: EswlrLCWps4
2016-12-19 11:31:01 -05:00
Andrew McCreight 7f15cf986b Bug 1316527 - Return 0 when GetSerialNumber fails to find an existing serial number. r=froydnj
NS_LogCOMPtrAddRef and NS_LogCOMPtrRelease always pass false to
GetSerialNumber, because they pass in everything they get without
regard to whether it is being logged or not, so they don't want to
create a serial number if none exists. This causes the assertions
added in bug 1309051 to be hit. To work around this, I hoist the
assertion into the other callers of this method. Two of them already
had this check, but it was non-fatal.

This also makes the asserts not happen in release builds, as I decided
it doesn't really matter what happens if somebody tries to use it
there.

--HG--
extra : rebase_source : 5e70290492fd442b79b4d40c300a263e322f485b
2016-11-16 12:38:54 -08:00
Andrew McCreight ab2fd3606b Bug 1309051 - Ensure GetSerialNumber is consistent with aCreate. r=froydnj
MozReview-Commit-ID: 92N6vcV2NhP

--HG--
extra : rebase_source : ed0a64e6686683adc50475a1ddf005be90abb66a
2016-10-10 15:57:03 -07:00
Andrew McCreight 21046706e7 Bug 1308995, part 5 - Use early return in NS_LogCtor/Dtor. r=froydnj
This is an unrelated change to fix an issue that was bothering me.

MozReview-Commit-ID: Cxw9WhHfSAf

--HG--
extra : rebase_source : 10e3b3f28ecad0af216dbb368ffdb3b0ff75c7f9
2016-10-10 13:34:53 -07:00
Andrew McCreight 6d99589133 Bug 1308995, part 4 - Rename mAllStats to mStats. r=froydnj
There's only one stats field now.

MozReview-Commit-ID: 9XZLQNrhrIU

--HG--
extra : rebase_source : 3b1543eb28543361e57c477fe74238a5e1f4a5e1
2016-10-10 13:24:05 -07:00
Andrew McCreight d835d1a2f7 Bug 1308995, part 3 - Get rid of mNewStats. r=froydnj
Nobody asks for the new stats, only the total ones, so there's no need
for two sets of statistics.

MozReview-Commit-ID: AO0ue9MPn3N

--HG--
extra : rebase_source : 8d5237c4efdc0ece5bf1a386cae38e394aaadf01
2016-10-10 13:22:37 -07:00
Andrew McCreight e3f825e5a5 Bug 1308995, part 2 - Remove nsTraceRefcnt::StatisticsType arguments. r=froydnj
Only about:bloat used NEW_STATS, so act like we have ALL_STATS
everywhere. A later patch will remove the mNewStats field.

MozReview-Commit-ID: LUJBpS3iYht

--HG--
extra : rebase_source : 543951314e12e7964e3f25c155b658d50ce674a6
2016-10-10 10:56:09 -07:00
Andrew McCreight 4690bf258a Bug 1308995, part 1 - Remove unused DumpStatistics::aOut argument. r=froydnj
Only about:bloat used this argument.

MozReview-Commit-ID: HXIUPVwl5ID

--HG--
extra : rebase_source : 8c12de73d6e5d8b7b733decf4fdd13db810236a4
2016-10-10 10:53:08 -07:00
Andrew McCreight 7f21d47f87 Bug 1308652, part 2 - Only allow nsTraceRefcnt::DumpStatistics to be called once. r=froydnj
DumpStatistics does not track any objects that are created or
destroyed while it is running, which means that any subsequent calls
to it will produce incorrect results. This can lead to incorrect
positive or negative leaks being reported. See 1271182.

Now that about:bloat has been removed, DumpStatistics should only be
called once, during shutdown.

MozReview-Commit-ID: IjMkExeBRBr

--HG--
extra : rebase_source : 5966789c2febfedc796d17f8589e8c3703d266cb
2016-10-10 11:55:15 -07:00
Andrew McCreight 446dcf14dc Bug 1289215 - Mismatched sizes assertion in nsTraceRefcnt.cpp should be fatal. r=froydnj 2016-07-27 10:11:40 -07:00
Andrew McCreight 18f3a1c60a Bug 1284599, part 2 - Add some more comments for #endif. r=froydnj
This doesn't add comments for all of them, just some of those spread
out over many lines. The lack of these comments made writing part 1
more annoying.
2016-07-05 12:03:18 -07:00
Andrew McCreight 698720a6db Bug 1284599, part 1 - Get rid of NS_IMPL_REFCNT_LOGGING. r=froydnj
This is unconditionally true, going back to maybe the removal of #ifdef WINCE code.
2016-07-05 12:03:18 -07:00
Nathan Froyd ea2b81ece8 Bug 1281257 - part 2 - make WalkTheStackCached an internal implementation detail; r=erahm
Nothing needs to call this outside nsTraceRefcnt, and given the
potential memory concerns, keeping it private is a better idea anyway.
2016-06-23 17:21:27 -04:00
Nathan Froyd d98797b821 Bug 1281257 - part 1 - remove nsTraceRefcnt::DemangleSymbol; r=erahm
This function is unused, and the symbol demangling should all be handled
someplace else.
2016-06-23 17:21:27 -04:00
Vladimir Vukicevic a54ea93315 Bug 1221160 - fix AutoTraceLogLock deadlock on Windows; r=froydnj
From e3a1e57c0c8be8214a12e31c6e4950a676efd9bc Mon Sep 17 00:00:00 2001

MozReview-Commit-ID: JrPiE7eixpy

--HG--
extra : rebase_source : 7f322a0c95c46c0bd1721f982fab8ab421866d70
extra : source : 883ed100b755b9a528104a62ed631beaff6c8cf2
2015-11-03 15:13:09 -05:00
Nathan Froyd 4074e6e3f7 Bug 1251895 - don't race on nsTraceRefcnt's object serial number tables; r=mccr8
GetSerialNumber accesses global state through gSerialNumbers.  We call
GetSerialNumber under a lock when doing normal object refcount logging.
However, we call GetSerialNumber outside of a lock when we're tracing
individual classes for nsCOMPtr refcount logging, even if we don't
actually care about nsCOMPtr refcount logging.  We should call it under
a lock always.
2016-02-29 15:04:36 -05:00
Andrew McCreight 55351409af Bug 1245673 - Remove useless NS_INT32_TO_PTR from DumpSerialNumbers. r=froydnj 2016-02-10 10:29:20 -08:00
Andrew McCreight da4c77b206 Bug 1243949 - Fatally assert when we fail to create an XPCOM log. r=froydnj 2016-02-10 10:29:20 -08:00
Ehsan Akhgari 97be810099 Bug 1196430 follow-up: Hide the usage of gCodeAddressService behind #ifdef MOZ_STACKWALKING
This is needed to fix the build bustage on B2G Desktop Windows.
Landed on a CLOSED TREE
2015-09-11 00:06:40 -04:00
Nathan Froyd 89639e1fda Bug 1196430 - part 8 - use less reinterpret_cast in nsTraceRefcnt.cpp; r=mccr8 2015-08-26 22:57:32 -04:00
Nathan Froyd 3953358c0b Bug 1196430 - part 5 - dump allocation stacks for leaked objects in XPCOM_MEM_LOG_CLASSES; r=mccr8 2015-08-26 19:10:22 -04:00
Nathan Froyd d6c3776152 Bug 1196430 - part 4 - record allocation stacks for classes in XPCOM_MEM_LOG_CLASSES; r=mccr8 2015-08-26 18:47:03 -04:00
Nathan Froyd 04974cb31c Bug 1196430 - part 3 - remove unnecessary nsString.h include from nsTraceRefcnt.cpp; r=mccr8 2015-08-26 18:28:35 -04:00
Nathan Froyd e9b6ac22f9 Bug 1196430 - part 2 - give SerialNumberRecord a proper constructor; r=mccr8
Using C++ style is so much nicer for these sorts of things.  This change
also paves the way for easily using non-POD things in SerialNumberRecord.
2015-08-26 18:25:35 -04:00
Nathan Froyd 1acef79801 Bug 1196430 - part 1 - rename serialNumberRecord to SerialNumberRecord; r=mccr8
This is a small cleanup to make the class name conform to coding standards.
2015-08-26 18:24:13 -04:00
Andrew McCreight 2da6cab23a Bug 1190483 - Followup to address review comment. 2015-08-14 10:04:41 -07:00
Andrew McCreight 066918123c Bug 1190483 - Add a way to record a DMD log late in shutdown. r=erahm 2015-08-14 10:00:04 -07:00
Juan Gomez 258ad59e3f Bug 1171931 - Refactor duplicated code using XRE_IsParent/ContentProcess. r=froydnj 2015-07-03 18:29:00 -07:00
Nathan Froyd 8b000ee8d1 Bug 1174344 - make error message for mismatched leak log entries more helpful; r=mccr8 2015-06-29 16:36:32 -04:00
Ryan VanderMeulen 5f5c327690 Backed out changeset 8b4e4083639e (bug 1171931) for B2G debug emulator bustage. 2015-06-25 19:48:42 -04:00
Juan Gomez 702a59d135 Bug 1171931 - Refactor duplicated code using XRE_IsParent/ContentProcess. r=froydnj
--HG--
extra : rebase_source : 2ecbe6c1dd8a7ad8dc529b53349ad431cf1116c9
2015-06-24 14:11:00 -04:00
Benoit Girard 8d6a67f6d3 Bug 1172216 - Move nsStackwalk to mozglue. r=glandium
--HG--
rename : xpcom/base/nsStackWalk.cpp => mozglue/misc/StackWalk.cpp
rename : xpcom/base/nsStackWalk.h => mozglue/misc/StackWalk.h
extra : commitid : EMbWGfjKvdq
extra : rebase_source : b7308eb569cc1a019d3b7a92aaff0de7a49b5682
2015-06-10 16:32:45 -04:00
Eric Rahm 3925a960aa Bug 1165515 - Part 1: Convert PR_LOG to MOZ_LOG. r=froydnj 2015-05-21 13:22:04 -07:00
Andrew McCreight 76843426d0 Bug 1157304 - Make the empty classname assertion in BloatEntry fatal. r=froydnj 2015-04-27 10:28:19 -04:00