mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 977940, part 2 - Don't automatically trigger the ghost window detector during ICC. r=smaug
This commit is contained in:
parent
441f162633
commit
b6035c87a3
@ -31,7 +31,9 @@ StaticRefPtr<nsWindowMemoryReporter> sWindowReporter;
|
|||||||
const int32_t kTimeBetweenChecks = 45; /* seconds */
|
const int32_t kTimeBetweenChecks = 45; /* seconds */
|
||||||
|
|
||||||
nsWindowMemoryReporter::nsWindowMemoryReporter()
|
nsWindowMemoryReporter::nsWindowMemoryReporter()
|
||||||
: mLastCheckForGhostWindows(TimeStamp::NowLoRes())
|
: mLastCheckForGhostWindows(TimeStamp::NowLoRes()),
|
||||||
|
mCycleCollectorIsRunning(false),
|
||||||
|
mCheckTimerWaitingForCCEnd(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,6 +118,10 @@ nsWindowMemoryReporter::Init()
|
|||||||
/* weakRef = */ true);
|
/* weakRef = */ true);
|
||||||
os->AddObserver(sWindowReporter, "after-minimize-memory-usage",
|
os->AddObserver(sWindowReporter, "after-minimize-memory-usage",
|
||||||
/* weakRef = */ true);
|
/* weakRef = */ true);
|
||||||
|
os->AddObserver(sWindowReporter, "cycle-collector-begin",
|
||||||
|
/* weakRef = */ true);
|
||||||
|
os->AddObserver(sWindowReporter, "cycle-collector-end",
|
||||||
|
/* weakRef = */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
RegisterStrongMemoryReporter(new GhostWindowsReporter());
|
RegisterStrongMemoryReporter(new GhostWindowsReporter());
|
||||||
@ -619,6 +625,18 @@ nsWindowMemoryReporter::Observe(nsISupports *aSubject, const char *aTopic,
|
|||||||
ObserveDOMWindowDetached(aSubject);
|
ObserveDOMWindowDetached(aSubject);
|
||||||
} else if (!strcmp(aTopic, "after-minimize-memory-usage")) {
|
} else if (!strcmp(aTopic, "after-minimize-memory-usage")) {
|
||||||
ObserveAfterMinimizeMemoryUsage();
|
ObserveAfterMinimizeMemoryUsage();
|
||||||
|
} else if (!strcmp(aTopic, "cycle-collector-begin")) {
|
||||||
|
if (mCheckTimer) {
|
||||||
|
mCheckTimerWaitingForCCEnd = true;
|
||||||
|
KillCheckTimer();
|
||||||
|
}
|
||||||
|
mCycleCollectorIsRunning = true;
|
||||||
|
} else if (!strcmp(aTopic, "cycle-collector-end")) {
|
||||||
|
mCycleCollectorIsRunning = false;
|
||||||
|
if (mCheckTimerWaitingForCCEnd) {
|
||||||
|
mCheckTimerWaitingForCCEnd = false;
|
||||||
|
AsyncCheckForGhostWindows();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
MOZ_ASSERT(false);
|
MOZ_ASSERT(false);
|
||||||
}
|
}
|
||||||
@ -645,6 +663,7 @@ void
|
|||||||
nsWindowMemoryReporter::CheckTimerFired(nsITimer* aTimer, void* aClosure)
|
nsWindowMemoryReporter::CheckTimerFired(nsITimer* aTimer, void* aClosure)
|
||||||
{
|
{
|
||||||
if (sWindowReporter) {
|
if (sWindowReporter) {
|
||||||
|
MOZ_ASSERT(!sWindowReporter->mCycleCollectorIsRunning);
|
||||||
sWindowReporter->CheckForGhostWindows();
|
sWindowReporter->CheckForGhostWindows();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -656,6 +675,11 @@ nsWindowMemoryReporter::AsyncCheckForGhostWindows()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mCycleCollectorIsRunning) {
|
||||||
|
mCheckTimerWaitingForCCEnd = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If more than kTimeBetweenChecks seconds have elapsed since the last check,
|
// If more than kTimeBetweenChecks seconds have elapsed since the last check,
|
||||||
// timerDelay is 0. Otherwise, it is kTimeBetweenChecks, reduced by the time
|
// timerDelay is 0. Otherwise, it is kTimeBetweenChecks, reduced by the time
|
||||||
// since the last check. Reducing the delay by the time since the last check
|
// since the last check. Reducing the delay by the time since the last check
|
||||||
|
@ -237,6 +237,10 @@ private:
|
|||||||
mozilla::TimeStamp mLastCheckForGhostWindows;
|
mozilla::TimeStamp mLastCheckForGhostWindows;
|
||||||
|
|
||||||
nsCOMPtr<nsITimer> mCheckTimer;
|
nsCOMPtr<nsITimer> mCheckTimer;
|
||||||
|
|
||||||
|
bool mCycleCollectorIsRunning;
|
||||||
|
|
||||||
|
bool mCheckTimerWaitingForCCEnd;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsWindowMemoryReporter_h__
|
#endif // nsWindowMemoryReporter_h__
|
||||||
|
@ -729,6 +729,11 @@ void
|
|||||||
XPCJSRuntime::EndCycleCollectionCallback(CycleCollectorResults &aResults)
|
XPCJSRuntime::EndCycleCollectionCallback(CycleCollectorResults &aResults)
|
||||||
{
|
{
|
||||||
nsJSContext::EndCycleCollectionCallback(aResults);
|
nsJSContext::EndCycleCollectionCallback(aResults);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||||
|
if (obs) {
|
||||||
|
obs->NotifyObservers(nullptr, "cycle-collector-end", nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user