mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1163006, part 1 - Make the cycle collector use the concrete logger class. r=smaug
This patch makes it so that while the cycle collector is running methods are called on the concrete implementation nsCycleCollectorLogger, rather than the interface nsICycleCollectorListener. This makes explicit the requirement that we have to be very careful about what we call during the cycle collector, and should make it possible for the GC rooting static analysis to understand what is happening. The UUID of nsICycleCollectorHandler was changed to appease the UUID commit hook.
This commit is contained in:
parent
35a56dc6bb
commit
856e059cf4
@ -1255,7 +1255,7 @@ class nsCycleCollector : public nsIMemoryReporter
|
||||
ccPhase mIncrementalPhase;
|
||||
CCGraph mGraph;
|
||||
nsAutoPtr<CCGraphBuilder> mBuilder;
|
||||
nsCOMPtr<nsICycleCollectorListener> mListener;
|
||||
nsRefPtr<nsCycleCollectorLogger> mListener;
|
||||
|
||||
DebugOnly<void*> mThread;
|
||||
|
||||
@ -1962,6 +1962,12 @@ public:
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD AsLogger(nsCycleCollectorLogger** aRetVal) override
|
||||
{
|
||||
nsRefPtr<nsCycleCollectorLogger> rval = this;
|
||||
rval.forget(aRetVal);
|
||||
return NS_OK;
|
||||
}
|
||||
private:
|
||||
void ClearDescribers()
|
||||
{
|
||||
@ -2026,7 +2032,7 @@ private:
|
||||
nsCycleCollectionParticipant* mJSParticipant;
|
||||
nsCycleCollectionParticipant* mJSZoneParticipant;
|
||||
nsCString mNextEdgeName;
|
||||
nsCOMPtr<nsICycleCollectorListener> mListener;
|
||||
nsRefPtr<nsCycleCollectorLogger> mListener;
|
||||
bool mMergeZones;
|
||||
nsAutoPtr<NodePool::Enumerator> mCurrNode;
|
||||
|
||||
@ -2034,7 +2040,7 @@ public:
|
||||
CCGraphBuilder(CCGraph& aGraph,
|
||||
CycleCollectorResults& aResults,
|
||||
CycleCollectedJSRuntime* aJSRuntime,
|
||||
nsICycleCollectorListener* aListener,
|
||||
nsCycleCollectorLogger* aListener,
|
||||
bool aMergeZones);
|
||||
virtual ~CCGraphBuilder();
|
||||
|
||||
@ -2132,7 +2138,7 @@ private:
|
||||
CCGraphBuilder::CCGraphBuilder(CCGraph& aGraph,
|
||||
CycleCollectorResults& aResults,
|
||||
CycleCollectedJSRuntime* aJSRuntime,
|
||||
nsICycleCollectorListener* aListener,
|
||||
nsCycleCollectorLogger* aListener,
|
||||
bool aMergeZones)
|
||||
: mGraph(aGraph)
|
||||
, mResults(aResults)
|
||||
@ -2937,7 +2943,7 @@ nsCycleCollector::ScanWeakMaps()
|
||||
class PurpleScanBlackVisitor
|
||||
{
|
||||
public:
|
||||
PurpleScanBlackVisitor(CCGraph& aGraph, nsICycleCollectorListener* aListener,
|
||||
PurpleScanBlackVisitor(CCGraph& aGraph, nsCycleCollectorLogger* aListener,
|
||||
uint32_t& aCount, bool& aFailed)
|
||||
: mGraph(aGraph), mListener(aListener), mCount(aCount), mFailed(aFailed)
|
||||
{
|
||||
@ -2973,7 +2979,7 @@ public:
|
||||
|
||||
private:
|
||||
CCGraph& mGraph;
|
||||
nsCOMPtr<nsICycleCollectorListener> mListener;
|
||||
nsRefPtr<nsCycleCollectorLogger> mListener;
|
||||
uint32_t& mCount;
|
||||
bool& mFailed;
|
||||
};
|
||||
@ -3746,7 +3752,11 @@ nsCycleCollector::BeginCollection(ccType aCCType,
|
||||
// Set up the listener for this CC.
|
||||
MOZ_ASSERT_IF(isShutdown, !aManualListener);
|
||||
MOZ_ASSERT(!mListener, "Forgot to clear a previous listener?");
|
||||
mListener = aManualListener;
|
||||
|
||||
if (aManualListener) {
|
||||
aManualListener->AsLogger(getter_AddRefs(mListener));
|
||||
}
|
||||
|
||||
aManualListener = nullptr;
|
||||
if (!mListener && mParams.LogThisCC(isShutdown)) {
|
||||
nsRefPtr<nsCycleCollectorLogger> logger = new nsCycleCollectorLogger();
|
||||
|
@ -6,9 +6,12 @@
|
||||
|
||||
%{C++
|
||||
#include <stdio.h>
|
||||
|
||||
class nsCycleCollectorLogger;
|
||||
%}
|
||||
|
||||
[ptr] native FILE(FILE);
|
||||
[ptr] native nsCycleCollectorLoggerPtr (nsCycleCollectorLogger);
|
||||
interface nsIFile;
|
||||
|
||||
/**
|
||||
@ -38,7 +41,7 @@ interface nsIFile;
|
||||
* The methods are a subset of those in nsICycleCollectorListener; see the
|
||||
* descriptions there.
|
||||
*/
|
||||
[scriptable, uuid(39a8f80e-7eee-4141-b9ef-6e2a7d6e466d)]
|
||||
[scriptable, uuid(7f093367-1492-4b89-87af-c01dbc831246)]
|
||||
interface nsICycleCollectorHandler : nsISupports
|
||||
{
|
||||
void noteRefCountedObject(in ACString aAddress,
|
||||
@ -144,7 +147,7 @@ interface nsICycleCollectorLogSink : nsISupports
|
||||
* on objects however it pleases: the cycle collector has finished its
|
||||
* work, and the JS code is simply consuming recorded data.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(c7d55656-e0d8-4986-88bb-cb28cb55b993)]
|
||||
[scriptable, builtinclass, uuid(d88a2896-7357-4462-ad5f-939d264ff64c)]
|
||||
interface nsICycleCollectorListener : nsISupports
|
||||
{
|
||||
// Return a listener that directs the cycle collector to traverse
|
||||
@ -204,4 +207,9 @@ interface nsICycleCollectorListener : nsISupports
|
||||
// Note that we only record events to report here if our
|
||||
// |wantAfterProcessing| property is true.
|
||||
boolean processNext(in nsICycleCollectorHandler aHandler);
|
||||
|
||||
// Return the current object as an nsCycleCollectorLogger*, which is the
|
||||
// only class that should be implementing this interface. We need the
|
||||
// concrete implementation type to help the GC rooting analysis.
|
||||
[noscript] nsCycleCollectorLoggerPtr asLogger();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user