Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(912)

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl_private.h

Issue 15385003: Move GPU device/driver info related code from content to gpu. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_PRIVATE_H_ 5 #ifndef CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_PRIVATE_H_
6 #define CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_PRIVATE_H_ 6 #define CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_PRIVATE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "base/observer_list_threadsafe.h" 15 #include "base/observer_list_threadsafe.h"
16 #include "content/browser/gpu/gpu_blacklist.h"
17 #include "content/browser/gpu/gpu_data_manager_impl.h" 16 #include "content/browser/gpu/gpu_data_manager_impl.h"
18 #include "content/browser/gpu/gpu_driver_bug_list.h" 17 #include "gpu/config/gpu_blacklist.h"
19 #include "content/browser/gpu/gpu_switching_list.h" 18 #include "gpu/config/gpu_driver_bug_list.h"
19 #include "gpu/config/gpu_switching_list.h"
20 20
21 namespace content { 21 namespace content {
22 22
23 class CONTENT_EXPORT GpuDataManagerImplPrivate { 23 class CONTENT_EXPORT GpuDataManagerImplPrivate {
24 public: 24 public:
25 static GpuDataManagerImplPrivate* Create(GpuDataManagerImpl* owner); 25 static GpuDataManagerImplPrivate* Create(GpuDataManagerImpl* owner);
26 26
27 void InitializeForTesting( 27 void InitializeForTesting(
28 const std::string& gpu_blacklist_json, 28 const std::string& gpu_blacklist_json,
29 const GPUInfo& gpu_info); 29 const gpu::GPUInfo& gpu_info);
30 bool IsFeatureBlacklisted(int feature) const; 30 bool IsFeatureBlacklisted(int feature) const;
31 GPUInfo GetGPUInfo() const; 31 gpu::GPUInfo GetGPUInfo() const;
32 void GetGpuProcessHandles( 32 void GetGpuProcessHandles(
33 const GpuDataManager::GetGpuProcessHandlesCallback& callback) const; 33 const GpuDataManager::GetGpuProcessHandlesCallback& callback) const;
34 bool GpuAccessAllowed(std::string* reason) const; 34 bool GpuAccessAllowed(std::string* reason) const;
35 void RequestCompleteGpuInfoIfNeeded(); 35 void RequestCompleteGpuInfoIfNeeded();
36 bool IsCompleteGpuInfoAvailable() const; 36 bool IsCompleteGpuInfoAvailable() const;
37 void RequestVideoMemoryUsageStatsUpdate() const; 37 void RequestVideoMemoryUsageStatsUpdate() const;
38 bool ShouldUseSwiftShader() const; 38 bool ShouldUseSwiftShader() const;
39 void RegisterSwiftShaderPath(const base::FilePath& path); 39 void RegisterSwiftShaderPath(const base::FilePath& path);
40 void AddObserver(GpuDataManagerObserver* observer); 40 void AddObserver(GpuDataManagerObserver* observer);
41 void RemoveObserver(GpuDataManagerObserver* observer); 41 void RemoveObserver(GpuDataManagerObserver* observer);
42 void UnblockDomainFrom3DAPIs(const GURL& url); 42 void UnblockDomainFrom3DAPIs(const GURL& url);
43 void DisableGpuWatchdog(); 43 void DisableGpuWatchdog();
44 void SetGLStrings(const std::string& gl_vendor, 44 void SetGLStrings(const std::string& gl_vendor,
45 const std::string& gl_renderer, 45 const std::string& gl_renderer,
46 const std::string& gl_version); 46 const std::string& gl_version);
47 void GetGLStrings(std::string* gl_vendor, 47 void GetGLStrings(std::string* gl_vendor,
48 std::string* gl_renderer, 48 std::string* gl_renderer,
49 std::string* gl_version); 49 std::string* gl_version);
50 void DisableHardwareAcceleration(); 50 void DisableHardwareAcceleration();
51 51
52 void Initialize(); 52 void Initialize();
53 53
54 void UpdateGpuInfo(const GPUInfo& gpu_info); 54 void UpdateGpuInfo(const gpu::GPUInfo& gpu_info);
55 55
56 void UpdateVideoMemoryUsageStats( 56 void UpdateVideoMemoryUsageStats(
57 const GPUVideoMemoryUsageStats& video_memory_usage_stats); 57 const GPUVideoMemoryUsageStats& video_memory_usage_stats);
58 58
59 void AppendRendererCommandLine(CommandLine* command_line) const; 59 void AppendRendererCommandLine(CommandLine* command_line) const;
60 60
61 void AppendGpuCommandLine(CommandLine* command_line) const; 61 void AppendGpuCommandLine(CommandLine* command_line) const;
62 62
63 void AppendPluginCommandLine(CommandLine* command_line) const; 63 void AppendPluginCommandLine(CommandLine* command_line) const;
64 64
65 void UpdateRendererWebPrefs(WebPreferences* prefs) const; 65 void UpdateRendererWebPrefs(WebPreferences* prefs) const;
66 66
67 GpuSwitchingOption GetGpuSwitchingOption() const; 67 gpu::GpuSwitchingOption GetGpuSwitchingOption() const;
68 68
69 std::string GetBlacklistVersion() const; 69 std::string GetBlacklistVersion() const;
70 70
71 base::ListValue* GetBlacklistReasons() const; 71 base::ListValue* GetBlacklistReasons() const;
72 72
73 void AddLogMessage(int level, 73 void AddLogMessage(int level,
74 const std::string& header, 74 const std::string& header,
75 const std::string& message); 75 const std::string& message);
76 76
77 void ProcessCrashed(base::TerminationStatus exit_code); 77 void ProcessCrashed(base::TerminationStatus exit_code);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 typedef std::map<std::string, DomainBlockEntry> DomainBlockMap; 153 typedef std::map<std::string, DomainBlockEntry> DomainBlockMap;
154 154
155 typedef ObserverListThreadSafe<GpuDataManagerObserver> 155 typedef ObserverListThreadSafe<GpuDataManagerObserver>
156 GpuDataManagerObserverList; 156 GpuDataManagerObserverList;
157 157
158 explicit GpuDataManagerImplPrivate(GpuDataManagerImpl* owner); 158 explicit GpuDataManagerImplPrivate(GpuDataManagerImpl* owner);
159 159
160 void InitializeImpl(const std::string& gpu_blacklist_json, 160 void InitializeImpl(const std::string& gpu_blacklist_json,
161 const std::string& gpu_switching_list_json, 161 const std::string& gpu_switching_list_json,
162 const std::string& gpu_driver_bug_list_json, 162 const std::string& gpu_driver_bug_list_json,
163 const GPUInfo& gpu_info); 163 const gpu::GPUInfo& gpu_info);
164 164
165 void UpdateBlacklistedFeatures(const std::set<int>& features); 165 void UpdateBlacklistedFeatures(const std::set<int>& features);
166 166
167 // This should only be called once at initialization time, when preliminary 167 // This should only be called once at initialization time, when preliminary
168 // gpu info is collected. 168 // gpu info is collected.
169 void UpdatePreliminaryBlacklistedFeatures(); 169 void UpdatePreliminaryBlacklistedFeatures();
170 170
171 // Update the GPU switching status. 171 // Update the GPU switching status.
172 // This should only be called once at initialization time. 172 // This should only be called once at initialization time.
173 void UpdateGpuSwitchingManager(const GPUInfo& gpu_info); 173 void UpdateGpuSwitchingManager(const gpu::GPUInfo& gpu_info);
174 174
175 // Notify all observers whenever there is a GPU info update. 175 // Notify all observers whenever there is a GPU info update.
176 void NotifyGpuInfoUpdate(); 176 void NotifyGpuInfoUpdate();
177 177
178 // Try to switch to SwiftShader rendering, if possible and necessary. 178 // Try to switch to SwiftShader rendering, if possible and necessary.
179 void EnableSwiftShaderIfNecessary(); 179 void EnableSwiftShaderIfNecessary();
180 180
181 // Helper to extract the domain from a given URL. 181 // Helper to extract the domain from a given URL.
182 std::string GetDomainFromURL(const GURL& url) const; 182 std::string GetDomainFromURL(const GURL& url) const;
183 183
184 // Implementation functions for blocking of 3D graphics APIs, used 184 // Implementation functions for blocking of 3D graphics APIs, used
185 // for unit testing. 185 // for unit testing.
186 void BlockDomainFrom3DAPIsAtTime(const GURL& url, 186 void BlockDomainFrom3DAPIsAtTime(const GURL& url,
187 GpuDataManagerImpl::DomainGuilt guilt, 187 GpuDataManagerImpl::DomainGuilt guilt,
188 base::Time at_time); 188 base::Time at_time);
189 GpuDataManagerImpl::DomainBlockStatus Are3DAPIsBlockedAtTime( 189 GpuDataManagerImpl::DomainBlockStatus Are3DAPIsBlockedAtTime(
190 const GURL& url, base::Time at_time) const; 190 const GURL& url, base::Time at_time) const;
191 int64 GetBlockAllDomainsDurationInMs() const; 191 int64 GetBlockAllDomainsDurationInMs() const;
192 192
193 bool complete_gpu_info_already_requested_; 193 bool complete_gpu_info_already_requested_;
194 194
195 std::set<int> blacklisted_features_; 195 std::set<int> blacklisted_features_;
196 std::set<int> preliminary_blacklisted_features_; 196 std::set<int> preliminary_blacklisted_features_;
197 197
198 GpuSwitchingOption gpu_switching_; 198 gpu::GpuSwitchingOption gpu_switching_;
199 199
200 std::set<int> gpu_driver_bugs_; 200 std::set<int> gpu_driver_bugs_;
201 201
202 GPUInfo gpu_info_; 202 gpu::GPUInfo gpu_info_;
203 203
204 scoped_ptr<GpuBlacklist> gpu_blacklist_; 204 scoped_ptr<gpu::GpuBlacklist> gpu_blacklist_;
205 scoped_ptr<GpuSwitchingList> gpu_switching_list_; 205 scoped_ptr<gpu::GpuSwitchingList> gpu_switching_list_;
206 scoped_ptr<GpuDriverBugList> gpu_driver_bug_list_; 206 scoped_ptr<gpu::GpuDriverBugList> gpu_driver_bug_list_;
207 207
208 const scoped_refptr<GpuDataManagerObserverList> observer_list_; 208 const scoped_refptr<GpuDataManagerObserverList> observer_list_;
209 209
210 ListValue log_messages_; 210 ListValue log_messages_;
211 211
212 bool use_swiftshader_; 212 bool use_swiftshader_;
213 213
214 base::FilePath swiftshader_path_; 214 base::FilePath swiftshader_path_;
215 215
216 // Current card force-blacklisted due to GPU crashes, or disabled through 216 // Current card force-blacklisted due to GPU crashes, or disabled through
(...skipping 13 matching lines...) Expand all
230 230
231 GpuDataManagerImpl* owner_; 231 GpuDataManagerImpl* owner_;
232 232
233 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImplPrivate); 233 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImplPrivate);
234 }; 234 };
235 235
236 } // namespace content 236 } // namespace content
237 237
238 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_PRIVATE_H_ 238 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_PRIVATE_H_
239 239
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl.cc ('k') | content/browser/gpu/gpu_data_manager_impl_private.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698