зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1635196 - Make sure GetSymbolTableMozPromise promise is always fulfilled - r=mstange
In rare cases, a dispatch may fail (e.g., threads are shutting down), we should handle this failure by rejecting the promise on the spot. Depends on D73791 Differential Revision: https://phabricator.services.mozilla.com/D73792
This commit is contained in:
Родитель
32a725405b
Коммит
29ec866e31
|
@ -870,7 +870,7 @@ RefPtr<nsProfiler::SymbolTablePromise> nsProfiler::GetSymbolTableMozPromise(
|
|||
}
|
||||
}
|
||||
|
||||
mSymbolTableThread->Dispatch(NS_NewRunnableFunction(
|
||||
nsresult rv = mSymbolTableThread->Dispatch(NS_NewRunnableFunction(
|
||||
"nsProfiler::GetSymbolTableMozPromise runnable on ProfSymbolTable thread",
|
||||
[promiseHolder = std::move(promiseHolder),
|
||||
debugPath = nsCString(aDebugPath),
|
||||
|
@ -887,6 +887,12 @@ RefPtr<nsProfiler::SymbolTablePromise> nsProfiler::GetSymbolTableMozPromise(
|
|||
}
|
||||
}));
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
// Get-symbol task was not dispatched and therefore won't fulfill the
|
||||
// promise, we must reject the promise now.
|
||||
promiseHolder.Reject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче