Bug 1594015: Ensure that threads with odd ProcessNextEvent loops get correct event delays r=froydnj

Socket Thread and Worker Threads use custom event loops and don't wait in
calls to ProcessNextEvent all the time; this can lead to odd Responsiveness numbers.

Differential Revision: https://phabricator.services.mozilla.com/D51835

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Randell Jesup 2019-11-08 21:07:52 +00:00
Родитель 4be7858359
Коммит a42777ee14
2 изменённых файлов: 11 добавлений и 0 удалений

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

@ -2764,6 +2764,12 @@ void WorkerPrivate::DoRunLoop(JSContext* aCx) {
!(debuggerRunnablesPending = !mDebuggerQueue.IsEmpty()) && !(debuggerRunnablesPending = !mDebuggerQueue.IsEmpty()) &&
!(normalRunnablesPending = NS_HasPendingEvents(mThread)) && !(normalRunnablesPending = NS_HasPendingEvents(mThread)) &&
!(mStatus != Running && !HasActiveWorkerRefs())) { !(mStatus != Running && !HasActiveWorkerRefs())) {
// We pop out to this loop when there are no pending events.
// If we don't reset these, we may not re-enter ProcessNextEvent()
// until we have events to process, and it may seem like we have
// an event running for a very long time.
mThread->SetRunningEventDelay(TimeDuration(), TimeStamp());
WaitForWorkerEvents(); WaitForWorkerEvents();
} }

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

@ -961,6 +961,11 @@ nsSocketTransportService::Run() {
startOfNextIteration = TimeStamp::NowLoRes(); startOfNextIteration = TimeStamp::NowLoRes();
} }
pollDuration = nullptr; pollDuration = nullptr;
// We pop out to this loop when there are no pending events.
// If we don't reset these, we may not re-enter ProcessNextEvent()
// until we have events to process, and it may seem like we have
// an event running for a very long time.
mRawThread->SetRunningEventDelay(TimeDuration(), TimeStamp());
do { do {
if (Telemetry::CanRecordPrereleaseData()) { if (Telemetry::CanRecordPrereleaseData()) {