Bug 937157, part 8 - Remove XPC_TRACK_SCOPE_STATS. r=bholley

This commit is contained in:
Andrew McCreight 2013-11-17 14:47:00 -08:00
Родитель 56fc3fe5c5
Коммит 9f6d14d6ee
2 изменённых файлов: 0 добавлений и 73 удалений

Просмотреть файл

@ -20,67 +20,6 @@ using namespace JS;
/***************************************************************************/ /***************************************************************************/
#ifdef XPC_TRACK_SCOPE_STATS
static int DEBUG_TotalScopeCount;
static int DEBUG_TotalLiveScopeCount;
static int DEBUG_TotalMaxScopeCount;
static int DEBUG_TotalScopeTraversalCount;
static bool DEBUG_DumpedStats;
#endif
#ifdef DEBUG
static void DEBUG_TrackNewScope(XPCWrappedNativeScope* scope)
{
#ifdef XPC_TRACK_SCOPE_STATS
DEBUG_TotalScopeCount++;
DEBUG_TotalLiveScopeCount++;
if (DEBUG_TotalMaxScopeCount < DEBUG_TotalLiveScopeCount)
DEBUG_TotalMaxScopeCount = DEBUG_TotalLiveScopeCount;
#endif
}
static void DEBUG_TrackDeleteScope(XPCWrappedNativeScope* scope)
{
#ifdef XPC_TRACK_SCOPE_STATS
DEBUG_TotalLiveScopeCount--;
#endif
}
static void DEBUG_TrackScopeTraversal()
{
#ifdef XPC_TRACK_SCOPE_STATS
DEBUG_TotalScopeTraversalCount++;
#endif
}
static void DEBUG_TrackScopeShutdown()
{
#ifdef XPC_TRACK_SCOPE_STATS
if (!DEBUG_DumpedStats) {
DEBUG_DumpedStats = true;
printf("%d XPCWrappedNativeScope(s) were constructed.\n",
DEBUG_TotalScopeCount);
printf("%d XPCWrappedNativeScopes(s) max alive at one time.\n",
DEBUG_TotalMaxScopeCount);
printf("%d XPCWrappedNativeScope(s) alive now.\n" ,
DEBUG_TotalLiveScopeCount);
printf("%d traversals of Scope list.\n",
DEBUG_TotalScopeTraversalCount);
}
#endif
}
#else
#define DEBUG_TrackNewScope(scope) ((void)0)
#define DEBUG_TrackDeleteScope(scope) ((void)0)
#define DEBUG_TrackScopeTraversal() ((void)0)
#define DEBUG_TrackScopeShutdown() ((void)0)
#endif
/***************************************************************************/
XPCWrappedNativeScope* XPCWrappedNativeScope::gScopes = nullptr; XPCWrappedNativeScope* XPCWrappedNativeScope::gScopes = nullptr;
XPCWrappedNativeScope* XPCWrappedNativeScope::gDyingScopes = nullptr; XPCWrappedNativeScope* XPCWrappedNativeScope::gDyingScopes = nullptr;
@ -156,7 +95,6 @@ XPCWrappedNativeScope::XPCWrappedNativeScope(JSContext *cx,
mContext->AddScope(this); mContext->AddScope(this);
} }
DEBUG_TrackNewScope(this);
MOZ_COUNT_CTOR(XPCWrappedNativeScope); MOZ_COUNT_CTOR(XPCWrappedNativeScope);
// Attach ourselves to the compartment private. // Attach ourselves to the compartment private.
@ -310,7 +248,6 @@ bool UseXBLScope(JSCompartment *c)
XPCWrappedNativeScope::~XPCWrappedNativeScope() XPCWrappedNativeScope::~XPCWrappedNativeScope()
{ {
MOZ_COUNT_DTOR(XPCWrappedNativeScope); MOZ_COUNT_DTOR(XPCWrappedNativeScope);
DEBUG_TrackDeleteScope(this);
// We can do additional cleanup assertions here... // We can do additional cleanup assertions here...
@ -495,8 +432,6 @@ XPCWrappedNativeScope::MarkAllWrappedNativesAndProtos()
cur->mWrappedNativeProtoMap->Enumerate(WrappedNativeProtoMarker, nullptr); cur->mWrappedNativeProtoMap->Enumerate(WrappedNativeProtoMarker, nullptr);
cur->mMainThreadWrappedNativeProtoMap->Enumerate(WrappedNativeProtoMarker, nullptr); cur->mMainThreadWrappedNativeProtoMap->Enumerate(WrappedNativeProtoMarker, nullptr);
} }
DEBUG_TrackScopeTraversal();
} }
#ifdef DEBUG #ifdef DEBUG
@ -542,8 +477,6 @@ XPCWrappedNativeScope::SweepAllWrappedNativeTearOffs()
{ {
for (XPCWrappedNativeScope* cur = gScopes; cur; cur = cur->mNext) for (XPCWrappedNativeScope* cur = gScopes; cur; cur = cur->mNext)
cur->mWrappedNativeMap->Enumerate(WrappedNativeTearoffSweeper, nullptr); cur->mWrappedNativeMap->Enumerate(WrappedNativeTearoffSweeper, nullptr);
DEBUG_TrackScopeTraversal();
} }
// static // static
@ -598,9 +531,6 @@ WrappedNativeProtoShutdownEnumerator(PLDHashTable *table, PLDHashEntryHdr *hdr,
void void
XPCWrappedNativeScope::SystemIsBeingShutDown() XPCWrappedNativeScope::SystemIsBeingShutDown()
{ {
DEBUG_TrackScopeTraversal();
DEBUG_TrackScopeShutdown();
int liveScopeCount = 0; int liveScopeCount = 0;
ShutdownData data; ShutdownData data;
@ -679,8 +609,6 @@ XPCWrappedNativeScope::ClearAllWrappedNativeSecurityPolicies()
cur->mMainThreadWrappedNativeProtoMap->Enumerate(WNProtoSecPolicyClearer, nullptr); cur->mMainThreadWrappedNativeProtoMap->Enumerate(WNProtoSecPolicyClearer, nullptr);
} }
DEBUG_TrackScopeTraversal();
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -181,7 +181,6 @@
#if defined(DEBUG_xpc_hacker) #if defined(DEBUG_xpc_hacker)
#define XPC_DUMP_AT_SHUTDOWN #define XPC_DUMP_AT_SHUTDOWN
#define XPC_TRACK_WRAPPER_STATS #define XPC_TRACK_WRAPPER_STATS
#define XPC_TRACK_SCOPE_STATS
#endif #endif
/***************************************************************************/ /***************************************************************************/