OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "content/public/common/gpu_feature_type.h" | 11 #include "content/public/common/gpu_feature_type.h" |
12 | 12 |
13 class FilePath; | 13 class FilePath; |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class ListValue; | 16 class ListValue; |
17 } | 17 } |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 class GpuDataManagerObserver; | 21 class GpuDataManagerObserver; |
22 struct GPUInfo; | 22 struct GPUInfo; |
23 | 23 |
24 // This class is fully thread-safe. | 24 // This class is fully thread-safe. |
25 class GpuDataManager { | 25 class GpuDataManager { |
26 public: | 26 public: |
27 // Getter for the singleton. | 27 // Getter for the singleton. |
28 CONTENT_EXPORT static GpuDataManager* GetInstance(); | 28 CONTENT_EXPORT static GpuDataManager* GetInstance(); |
29 | 29 |
30 // This collects preliminary GPU info; it should only be called at | 30 // This collects preliminary GPU info, load GpuBlacklist, and compute the |
31 // browser startup time in UI thread before the IO restriction is turned | 31 // preliminary blacklisted features; it should only be called at browser |
32 // on. | 32 // startup time in UI thread before the IO restriction is turned on. |
33 virtual void InitializeGpuInfo() = 0; | 33 virtual void Initialize(const std::string& browser_version_string, |
| 34 const std::string& gpu_blacklist_json) = 0; |
34 | 35 |
35 // Can be called on any thread. | 36 virtual std::string GetBlacklistVersion() const = 0; |
| 37 |
36 virtual GpuFeatureType GetBlacklistedFeatures() const = 0; | 38 virtual GpuFeatureType GetBlacklistedFeatures() const = 0; |
37 | 39 |
38 // Sets the blacklisted feature flags due to preliminary GPU info. | 40 // Returns the reasons for the latest run of blacklisting decisions. |
39 virtual void SetPreliminaryBlacklistedFeatures( | 41 // For the structure of returned value, see documentation for |
40 GpuFeatureType feature_type) = 0; | 42 // GpuBlacklist::GetBlacklistedReasons(). |
| 43 // Caller is responsible to release the returned value. |
| 44 virtual base::ListValue* GetBlacklistReasons() const = 0; |
41 | 45 |
42 virtual GPUInfo GetGPUInfo() const = 0; | 46 virtual GPUInfo GetGPUInfo() const = 0; |
43 | 47 |
44 // This indicator might change because we could collect more GPU info or | 48 // This indicator might change because we could collect more GPU info or |
45 // because the GPU blacklist could be updated. | 49 // because the GPU blacklist could be updated. |
46 // If this returns false, any further GPU access, including launching GPU | 50 // If this returns false, any further GPU access, including launching GPU |
47 // process, establish GPU channel, and GPU info collection, should be | 51 // process, establish GPU channel, and GPU info collection, should be |
48 // blocked. | 52 // blocked. |
49 // Can be called on any thread. | 53 // Can be called on any thread. |
50 virtual bool GpuAccessAllowed() const = 0; | 54 virtual bool GpuAccessAllowed() const = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
75 virtual void AddObserver(GpuDataManagerObserver* observer) = 0; | 79 virtual void AddObserver(GpuDataManagerObserver* observer) = 0; |
76 virtual void RemoveObserver(GpuDataManagerObserver* observer) = 0; | 80 virtual void RemoveObserver(GpuDataManagerObserver* observer) = 0; |
77 | 81 |
78 protected: | 82 protected: |
79 virtual ~GpuDataManager() {} | 83 virtual ~GpuDataManager() {} |
80 }; | 84 }; |
81 | 85 |
82 }; // namespace content | 86 }; // namespace content |
83 | 87 |
84 #endif // CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_ | 88 #endif // CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_ |
OLD | NEW |