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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" |
16 #include "base/process_util.h" | 16 #include "base/process_util.h" |
17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
18 #include "base/time.h" | 18 #include "base/time.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "content/public/browser/gpu_data_manager.h" | 20 #include "content/public/browser/gpu_data_manager.h" |
21 #include "content/public/common/gpu_info.h" | |
22 #include "content/public/common/gpu_memory_stats.h" | 21 #include "content/public/common/gpu_memory_stats.h" |
23 #include "content/public/common/gpu_switching_option.h" | |
24 #include "content/public/common/three_d_api_types.h" | 22 #include "content/public/common/three_d_api_types.h" |
| 23 #include "gpu/config/gpu_info.h" |
| 24 #include "gpu/config/gpu_switching_option.h" |
25 | 25 |
26 class CommandLine; | 26 class CommandLine; |
27 class GURL; | 27 class GURL; |
28 struct WebPreferences; | 28 struct WebPreferences; |
29 | 29 |
30 namespace content { | 30 namespace content { |
31 | 31 |
32 class GpuDataManagerImplPrivate; | 32 class GpuDataManagerImplPrivate; |
33 | 33 |
34 class CONTENT_EXPORT GpuDataManagerImpl | 34 class CONTENT_EXPORT GpuDataManagerImpl |
(...skipping 16 matching lines...) Expand all Loading... |
51 DOMAIN_BLOCK_STATUS_ALL_DOMAINS_BLOCKED, | 51 DOMAIN_BLOCK_STATUS_ALL_DOMAINS_BLOCKED, |
52 DOMAIN_BLOCK_STATUS_NOT_BLOCKED | 52 DOMAIN_BLOCK_STATUS_NOT_BLOCKED |
53 }; | 53 }; |
54 | 54 |
55 // Getter for the singleton. This will return NULL on failure. | 55 // Getter for the singleton. This will return NULL on failure. |
56 static GpuDataManagerImpl* GetInstance(); | 56 static GpuDataManagerImpl* GetInstance(); |
57 | 57 |
58 // GpuDataManager implementation. | 58 // GpuDataManager implementation. |
59 virtual void InitializeForTesting( | 59 virtual void InitializeForTesting( |
60 const std::string& gpu_blacklist_json, | 60 const std::string& gpu_blacklist_json, |
61 const GPUInfo& gpu_info) OVERRIDE; | 61 const gpu::GPUInfo& gpu_info) OVERRIDE; |
62 virtual bool IsFeatureBlacklisted(int feature) const OVERRIDE; | 62 virtual bool IsFeatureBlacklisted(int feature) const OVERRIDE; |
63 virtual GPUInfo GetGPUInfo() const OVERRIDE; | 63 virtual gpu::GPUInfo GetGPUInfo() const OVERRIDE; |
64 virtual void GetGpuProcessHandles( | 64 virtual void GetGpuProcessHandles( |
65 const GetGpuProcessHandlesCallback& callback) const OVERRIDE; | 65 const GetGpuProcessHandlesCallback& callback) const OVERRIDE; |
66 virtual bool GpuAccessAllowed(std::string* reason) const OVERRIDE; | 66 virtual bool GpuAccessAllowed(std::string* reason) const OVERRIDE; |
67 virtual void RequestCompleteGpuInfoIfNeeded() OVERRIDE; | 67 virtual void RequestCompleteGpuInfoIfNeeded() OVERRIDE; |
68 virtual bool IsCompleteGpuInfoAvailable() const OVERRIDE; | 68 virtual bool IsCompleteGpuInfoAvailable() const OVERRIDE; |
69 virtual void RequestVideoMemoryUsageStatsUpdate() const OVERRIDE; | 69 virtual void RequestVideoMemoryUsageStatsUpdate() const OVERRIDE; |
70 virtual bool ShouldUseSwiftShader() const OVERRIDE; | 70 virtual bool ShouldUseSwiftShader() const OVERRIDE; |
71 virtual void RegisterSwiftShaderPath(const base::FilePath& path) OVERRIDE; | 71 virtual void RegisterSwiftShaderPath(const base::FilePath& path) OVERRIDE; |
72 virtual void AddObserver(GpuDataManagerObserver* observer) OVERRIDE; | 72 virtual void AddObserver(GpuDataManagerObserver* observer) OVERRIDE; |
73 virtual void RemoveObserver(GpuDataManagerObserver* observer) OVERRIDE; | 73 virtual void RemoveObserver(GpuDataManagerObserver* observer) OVERRIDE; |
74 virtual void UnblockDomainFrom3DAPIs(const GURL& url) OVERRIDE; | 74 virtual void UnblockDomainFrom3DAPIs(const GURL& url) OVERRIDE; |
75 virtual void DisableGpuWatchdog() OVERRIDE; | 75 virtual void DisableGpuWatchdog() OVERRIDE; |
76 virtual void SetGLStrings(const std::string& gl_vendor, | 76 virtual void SetGLStrings(const std::string& gl_vendor, |
77 const std::string& gl_renderer, | 77 const std::string& gl_renderer, |
78 const std::string& gl_version) OVERRIDE; | 78 const std::string& gl_version) OVERRIDE; |
79 virtual void GetGLStrings(std::string* gl_vendor, | 79 virtual void GetGLStrings(std::string* gl_vendor, |
80 std::string* gl_renderer, | 80 std::string* gl_renderer, |
81 std::string* gl_version) OVERRIDE; | 81 std::string* gl_version) OVERRIDE; |
82 virtual void DisableHardwareAcceleration() OVERRIDE; | 82 virtual void DisableHardwareAcceleration() OVERRIDE; |
83 | 83 |
84 // This collects preliminary GPU info, load GpuBlacklist, and compute the | 84 // This collects preliminary GPU info, load GpuBlacklist, and compute the |
85 // preliminary blacklisted features; it should only be called at browser | 85 // preliminary blacklisted features; it should only be called at browser |
86 // startup time in UI thread before the IO restriction is turned on. | 86 // startup time in UI thread before the IO restriction is turned on. |
87 void Initialize(); | 87 void Initialize(); |
88 | 88 |
89 // Only update if the current GPUInfo is not finalized. If blacklist is | 89 // Only update if the current GPUInfo is not finalized. If blacklist is |
90 // loaded, run through blacklist and update blacklisted features. | 90 // loaded, run through blacklist and update blacklisted features. |
91 void UpdateGpuInfo(const GPUInfo& gpu_info); | 91 void UpdateGpuInfo(const gpu::GPUInfo& gpu_info); |
92 | 92 |
93 void UpdateVideoMemoryUsageStats( | 93 void UpdateVideoMemoryUsageStats( |
94 const GPUVideoMemoryUsageStats& video_memory_usage_stats); | 94 const GPUVideoMemoryUsageStats& video_memory_usage_stats); |
95 | 95 |
96 // Insert disable-feature switches corresponding to preliminary gpu feature | 96 // Insert disable-feature switches corresponding to preliminary gpu feature |
97 // flags into the renderer process command line. | 97 // flags into the renderer process command line. |
98 void AppendRendererCommandLine(CommandLine* command_line) const; | 98 void AppendRendererCommandLine(CommandLine* command_line) const; |
99 | 99 |
100 // Insert switches into gpu process command line: kUseGL, | 100 // Insert switches into gpu process command line: kUseGL, |
101 // kDisableGLMultisampling. | 101 // kDisableGLMultisampling. |
102 void AppendGpuCommandLine(CommandLine* command_line) const; | 102 void AppendGpuCommandLine(CommandLine* command_line) const; |
103 | 103 |
104 // Insert switches into plugin process command line: | 104 // Insert switches into plugin process command line: |
105 // kDisableCoreAnimationPlugins. | 105 // kDisableCoreAnimationPlugins. |
106 void AppendPluginCommandLine(CommandLine* command_line) const; | 106 void AppendPluginCommandLine(CommandLine* command_line) const; |
107 | 107 |
108 // Update WebPreferences for renderer based on blacklisting decisions. | 108 // Update WebPreferences for renderer based on blacklisting decisions. |
109 void UpdateRendererWebPrefs(WebPreferences* prefs) const; | 109 void UpdateRendererWebPrefs(WebPreferences* prefs) const; |
110 | 110 |
111 GpuSwitchingOption GetGpuSwitchingOption() const; | 111 gpu::GpuSwitchingOption GetGpuSwitchingOption() const; |
112 | 112 |
113 std::string GetBlacklistVersion() const; | 113 std::string GetBlacklistVersion() const; |
114 | 114 |
115 // Returns the reasons for the latest run of blacklisting decisions. | 115 // Returns the reasons for the latest run of blacklisting decisions. |
116 // For the structure of returned value, see documentation for | 116 // For the structure of returned value, see documentation for |
117 // GpuBlacklist::GetBlacklistedReasons(). | 117 // GpuBlacklist::GetBlacklistedReasons(). |
118 // Caller is responsible to release the returned value. | 118 // Caller is responsible to release the returned value. |
119 base::ListValue* GetBlacklistReasons() const; | 119 base::ListValue* GetBlacklistReasons() const; |
120 | 120 |
121 void AddLogMessage(int level, | 121 void AddLogMessage(int level, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 mutable base::Lock lock_; | 200 mutable base::Lock lock_; |
201 scoped_ptr<GpuDataManagerImplPrivate> private_; | 201 scoped_ptr<GpuDataManagerImplPrivate> private_; |
202 | 202 |
203 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); | 203 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); |
204 }; | 204 }; |
205 | 205 |
206 } // namespace content | 206 } // namespace content |
207 | 207 |
208 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ | 208 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ |
OLD | NEW |