Bug 1353440 - Part 2: Don't register the annotator until after the HangMonitor has started, r=ehsan

MozReview-Commit-ID: 2QJMRAUQraL
This commit is contained in:
Michael Layzell 2017-05-11 15:51:12 -04:00
Родитель 39225e3f07
Коммит c0af0974b3
1 изменённых файлов: 7 добавлений и 4 удалений

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

@ -10511,10 +10511,13 @@ nsContentUtils::UserInteractionObserver::Init()
obs->AddObserver(this, kUserInteractionInactive, false);
obs->AddObserver(this, kUserInteractionActive, false);
// Register ourselves as an annotator for the Background Hang Reporter, so
// that hang stacks are annotated with whether or not the user was
// interacting with the browser when the hang occurred.
HangMonitor::RegisterAnnotator(*this);
// We can't register ourselves as an annotator yet, as the HangMonitor hasn't
// started yet. It will have started by the time we have the chance to spin
// the event loop.
RefPtr<UserInteractionObserver> self = this;
NS_DispatchToMainThread(NS_NewRunnableFunction([=] () {
HangMonitor::RegisterAnnotator(*self);
}));
}
void