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, load GpuBlacklist, and compute the | 30 // This collects preliminary GPU info; it should only be called at |
31 // preliminary blacklisted features; it should only be called at browser | 31 // browser startup time in UI thread before the IO restriction is turned |
32 // startup time in UI thread before the IO restriction is turned on. | 32 // on. |
33 virtual void Initialize(const std::string& browser_version_string, | 33 virtual void InitializeGpuInfo() = 0; |
34 const std::string& gpu_blacklist_json) = 0; | |
35 | 34 |
36 virtual std::string GetBlacklistVersion() const = 0; | 35 // Can be called on any thread. |
37 | |
38 virtual GpuFeatureType GetBlacklistedFeatures() const = 0; | 36 virtual GpuFeatureType GetBlacklistedFeatures() const = 0; |
39 | 37 |
40 // Returns the reasons for the latest run of blacklisting decisions. | 38 // Sets the blacklisted feature flags due to preliminary GPU info. |
41 // For the structure of returned value, see documentation for | 39 virtual void SetPreliminaryBlacklistedFeatures( |
42 // GpuBlacklist::GetBlacklistedReasons(). | 40 GpuFeatureType feature_type) = 0; |
43 // Caller is responsible to release the returned value. | |
44 virtual base::ListValue* GetBlacklistReasons() const = 0; | |
45 | 41 |
46 virtual GPUInfo GetGPUInfo() const = 0; | 42 virtual GPUInfo GetGPUInfo() const = 0; |
47 | 43 |
48 // This indicator might change because we could collect more GPU info or | 44 // This indicator might change because we could collect more GPU info or |
49 // because the GPU blacklist could be updated. | 45 // because the GPU blacklist could be updated. |
50 // If this returns false, any further GPU access, including launching GPU | 46 // If this returns false, any further GPU access, including launching GPU |
51 // process, establish GPU channel, and GPU info collection, should be | 47 // process, establish GPU channel, and GPU info collection, should be |
52 // blocked. | 48 // blocked. |
53 // Can be called on any thread. | 49 // Can be called on any thread. |
54 virtual bool GpuAccessAllowed() const = 0; | 50 virtual bool GpuAccessAllowed() const = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
79 virtual void AddObserver(GpuDataManagerObserver* observer) = 0; | 75 virtual void AddObserver(GpuDataManagerObserver* observer) = 0; |
80 virtual void RemoveObserver(GpuDataManagerObserver* observer) = 0; | 76 virtual void RemoveObserver(GpuDataManagerObserver* observer) = 0; |
81 | 77 |
82 protected: | 78 protected: |
83 virtual ~GpuDataManager() {} | 79 virtual ~GpuDataManager() {} |
84 }; | 80 }; |
85 | 81 |
86 }; // namespace content | 82 }; // namespace content |
87 | 83 |
88 #endif // CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_ | 84 #endif // CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_ |
OLD | NEW |