feat: Implementation of getGPUInfo API. (#13486)
* Implementation of getGPUInfo API. * Clear promise set * Changes to promise usage * Minor fixes * Fix linux build * Update spec * Fix lint (linter didn't run on windows locally) * Test running single test for CI * Update spec
This commit is contained in:
parent
638311b6b3
commit
5c108728d6
13 changed files with 529 additions and 127 deletions
49
atom/browser/api/gpuinfo_manager.h
Normal file
49
atom/browser/api/gpuinfo_manager.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
// Copyright (c) 2018 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_BROWSER_API_GPUINFO_MANAGER_H_
|
||||
#define ATOM_BROWSER_API_GPUINFO_MANAGER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "atom/common/native_mate_converters/value_converter.h"
|
||||
#include "atom/common/promise_util.h"
|
||||
#include "content/browser/gpu/gpu_data_manager_impl.h"
|
||||
#include "content/public/browser/gpu_data_manager.h"
|
||||
#include "content/public/browser/gpu_data_manager_observer.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
// GPUInfoManager is a singleton used to manage and fetch GPUInfo
|
||||
class GPUInfoManager : public content::GpuDataManagerObserver {
|
||||
public:
|
||||
static GPUInfoManager* GetInstance();
|
||||
|
||||
GPUInfoManager();
|
||||
~GPUInfoManager() override;
|
||||
bool NeedsCompleteGpuInfoCollection();
|
||||
void FetchCompleteInfo(scoped_refptr<util::Promise> promise);
|
||||
void FetchBasicInfo(scoped_refptr<util::Promise> promise);
|
||||
void OnGpuInfoUpdate() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<base::DictionaryValue> EnumerateGPUInfo(
|
||||
gpu::GPUInfo gpu_info) const;
|
||||
|
||||
// These should be posted to the task queue
|
||||
void CompleteInfoFetcher(scoped_refptr<util::Promise> promise);
|
||||
void ProcessCompleteInfo();
|
||||
|
||||
// This set maintains all the promises that should be fulfilled
|
||||
// once we have the complete information data
|
||||
std::vector<scoped_refptr<util::Promise>> complete_info_promise_set_;
|
||||
content::GpuDataManager* gpu_data_manager_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(GPUInfoManager);
|
||||
};
|
||||
|
||||
} // namespace atom
|
||||
#endif // ATOM_BROWSER_API_GPUINFO_MANAGER_H_
|
Loading…
Add table
Add a link
Reference in a new issue