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

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

Issue 13983014: [CLOSED] Cleaning up the plethora of switches for GPU vs software vs SwiftShader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
« no previous file with comments | « content/browser/gpu/compositor_util.cc ('k') | content/browser/gpu/gpu_data_manager_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_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 <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const std::string& gpu_blacklist_json, 69 const std::string& gpu_blacklist_json,
70 const GPUInfo& gpu_info) OVERRIDE; 70 const GPUInfo& gpu_info) OVERRIDE;
71 virtual bool IsFeatureBlacklisted(int feature) const OVERRIDE; 71 virtual bool IsFeatureBlacklisted(int feature) const OVERRIDE;
72 virtual GPUInfo GetGPUInfo() const OVERRIDE; 72 virtual GPUInfo GetGPUInfo() const OVERRIDE;
73 virtual void GetGpuProcessHandles( 73 virtual void GetGpuProcessHandles(
74 const GetGpuProcessHandlesCallback& callback) const OVERRIDE; 74 const GetGpuProcessHandlesCallback& callback) const OVERRIDE;
75 virtual bool GpuAccessAllowed() const OVERRIDE; 75 virtual bool GpuAccessAllowed() const OVERRIDE;
76 virtual void RequestCompleteGpuInfoIfNeeded() OVERRIDE; 76 virtual void RequestCompleteGpuInfoIfNeeded() OVERRIDE;
77 virtual bool IsCompleteGpuInfoAvailable() const OVERRIDE; 77 virtual bool IsCompleteGpuInfoAvailable() const OVERRIDE;
78 virtual void RequestVideoMemoryUsageStatsUpdate() const OVERRIDE; 78 virtual void RequestVideoMemoryUsageStatsUpdate() const OVERRIDE;
79 virtual bool ShouldUseSoftwareRendering() const OVERRIDE; 79 virtual bool ShouldUseSwiftShader() const OVERRIDE;
80 virtual void RegisterSwiftShaderPath(const base::FilePath& path) OVERRIDE; 80 virtual void RegisterSwiftShaderPath(const base::FilePath& path) OVERRIDE;
81 virtual void AddObserver(GpuDataManagerObserver* observer) OVERRIDE; 81 virtual void AddObserver(GpuDataManagerObserver* observer) OVERRIDE;
82 virtual void RemoveObserver(GpuDataManagerObserver* observer) OVERRIDE; 82 virtual void RemoveObserver(GpuDataManagerObserver* observer) OVERRIDE;
83 virtual void UnblockDomainFrom3DAPIs(const GURL& url) OVERRIDE; 83 virtual void UnblockDomainFrom3DAPIs(const GURL& url) OVERRIDE;
84 virtual void DisableGpuWatchdog() OVERRIDE; 84 virtual void DisableGpuWatchdog() OVERRIDE;
85 virtual void SetGLStrings(const std::string& gl_vendor, 85 virtual void SetGLStrings(const std::string& gl_vendor,
86 const std::string& gl_renderer, 86 const std::string& gl_renderer,
87 const std::string& gl_version) OVERRIDE; 87 const std::string& gl_version) OVERRIDE;
88 virtual void GetGLStrings(std::string* gl_vendor, 88 virtual void GetGLStrings(std::string* gl_vendor,
89 std::string* gl_renderer, 89 std::string* gl_renderer,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 typedef ObserverListThreadSafe<GpuDataManagerObserver> 185 typedef ObserverListThreadSafe<GpuDataManagerObserver>
186 GpuDataManagerObserverList; 186 GpuDataManagerObserverList;
187 187
188 friend class GpuDataManagerImplTest; 188 friend class GpuDataManagerImplTest;
189 friend struct DefaultSingletonTraits<GpuDataManagerImpl>; 189 friend struct DefaultSingletonTraits<GpuDataManagerImpl>;
190 190
191 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuSideBlacklisting); 191 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuSideBlacklisting);
192 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuSideExceptions); 192 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuSideExceptions);
193 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, 193 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest,
194 DisableHardwareAcceleration); 194 DisableHardwareAcceleration);
195 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, SoftwareRendering); 195 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, SwiftShaderRendering);
196 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, SoftwareRendering2); 196 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, SwiftShaderRendering2);
197 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuInfoUpdate); 197 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuInfoUpdate);
198 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, 198 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest,
199 NoGpuInfoUpdateWithSoftwareRendering); 199 NoGpuInfoUpdateWithSwiftShader);
200 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, 200 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest,
201 GPUVideoMemoryUsageStatsUpdate); 201 GPUVideoMemoryUsageStatsUpdate);
202 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, 202 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest,
203 BlockAllDomainsFrom3DAPIs); 203 BlockAllDomainsFrom3DAPIs);
204 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, 204 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest,
205 UnblockGuiltyDomainFrom3DAPIs); 205 UnblockGuiltyDomainFrom3DAPIs);
206 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, 206 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest,
207 UnblockDomainOfUnknownGuiltFrom3DAPIs); 207 UnblockDomainOfUnknownGuiltFrom3DAPIs);
208 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, 208 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest,
209 UnblockOtherDomainFrom3DAPIs); 209 UnblockOtherDomainFrom3DAPIs);
(...skipping 16 matching lines...) Expand all
226 // gpu info is collected. 226 // gpu info is collected.
227 void UpdatePreliminaryBlacklistedFeatures(); 227 void UpdatePreliminaryBlacklistedFeatures();
228 228
229 // Update the GPU switching status. 229 // Update the GPU switching status.
230 // This should only be called once at initialization time. 230 // This should only be called once at initialization time.
231 void UpdateGpuSwitchingManager(const GPUInfo& gpu_info); 231 void UpdateGpuSwitchingManager(const GPUInfo& gpu_info);
232 232
233 // Notify all observers whenever there is a GPU info update. 233 // Notify all observers whenever there is a GPU info update.
234 void NotifyGpuInfoUpdate(); 234 void NotifyGpuInfoUpdate();
235 235
236 // Try to switch to software rendering, if possible and necessary. 236 // Try to switch to SwifShader rendering, if possible and necessary.
237 void EnableSoftwareRenderingIfNecessary(); 237 void EnableSwiftShaderIfNecessary();
238 238
239 // Helper to extract the domain from a given URL. 239 // Helper to extract the domain from a given URL.
240 std::string GetDomainFromURL(const GURL& url) const; 240 std::string GetDomainFromURL(const GURL& url) const;
241 241
242 // Implementation functions for blocking of 3D graphics APIs, used 242 // Implementation functions for blocking of 3D graphics APIs, used
243 // for unit testing. 243 // for unit testing.
244 void BlockDomainFrom3DAPIsAtTime( 244 void BlockDomainFrom3DAPIsAtTime(
245 const GURL& url, DomainGuilt guilt, base::Time at_time); 245 const GURL& url, DomainGuilt guilt, base::Time at_time);
246 DomainBlockStatus Are3DAPIsBlockedAtTime( 246 DomainBlockStatus Are3DAPIsBlockedAtTime(
247 const GURL& url, base::Time at_time) const; 247 const GURL& url, base::Time at_time) const;
(...skipping 18 matching lines...) Expand all
266 266
267 scoped_ptr<GpuBlacklist> gpu_blacklist_; 267 scoped_ptr<GpuBlacklist> gpu_blacklist_;
268 scoped_ptr<GpuSwitchingList> gpu_switching_list_; 268 scoped_ptr<GpuSwitchingList> gpu_switching_list_;
269 scoped_ptr<GpuDriverBugList> gpu_driver_bug_list_; 269 scoped_ptr<GpuDriverBugList> gpu_driver_bug_list_;
270 270
271 const scoped_refptr<GpuDataManagerObserverList> observer_list_; 271 const scoped_refptr<GpuDataManagerObserverList> observer_list_;
272 272
273 ListValue log_messages_; 273 ListValue log_messages_;
274 mutable base::Lock log_messages_lock_; 274 mutable base::Lock log_messages_lock_;
275 275
276 bool software_rendering_; 276 bool use_swiftshader_;
277 277
278 base::FilePath swiftshader_path_; 278 base::FilePath swiftshader_path_;
279 279
280 // Current card force-blacklisted due to GPU crashes, or disabled through 280 // Current card force-blacklisted due to GPU crashes, or disabled through
281 // the --disable-gpu commandline switch. 281 // the --disable-gpu commandline switch.
282 bool card_blacklisted_; 282 bool card_blacklisted_;
283 283
284 // We disable histogram stuff in testing, especially in unit tests because 284 // We disable histogram stuff in testing, especially in unit tests because
285 // they cause random failures. 285 // they cause random failures.
286 bool update_histograms_; 286 bool update_histograms_;
287 287
288 // Number of currently open windows, to be used in gpu memory allocation. 288 // Number of currently open windows, to be used in gpu memory allocation.
289 int window_count_; 289 int window_count_;
290 290
291 DomainBlockMap blocked_domains_; 291 DomainBlockMap blocked_domains_;
292 mutable std::list<base::Time> timestamps_of_gpu_resets_; 292 mutable std::list<base::Time> timestamps_of_gpu_resets_;
293 bool domain_blocking_enabled_; 293 bool domain_blocking_enabled_;
294 294
295 std::vector<GpuSwitchCallback> gpu_switch_callbacks_; 295 std::vector<GpuSwitchCallback> gpu_switch_callbacks_;
296 296
297 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); 297 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl);
298 }; 298 };
299 299
300 } // namespace content 300 } // namespace content
301 301
302 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ 302 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/gpu/compositor_util.cc ('k') | content/browser/gpu/gpu_data_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698