chore: modernize ListValue usage in gpu info (#34663)
This commit is contained in:
parent
a4043237da
commit
07294cbf15
5 changed files with 71 additions and 76 deletions
|
@ -41,11 +41,11 @@ bool GPUInfoManager::NeedsCompleteGpuInfoCollection() const {
|
|||
|
||||
// Should be posted to the task runner
|
||||
void GPUInfoManager::ProcessCompleteInfo() {
|
||||
const auto result = EnumerateGPUInfo(gpu_data_manager_->GetGPUInfo());
|
||||
base::Value::Dict result = EnumerateGPUInfo(gpu_data_manager_->GetGPUInfo());
|
||||
// We have received the complete information, resolve all promises that
|
||||
// were waiting for this info.
|
||||
for (auto& promise : complete_info_promise_set_) {
|
||||
promise.Resolve(*result);
|
||||
promise.Resolve(base::Value(result.Clone()));
|
||||
}
|
||||
complete_info_promise_set_.clear();
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ void GPUInfoManager::OnGpuInfoUpdate() {
|
|||
|
||||
// Should be posted to the task runner
|
||||
void GPUInfoManager::CompleteInfoFetcher(
|
||||
gin_helper::Promise<base::DictionaryValue> promise) {
|
||||
gin_helper::Promise<base::Value> promise) {
|
||||
complete_info_promise_set_.emplace_back(std::move(promise));
|
||||
|
||||
if (NeedsCompleteGpuInfoCollection()) {
|
||||
|
@ -73,7 +73,7 @@ void GPUInfoManager::CompleteInfoFetcher(
|
|||
}
|
||||
|
||||
void GPUInfoManager::FetchCompleteInfo(
|
||||
gin_helper::Promise<base::DictionaryValue> promise) {
|
||||
gin_helper::Promise<base::Value> promise) {
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&GPUInfoManager::CompleteInfoFetcher,
|
||||
base::Unretained(this), std::move(promise)));
|
||||
|
@ -81,14 +81,13 @@ 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(
|
||||
gin_helper::Promise<base::DictionaryValue> promise) {
|
||||
void GPUInfoManager::FetchBasicInfo(gin_helper::Promise<base::Value> promise) {
|
||||
gpu::GPUInfo gpu_info;
|
||||
CollectBasicGraphicsInfo(&gpu_info);
|
||||
promise.Resolve(*EnumerateGPUInfo(gpu_info));
|
||||
promise.Resolve(base::Value(EnumerateGPUInfo(gpu_info)));
|
||||
}
|
||||
|
||||
std::unique_ptr<base::DictionaryValue> GPUInfoManager::EnumerateGPUInfo(
|
||||
base::Value::Dict GPUInfoManager::EnumerateGPUInfo(
|
||||
gpu::GPUInfo gpu_info) const {
|
||||
GPUInfoEnumerator enumerator;
|
||||
gpu_info.EnumerateFields(&enumerator);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue