forked from mirrors/gecko-dev
Bug 1798651 Part 2: Make WinWindowOcclusionTracker::ShutDown timeout after 2 seconds. r=gfx-reviewers,sotaro
Differential Revision: https://phabricator.services.mozilla.com/D161195
This commit is contained in:
parent
9a1afee97e
commit
06dd7edc6c
1 changed files with 10 additions and 3 deletions
|
|
@ -371,15 +371,22 @@ void WinWindowOcclusionTracker::ShutDown() {
|
|||
|
||||
sTracker->Destroy();
|
||||
|
||||
// Our shutdown task could hang. Since we're shutting down,
|
||||
// that's not a critical problem. We set a reasonable amount
|
||||
// of time to wait for shutdown, and if it succeeds within
|
||||
// that time, we correctly stop our tracker thread. If it
|
||||
// times out, we just leak the memory and proceed.
|
||||
static const PRIntervalTime TIMEOUT = PR_TicksPerSecond() * 2;
|
||||
layers::SynchronousTask task("WinWindowOcclusionTracker");
|
||||
RefPtr<Runnable> runnable =
|
||||
WrapRunnable(RefPtr<WindowOcclusionCalculator>(
|
||||
WindowOcclusionCalculator::GetInstance()),
|
||||
&WindowOcclusionCalculator::Shutdown, &task);
|
||||
OcclusionCalculatorLoop()->PostTask(runnable.forget());
|
||||
task.Wait();
|
||||
|
||||
sTracker->mThread->Stop();
|
||||
nsresult rv = task.Wait(TIMEOUT);
|
||||
if (rv == NS_OK) {
|
||||
sTracker->mThread->Stop();
|
||||
}
|
||||
|
||||
WindowOcclusionCalculator::ClearInstance();
|
||||
sTracker = nullptr;
|
||||
|
|
|
|||
Loading…
Reference in a new issue