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

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

Issue 10908110: Move gpu blacklist to content side. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 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) 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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/singleton.h" 15 #include "base/memory/singleton.h"
16 #include "base/observer_list_threadsafe.h" 16 #include "base/observer_list_threadsafe.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "content/browser/gpu/gpu_blacklist.h"
19 #include "content/public/browser/gpu_data_manager.h" 20 #include "content/public/browser/gpu_data_manager.h"
20 #include "content/public/common/gpu_info.h" 21 #include "content/public/common/gpu_info.h"
21 #include "content/public/common/gpu_memory_stats.h" 22 #include "content/public/common/gpu_memory_stats.h"
22 23
23 class CommandLine; 24 class CommandLine;
24 25
25 class CONTENT_EXPORT GpuDataManagerImpl 26 class CONTENT_EXPORT GpuDataManagerImpl
26 : public NON_EXPORTED_BASE(content::GpuDataManager) { 27 : public NON_EXPORTED_BASE(content::GpuDataManager) {
27 public: 28 public:
28 // Getter for the singleton. This will return NULL on failure. 29 // Getter for the singleton. This will return NULL on failure.
29 static GpuDataManagerImpl* GetInstance(); 30 static GpuDataManagerImpl* GetInstance();
30 31
31 // GpuDataManager implementation. 32 // GpuDataManager implementation.
32 virtual void InitializeGpuInfo() OVERRIDE; 33 virtual void Initialize(
34 const std::string& browser_version_string,
35 const std::string& gpu_blacklist_json) OVERRIDE;
33 virtual content::GpuFeatureType GetBlacklistedFeatures() const OVERRIDE; 36 virtual content::GpuFeatureType GetBlacklistedFeatures() const OVERRIDE;
34 virtual void SetPreliminaryBlacklistedFeatures( 37 virtual base::ListValue* GetBlacklistReasons() const OVERRIDE;
35 content::GpuFeatureType features) OVERRIDE; 38 virtual std::string GetBlacklistVersion() const OVERRIDE;
36 virtual content::GPUInfo GetGPUInfo() const OVERRIDE; 39 virtual content::GPUInfo GetGPUInfo() const OVERRIDE;
37 virtual bool GpuAccessAllowed() const OVERRIDE; 40 virtual bool GpuAccessAllowed() const OVERRIDE;
38 virtual void RequestCompleteGpuInfoIfNeeded() OVERRIDE; 41 virtual void RequestCompleteGpuInfoIfNeeded() OVERRIDE;
39 virtual bool IsCompleteGpuInfoAvailable() const OVERRIDE; 42 virtual bool IsCompleteGpuInfoAvailable() const OVERRIDE;
40 virtual void RequestVideoMemoryUsageStatsUpdate() const OVERRIDE; 43 virtual void RequestVideoMemoryUsageStatsUpdate() const OVERRIDE;
41 virtual bool ShouldUseSoftwareRendering() const OVERRIDE; 44 virtual bool ShouldUseSoftwareRendering() const OVERRIDE;
42 virtual void RegisterSwiftShaderPath(const FilePath& path) OVERRIDE; 45 virtual void RegisterSwiftShaderPath(const FilePath& path) OVERRIDE;
43 virtual void AddLogMessage(int level, const std::string& header, 46 virtual void AddLogMessage(int level, const std::string& header,
44 const std::string& message) OVERRIDE; 47 const std::string& message) OVERRIDE;
45 virtual base::ListValue* GetLogMessages() const OVERRIDE; 48 virtual base::ListValue* GetLogMessages() const OVERRIDE;
46 virtual void AddObserver(content::GpuDataManagerObserver* observer) OVERRIDE; 49 virtual void AddObserver(content::GpuDataManagerObserver* observer) OVERRIDE;
47 virtual void RemoveObserver( 50 virtual void RemoveObserver(
48 content::GpuDataManagerObserver* observer) OVERRIDE; 51 content::GpuDataManagerObserver* observer) OVERRIDE;
49 52
50 // Only update if the current GPUInfo is not finalized. 53 // Only update if the current GPUInfo is not finalized. If blacklist is
54 // loaded, run through blacklist and update blacklisted features.
51 void UpdateGpuInfo(const content::GPUInfo& gpu_info); 55 void UpdateGpuInfo(const content::GPUInfo& gpu_info);
52 56
53 void UpdateVideoMemoryUsageStats( 57 void UpdateVideoMemoryUsageStats(
54 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats); 58 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats);
55 59
56 // Insert disable-feature switches corresponding to preliminary gpu feature 60 // Insert disable-feature switches corresponding to preliminary gpu feature
57 // flags into the renderer process command line. 61 // flags into the renderer process command line.
58 void AppendRendererCommandLine(CommandLine* command_line) const; 62 void AppendRendererCommandLine(CommandLine* command_line) const;
59 63
60 // Insert switches into gpu process command line: kUseGL, 64 // Insert switches into gpu process command line: kUseGL,
(...skipping 23 matching lines...) Expand all
84 88
85 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuSideBlacklisting); 89 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuSideBlacklisting);
86 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, BlacklistCard); 90 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, BlacklistCard);
87 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuInfoUpdate); 91 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, GpuInfoUpdate);
88 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest, 92 FRIEND_TEST_ALL_PREFIXES(GpuDataManagerImplTest,
89 GPUVideoMemoryUsageStatsUpdate); 93 GPUVideoMemoryUsageStatsUpdate);
90 94
91 GpuDataManagerImpl(); 95 GpuDataManagerImpl();
92 virtual ~GpuDataManagerImpl(); 96 virtual ~GpuDataManagerImpl();
93 97
94 // If flags hasn't been set and GPUInfo is available, run through blacklist
95 // and compute the flags.
96 void UpdateBlacklistedFeatures(content::GpuFeatureType features); 98 void UpdateBlacklistedFeatures(content::GpuFeatureType features);
97 99
100 // This should only be called once at initialization time, when preliminary
101 // gpu info is collected.
102 void UpdatePreliminaryBlacklistedFeatures();
103
98 // Notify all observers whenever there is a GPU info update. 104 // Notify all observers whenever there is a GPU info update.
99 void NotifyGpuInfoUpdate(); 105 void NotifyGpuInfoUpdate();
100 106
101 // Try to switch to software rendering, if possible and necessary. 107 // Try to switch to software rendering, if possible and necessary.
102 void EnableSoftwareRenderingIfNecessary(); 108 void EnableSoftwareRenderingIfNecessary();
103 109
110 // Send UMA histograms about the disabled/enabled features.
111 void UpdateStats();
112
104 bool complete_gpu_info_already_requested_; 113 bool complete_gpu_info_already_requested_;
105 114
106 content::GpuFeatureType gpu_feature_type_; 115 content::GpuFeatureType gpu_feature_type_;
107 content::GpuFeatureType preliminary_gpu_feature_type_; 116 content::GpuFeatureType preliminary_gpu_feature_type_;
108 117
109 content::GPUInfo gpu_info_; 118 content::GPUInfo gpu_info_;
110 mutable base::Lock gpu_info_lock_; 119 mutable base::Lock gpu_info_lock_;
111 120
121 scoped_ptr<GpuBlacklist> gpu_blacklist_;
122
112 const scoped_refptr<GpuDataManagerObserverList> observer_list_; 123 const scoped_refptr<GpuDataManagerObserverList> observer_list_;
113 124
114 ListValue log_messages_; 125 ListValue log_messages_;
115 mutable base::Lock log_messages_lock_; 126 mutable base::Lock log_messages_lock_;
116 127
117 bool software_rendering_; 128 bool software_rendering_;
118 129
119 FilePath swiftshader_path_; 130 FilePath swiftshader_path_;
120 131
121 // Current card force-blacklisted due to GPU crashes, or disabled through 132 // Current card force-blacklisted due to GPU crashes, or disabled through
122 // the --disable-gpu commandline switch. 133 // the --disable-gpu commandline switch.
123 bool card_blacklisted_; 134 bool card_blacklisted_;
124 135
125 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl); 136 DISALLOW_COPY_AND_ASSIGN(GpuDataManagerImpl);
126 }; 137 };
127 138
128 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_ 139 #endif // CONTENT_BROWSER_GPU_GPU_DATA_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_blacklist_unittest.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