Bug 713778 - nsICycleCollectorListener should not enable trace_all by default, r=mccr8

This commit is contained in:
Olli Pettay 2012-01-01 23:48:42 +02:00
Родитель 79aa17fb86
Коммит f4637a54ab
2 изменённых файлов: 34 добавлений и 9 удалений

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

@ -1373,7 +1373,7 @@ GraphWalker<Visitor>::DoWalk(nsDeque &aQueue)
class nsCycleCollectorLogger : public nsICycleCollectorListener
{
public:
nsCycleCollectorLogger() : mStream(nsnull)
nsCycleCollectorLogger() : mStream(nsnull), mWantAllTraces(false)
{
}
~nsCycleCollectorLogger()
@ -1384,6 +1384,19 @@ public:
}
NS_DECL_ISUPPORTS
NS_IMETHOD AllTraces(nsICycleCollectorListener** aListener)
{
mWantAllTraces = true;
NS_ADDREF(*aListener = this);
return NS_OK;
}
NS_IMETHOD GetWantAllTraces(bool* aAllTraces)
{
*aAllTraces = mWantAllTraces;
return NS_OK;
}
NS_IMETHOD Begin()
{
char name[255];
@ -1442,6 +1455,7 @@ public:
private:
FILE *mStream;
bool mWantAllTraces;
static PRUint32 gLogCounter;
};
@ -1570,17 +1584,24 @@ GCGraphBuilder::GCGraphBuilder(GCGraph &aGraph,
if (!PL_DHashTableInit(&mPtrToNodeMap, &PtrNodeOps, nsnull,
sizeof(PtrToNodeEntry), 32768))
mPtrToNodeMap.ops = nsnull;
// We want all edges and all info if DEBUG_CC is set or if we have a
// listener. Do we want them all the time?
#ifndef DEBUG_CC
if (mListener)
#endif
{
mFlags |= nsCycleCollectionTraversalCallback::WANT_DEBUG_INFO |
PRUint32 flags = 0;
#ifdef DEBUG_CC
flags = nsCycleCollectionTraversalCallback::WANT_DEBUG_INFO |
nsCycleCollectionTraversalCallback::WANT_ALL_TRACES;
#endif
if (!flags && mListener) {
flags = nsCycleCollectionTraversalCallback::WANT_DEBUG_INFO;
bool all = false;
mListener->GetWantAllTraces(&all);
if (all) {
flags |= nsCycleCollectionTraversalCallback::WANT_ALL_TRACES;
}
}
mFlags |= flags;
}
GCGraphBuilder::~GCGraphBuilder()
{
if (mPtrToNodeMap.ops)

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

@ -49,9 +49,13 @@
* a call to end(). If begin() returns an error none of the other
* functions will be called.
*/
[scriptable, uuid(3f3901bb-6a1c-4998-b32e-6f10a51db470)]
[scriptable, uuid(35a3a9b0-a120-4bf7-9739-46027fe96212)]
interface nsICycleCollectorListener : nsISupports
{
nsICycleCollectorListener allTraces();
// false if allTraces() has not been called.
readonly attribute boolean wantAllTraces;
void begin();
void noteRefCountedObject (in unsigned long long aAddress,
in unsigned long aRefCount,