refactor: make util::Promise type safe when chaining in native (#19809)
* refactor: make util::Promise type safe when chaining in native * fixup! refactor: make util::Promise type safe when chaining in native * chore: remove spare brackets
This commit is contained in:
parent
f7e3e1f97a
commit
6a3922d330
39 changed files with 275 additions and 343 deletions
|
@ -61,7 +61,8 @@ void GPUInfoManager::OnGpuInfoUpdate() {
|
|||
}
|
||||
|
||||
// Should be posted to the task runner
|
||||
void GPUInfoManager::CompleteInfoFetcher(util::Promise promise) {
|
||||
void GPUInfoManager::CompleteInfoFetcher(
|
||||
util::Promise<base::DictionaryValue> promise) {
|
||||
complete_info_promise_set_.emplace_back(std::move(promise));
|
||||
|
||||
if (NeedsCompleteGpuInfoCollection()) {
|
||||
|
@ -71,7 +72,8 @@ void GPUInfoManager::CompleteInfoFetcher(util::Promise promise) {
|
|||
}
|
||||
}
|
||||
|
||||
void GPUInfoManager::FetchCompleteInfo(util::Promise promise) {
|
||||
void GPUInfoManager::FetchCompleteInfo(
|
||||
util::Promise<base::DictionaryValue> promise) {
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&GPUInfoManager::CompleteInfoFetcher,
|
||||
base::Unretained(this), std::move(promise)));
|
||||
|
@ -79,7 +81,8 @@ void GPUInfoManager::FetchCompleteInfo(util::Promise promise) {
|
|||
|
||||
// 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 promise) {
|
||||
void GPUInfoManager::FetchBasicInfo(
|
||||
util::Promise<base::DictionaryValue> promise) {
|
||||
gpu::GPUInfo gpu_info;
|
||||
CollectBasicGraphicsInfo(&gpu_info);
|
||||
promise.Resolve(*EnumerateGPUInfo(gpu_info));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue