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:
Gerald Squelart 2020-05-05 21:07:24 +00:00
Родитель 52ffb43ad5
Коммит 32a725405b
1 изменённых файлов: 5 добавлений и 12 удалений

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

@ -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;