OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ |
6 #define CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ | 6 #define CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
18 #include "base/process/kill.h" | 18 #include "base/process/kill.h" |
19 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
21 #include "base/values.h" | 21 #include "base/values.h" |
22 #include "content/public/browser/gpu_data_manager.h" | 22 #include "content/public/browser/gpu_data_manager.h" |
23 #include "content/public/common/three_d_api_types.h" | 23 #include "content/public/common/three_d_api_types.h" |
| 24 #include "gpu/config/gpu_control_list.h" |
24 #include "gpu/config/gpu_feature_info.h" | 25 #include "gpu/config/gpu_feature_info.h" |
25 #include "gpu/config/gpu_info.h" | 26 #include "gpu/config/gpu_info.h" |
26 | 27 |
27 class GURL; | 28 class GURL; |
28 | 29 |
29 namespace base { | 30 namespace base { |
30 class CommandLine; | 31 class CommandLine; |
31 } | 32 } |
32 | 33 |
33 namespace gpu { | 34 namespace gpu { |
(...skipping 24 matching lines...) Expand all Loading... |
58 enum DomainBlockStatus { | 59 enum DomainBlockStatus { |
59 DOMAIN_BLOCK_STATUS_BLOCKED, | 60 DOMAIN_BLOCK_STATUS_BLOCKED, |
60 DOMAIN_BLOCK_STATUS_ALL_DOMAINS_BLOCKED, | 61 DOMAIN_BLOCK_STATUS_ALL_DOMAINS_BLOCKED, |
61 DOMAIN_BLOCK_STATUS_NOT_BLOCKED | 62 DOMAIN_BLOCK_STATUS_NOT_BLOCKED |
62 }; | 63 }; |
63 | 64 |
64 // Getter for the singleton. This will return NULL on failure. | 65 // Getter for the singleton. This will return NULL on failure. |
65 static GpuDataManagerImpl* GetInstance(); | 66 static GpuDataManagerImpl* GetInstance(); |
66 | 67 |
67 // GpuDataManager implementation. | 68 // GpuDataManager implementation. |
68 void InitializeForTesting(const std::string& gpu_blacklist_json, | 69 void BlacklistWebGLForTesting() override; |
69 const gpu::GPUInfo& gpu_info) override; | |
70 bool IsFeatureBlacklisted(int feature) const override; | 70 bool IsFeatureBlacklisted(int feature) const override; |
71 bool IsFeatureEnabled(int feature) const override; | 71 bool IsFeatureEnabled(int feature) const override; |
72 bool IsWebGLEnabled() const override; | 72 bool IsWebGLEnabled() const override; |
73 gpu::GPUInfo GetGPUInfo() const override; | 73 gpu::GPUInfo GetGPUInfo() const override; |
74 void GetGpuProcessHandles( | 74 void GetGpuProcessHandles( |
75 const GetGpuProcessHandlesCallback& callback) const override; | 75 const GetGpuProcessHandlesCallback& callback) const override; |
76 bool GpuAccessAllowed(std::string* reason) const override; | 76 bool GpuAccessAllowed(std::string* reason) const override; |
77 void RequestCompleteGpuInfoIfNeeded() override; | 77 void RequestCompleteGpuInfoIfNeeded() override; |
78 bool IsEssentialGpuInfoAvailable() const override; | 78 bool IsEssentialGpuInfoAvailable() const override; |
79 bool IsCompleteGpuInfoAvailable() const override; | 79 bool IsCompleteGpuInfoAvailable() const override; |
(...skipping 17 matching lines...) Expand all Loading... |
97 bool HardwareAccelerationEnabled() const override; | 97 bool HardwareAccelerationEnabled() const override; |
98 bool CanUseGpuBrowserCompositor() const override; | 98 bool CanUseGpuBrowserCompositor() const override; |
99 void GetDisabledExtensions(std::string* disabled_extensions) const override; | 99 void GetDisabledExtensions(std::string* disabled_extensions) const override; |
100 void SetGpuInfo(const gpu::GPUInfo& gpu_info) override; | 100 void SetGpuInfo(const gpu::GPUInfo& gpu_info) override; |
101 | 101 |
102 // This collects preliminary GPU info, load GpuBlacklist, and compute the | 102 // This collects preliminary GPU info, load GpuBlacklist, and compute the |
103 // preliminary blacklisted features; it should only be called at browser | 103 // preliminary blacklisted features; it should only be called at browser |
104 // startup time in UI thread before the IO restriction is turned on. | 104 // startup time in UI thread before the IO restriction is turned on. |
105 void Initialize(); | 105 void Initialize(); |
106 | 106 |
| 107 void InitializeForTesting(const gpu::GpuControlListData& gpu_blacklist_data, |
| 108 const gpu::GPUInfo& gpu_info); |
| 109 |
107 // Only update if the current GPUInfo is not finalized. If blacklist is | 110 // Only update if the current GPUInfo is not finalized. If blacklist is |
108 // loaded, run through blacklist and update blacklisted features. | 111 // loaded, run through blacklist and update blacklisted features. |
109 void UpdateGpuInfo(const gpu::GPUInfo& gpu_info); | 112 void UpdateGpuInfo(const gpu::GPUInfo& gpu_info); |
110 | 113 |
111 // Update the GPU feature info. This updates the blacklist and enabled status | 114 // Update the GPU feature info. This updates the blacklist and enabled status |
112 // of GPU rasterization. In the future this will be used for more features. | 115 // of GPU rasterization. In the future this will be used for more features. |
113 void UpdateGpuFeatureInfo(const gpu::GpuFeatureInfo& gpu_feature_info); | 116 void UpdateGpuFeatureInfo(const gpu::GpuFeatureInfo& gpu_feature_info); |
114 | 117 |
115 void UpdateVideoMemoryUsageStats( | 118 void UpdateVideoMemoryUsageStats( |
116 const gpu::VideoMemoryUsageStats& video_memory_usage_stats); | 119 const gpu::VideoMemoryUsageStats& video_memory_usage_stats); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 228 |
226 mutable base::Lock lock_; | 229 mutable base::Lock lock_; |
227 std::unique_ptr<GpuDataManagerImplPrivate> private_; | 230 std::unique_ptr<GpuDataManagerImplPrivate> private_; |
228 | 231 |
229 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); | 232 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); |
230 }; | 233 }; |
231 | 234 |
232 } // namespace content | 235 } // namespace content |
233 | 236 |
234 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ | 237 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ |
OLD | NEW |