зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1691517: Do not crash inside TaskController when the main thread is unavailable. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D105402
This commit is contained in:
Родитель
d3f260db6d
Коммит
bbb0d338be
|
@ -655,10 +655,15 @@ bool TaskController::ExecuteNextTaskOnlyMainThreadInternal(
|
||||||
|
|
||||||
bool TaskController::DoExecuteNextTaskOnlyMainThreadInternal(
|
bool TaskController::DoExecuteNextTaskOnlyMainThreadInternal(
|
||||||
const MutexAutoLock& aProofOfLock) {
|
const MutexAutoLock& aProofOfLock) {
|
||||||
|
#ifdef MOZ_GECKO_PROFILER
|
||||||
nsCOMPtr<nsIThread> mainIThread;
|
nsCOMPtr<nsIThread> mainIThread;
|
||||||
NS_GetMainThread(getter_AddRefs(mainIThread));
|
NS_GetMainThread(getter_AddRefs(mainIThread));
|
||||||
|
|
||||||
nsThread* mainThread = static_cast<nsThread*>(mainIThread.get());
|
nsThread* mainThread = static_cast<nsThread*>(mainIThread.get());
|
||||||
mainThread->SetRunningEventDelay(TimeDuration(), TimeStamp());
|
if (mainThread) {
|
||||||
|
mainThread->SetRunningEventDelay(TimeDuration(), TimeStamp());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t totalSuspended = 0;
|
uint32_t totalSuspended = 0;
|
||||||
for (TaskManager* manager : mTaskManagers) {
|
for (TaskManager* manager : mTaskManagers) {
|
||||||
|
@ -735,10 +740,12 @@ bool TaskController::DoExecuteNextTaskOnlyMainThreadInternal(
|
||||||
TimeStamp now = TimeStamp::Now();
|
TimeStamp now = TimeStamp::Now();
|
||||||
|
|
||||||
#ifdef MOZ_GECKO_PROFILER
|
#ifdef MOZ_GECKO_PROFILER
|
||||||
if (task->GetPriority() < uint32_t(EventQueuePriority::InputHigh)) {
|
if (mainThread) {
|
||||||
mainThread->SetRunningEventDelay(TimeDuration(), now);
|
if (task->GetPriority() < uint32_t(EventQueuePriority::InputHigh)) {
|
||||||
} else {
|
mainThread->SetRunningEventDelay(TimeDuration(), now);
|
||||||
mainThread->SetRunningEventDelay(now - task->mInsertionTime, now);
|
} else {
|
||||||
|
mainThread->SetRunningEventDelay(now - task->mInsertionTime, now);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче