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/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/singleton.h" | 18 #include "base/memory/singleton.h" |
19 #include "base/process/kill.h" | 19 #include "base/process/kill.h" |
20 #include "base/synchronization/lock.h" | 20 #include "base/synchronization/lock.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "base/values.h" | 22 #include "base/values.h" |
23 #include "content/public/browser/gpu_data_manager.h" | 23 #include "content/public/browser/gpu_data_manager.h" |
24 #include "content/public/common/three_d_api_types.h" | 24 #include "content/public/common/three_d_api_types.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 { |
34 struct GpuPreferences; | 35 struct GpuPreferences; |
(...skipping 26 matching lines...) Expand all Loading... |
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 InitializeForTesting(const std::string& gpu_blacklist_json, |
69 const gpu::GPUInfo& gpu_info) override; | 70 const gpu::GPUInfo& gpu_info) override; |
70 bool IsFeatureBlacklisted(int feature) const override; | 71 bool IsFeatureBlacklisted(int feature) const override; |
| 72 bool IsFeatureEnabled(int feature) const override; |
71 gpu::GPUInfo GetGPUInfo() const override; | 73 gpu::GPUInfo GetGPUInfo() const override; |
72 void GetGpuProcessHandles( | 74 void GetGpuProcessHandles( |
73 const GetGpuProcessHandlesCallback& callback) const override; | 75 const GetGpuProcessHandlesCallback& callback) const override; |
74 bool GpuAccessAllowed(std::string* reason) const override; | 76 bool GpuAccessAllowed(std::string* reason) const override; |
75 void RequestCompleteGpuInfoIfNeeded() override; | 77 void RequestCompleteGpuInfoIfNeeded() override; |
76 bool IsEssentialGpuInfoAvailable() const override; | 78 bool IsEssentialGpuInfoAvailable() const override; |
77 bool IsCompleteGpuInfoAvailable() const override; | 79 bool IsCompleteGpuInfoAvailable() const override; |
78 void RequestVideoMemoryUsageStatsUpdate() const override; | 80 void RequestVideoMemoryUsageStatsUpdate() const override; |
79 bool ShouldUseSwiftShader() const override; | 81 bool ShouldUseSwiftShader() const override; |
80 void RegisterSwiftShaderPath(const base::FilePath& path) override; | 82 void RegisterSwiftShaderPath(const base::FilePath& path) override; |
(...skipping 18 matching lines...) Expand all Loading... |
99 | 101 |
100 // This collects preliminary GPU info, load GpuBlacklist, and compute the | 102 // This collects preliminary GPU info, load GpuBlacklist, and compute the |
101 // preliminary blacklisted features; it should only be called at browser | 103 // preliminary blacklisted features; it should only be called at browser |
102 // 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. |
103 void Initialize(); | 105 void Initialize(); |
104 | 106 |
105 // Only update if the current GPUInfo is not finalized. If blacklist is | 107 // Only update if the current GPUInfo is not finalized. If blacklist is |
106 // loaded, run through blacklist and update blacklisted features. | 108 // loaded, run through blacklist and update blacklisted features. |
107 void UpdateGpuInfo(const gpu::GPUInfo& gpu_info); | 109 void UpdateGpuInfo(const gpu::GPUInfo& gpu_info); |
108 | 110 |
| 111 // 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. |
| 113 void UpdateGpuFeatureInfo(const gpu::GpuFeatureInfo& gpu_feature_info); |
| 114 |
109 void UpdateVideoMemoryUsageStats( | 115 void UpdateVideoMemoryUsageStats( |
110 const gpu::VideoMemoryUsageStats& video_memory_usage_stats); | 116 const gpu::VideoMemoryUsageStats& video_memory_usage_stats); |
111 | 117 |
112 // Insert disable-feature switches corresponding to preliminary gpu feature | 118 // Insert disable-feature switches corresponding to preliminary gpu feature |
113 // flags into the renderer process command line. | 119 // flags into the renderer process command line. |
114 void AppendRendererCommandLine(base::CommandLine* command_line) const; | 120 void AppendRendererCommandLine(base::CommandLine* command_line) const; |
115 | 121 |
116 // Insert switches into gpu process command line: kUseGL, etc. | 122 // Insert switches into gpu process command line: kUseGL, etc. |
117 // If the gpu_preferences isn't a nullptr, the gpu_preferences will be set | 123 // If the gpu_preferences isn't a nullptr, the gpu_preferences will be set |
118 // for some GPU switches which have been replaced by GpuPreferences, and those | 124 // for some GPU switches which have been replaced by GpuPreferences, and those |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 225 |
220 mutable base::Lock lock_; | 226 mutable base::Lock lock_; |
221 std::unique_ptr<GpuDataManagerImplPrivate> private_; | 227 std::unique_ptr<GpuDataManagerImplPrivate> private_; |
222 | 228 |
223 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); | 229 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); |
224 }; | 230 }; |
225 | 231 |
226 } // namespace content | 232 } // namespace content |
227 | 233 |
228 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ | 234 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ |
OLD | NEW |