refactor: migrates util::Promise to gin (#20871)
* refactor: use gin in Promise * refactor: separate Promise impl that returns nothing * refactor: use Promise<void> for promise that returns nothing * fix: methods should be able to run on both browser and renderer process * fix: should not pass base::StringPiece across threads * refactor: no more need to use different ResolvePromise for empty Promise * refactor: move Promise to gin_helper
This commit is contained in:
parent
bff113760a
commit
eaf2c61bef
48 changed files with 483 additions and 479 deletions
|
@ -47,7 +47,7 @@ void GPUInfoManager::ProcessCompleteInfo() {
|
|||
// We have received the complete information, resolve all promises that
|
||||
// were waiting for this info.
|
||||
for (auto& promise : complete_info_promise_set_) {
|
||||
promise.ResolveWithGin(*result);
|
||||
promise.Resolve(*result);
|
||||
}
|
||||
complete_info_promise_set_.clear();
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ void GPUInfoManager::OnGpuInfoUpdate() {
|
|||
|
||||
// Should be posted to the task runner
|
||||
void GPUInfoManager::CompleteInfoFetcher(
|
||||
util::Promise<base::DictionaryValue> promise) {
|
||||
gin_helper::Promise<base::DictionaryValue> promise) {
|
||||
complete_info_promise_set_.emplace_back(std::move(promise));
|
||||
|
||||
if (NeedsCompleteGpuInfoCollection()) {
|
||||
|
@ -75,7 +75,7 @@ void GPUInfoManager::CompleteInfoFetcher(
|
|||
}
|
||||
|
||||
void GPUInfoManager::FetchCompleteInfo(
|
||||
util::Promise<base::DictionaryValue> promise) {
|
||||
gin_helper::Promise<base::DictionaryValue> promise) {
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&GPUInfoManager::CompleteInfoFetcher,
|
||||
base::Unretained(this), std::move(promise)));
|
||||
|
@ -84,10 +84,10 @@ void GPUInfoManager::FetchCompleteInfo(
|
|||
// This fetches the info synchronously, so no need to post to the task queue.
|
||||
// There cannot be multiple promises as they are resolved synchronously.
|
||||
void GPUInfoManager::FetchBasicInfo(
|
||||
util::Promise<base::DictionaryValue> promise) {
|
||||
gin_helper::Promise<base::DictionaryValue> promise) {
|
||||
gpu::GPUInfo gpu_info;
|
||||
CollectBasicGraphicsInfo(&gpu_info);
|
||||
promise.ResolveWithGin(*EnumerateGPUInfo(gpu_info));
|
||||
promise.Resolve(*EnumerateGPUInfo(gpu_info));
|
||||
}
|
||||
|
||||
std::unique_ptr<base::DictionaryValue> GPUInfoManager::EnumerateGPUInfo(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue