зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1635196 - GetSymbolTableMozPromise can fulfill the promise on any thread - r=mstange
It is not necessary to dispatch another task to the main thread to resolve/reject a MozPromiseHolder, because wherever this happens, the attached `Then` will do its own dispatch to the main thread. Also, this removes a dispatch that could potentially fail, leaving the promise unfulfilled. Depends on D73790 Differential Revision: https://phabricator.services.mozilla.com/D73791
This commit is contained in:
Родитель
52ffb43ad5
Коммит
32a725405b
|
@ -880,18 +880,11 @@ RefPtr<nsProfiler::SymbolTablePromise> nsProfiler::GetSymbolTableMozPromise(
|
|||
SymbolTable symbolTable;
|
||||
bool succeeded = profiler_get_symbol_table(
|
||||
debugPath.get(), breakpadID.get(), &symbolTable);
|
||||
SchedulerGroup::Dispatch(
|
||||
TaskCategory::Other,
|
||||
NS_NewRunnableFunction(
|
||||
"nsProfiler::GetSymbolTableMozPromise result on main thread",
|
||||
[promiseHolder = std::move(promiseHolder),
|
||||
symbolTable = std::move(symbolTable), succeeded]() mutable {
|
||||
if (succeeded) {
|
||||
promiseHolder.Resolve(std::move(symbolTable), __func__);
|
||||
} else {
|
||||
promiseHolder.Reject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
}));
|
||||
if (succeeded) {
|
||||
promiseHolder.Resolve(std::move(symbolTable), __func__);
|
||||
} else {
|
||||
promiseHolder.Reject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
}));
|
||||
|
||||
return promise;
|
||||
|
|
Загрузка…
Ссылка в новой задаче