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

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

Issue 7259019: Move base/values.h into the base namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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/font_list_async.h ('k') | content/browser/renderer_host/render_view_host.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_BLACKLIST_H_ 5 #ifndef CONTENT_BROWSER_GPU_GPU_BLACKLIST_H_
6 #define CONTENT_BROWSER_GPU_GPU_BLACKLIST_H_ 6 #define CONTENT_BROWSER_GPU_GPU_BLACKLIST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "content/common/gpu/gpu_feature_flags.h" 15 #include "content/common/gpu/gpu_feature_flags.h"
16 16
17 class DictionaryValue;
18 class Version; 17 class Version;
19 struct GPUInfo; 18 struct GPUInfo;
20 19
20 namespace base {
21 class DictionaryValue;
22 }
23
21 class GpuBlacklist { 24 class GpuBlacklist {
22 public: 25 public:
23 enum OsType { 26 enum OsType {
24 kOsLinux, 27 kOsLinux,
25 kOsMacosx, 28 kOsMacosx,
26 kOsWin, 29 kOsWin,
27 kOsChromeOS, 30 kOsChromeOS,
28 kOsAny, 31 kOsAny,
29 kOsUnknown 32 kOsUnknown
30 }; 33 };
31 34
32 explicit GpuBlacklist(const std::string& browser_version_string); 35 explicit GpuBlacklist(const std::string& browser_version_string);
33 ~GpuBlacklist(); 36 ~GpuBlacklist();
34 37
35 // Loads blacklist information from a json file. 38 // Loads blacklist information from a json file.
36 // current_os_only==true indicates all blacklist entries that don't belong to 39 // current_os_only==true indicates all blacklist entries that don't belong to
37 // the current OS are discarded; current_os_only==false should only be used 40 // the current OS are discarded; current_os_only==false should only be used
38 // for testing purpose. 41 // for testing purpose.
39 // If failed, the current GpuBlacklist is un-touched. 42 // If failed, the current GpuBlacklist is un-touched.
40 bool LoadGpuBlacklist(const std::string& json_context, 43 bool LoadGpuBlacklist(const std::string& json_context,
41 bool current_os_only); 44 bool current_os_only);
42 bool LoadGpuBlacklist(const DictionaryValue& parsed_json, 45 bool LoadGpuBlacklist(const base::DictionaryValue& parsed_json,
43 bool current_os_only); 46 bool current_os_only);
44 47
45 // Collects system information and combines them with gpu_info and blacklist 48 // Collects system information and combines them with gpu_info and blacklist
46 // information to determine gpu feature flags. 49 // information to determine gpu feature flags.
47 // If os is kOsAny, use the current OS; if os_version is null, use the 50 // If os is kOsAny, use the current OS; if os_version is null, use the
48 // current OS version. 51 // current OS version.
49 GpuFeatureFlags DetermineGpuFeatureFlags(OsType os, 52 GpuFeatureFlags DetermineGpuFeatureFlags(OsType os,
50 Version* os_version, 53 Version* os_version,
51 const GPUInfo& gpu_info); 54 const GPUInfo& gpu_info);
52 55
(...skipping 27 matching lines...) Expand all
80 // 'composting', 83 // 'composting',
81 // 'webgl', 84 // 'webgl',
82 // 'multisampling' 85 // 'multisampling'
83 // 86 //
84 // Each problems has: 87 // Each problems has:
85 // { 88 // {
86 // "description": "Your GPU is too old", 89 // "description": "Your GPU is too old",
87 // "crBugs": [1234], 90 // "crBugs": [1234],
88 // "webkitBugs": [] 91 // "webkitBugs": []
89 // } 92 // }
90 Value* GetFeatureStatus(bool gpu_access_allowed, 93 base::Value* GetFeatureStatus(bool gpu_access_allowed,
91 bool disable_accelerated_compositing, 94 bool disable_accelerated_compositing,
92 bool disable_accelerated_2D_canvas, 95 bool disable_accelerated_2D_canvas,
93 bool disable_experimental_webgl, 96 bool disable_experimental_webgl,
94 bool disable_multisampling) const; 97 bool disable_multisampling) const;
95 98
96 // Return the largest entry id. This is used for histogramming. 99 // Return the largest entry id. This is used for histogramming.
97 uint32 max_entry_id() const; 100 uint32 max_entry_id() const;
98 101
99 // Collects the version of the current blacklist. Returns false and sets 102 // Collects the version of the current blacklist. Returns false and sets
100 // major and minor to 0 on failure. 103 // major and minor to 0 on failure.
101 bool GetVersion(uint16* major, uint16* monir) const; 104 bool GetVersion(uint16* major, uint16* monir) const;
102 105
103 // Collects the version of the current blacklist from a parsed json file. 106 // Collects the version of the current blacklist from a parsed json file.
104 // Returns false and sets major and minor to 0 on failure. 107 // Returns false and sets major and minor to 0 on failure.
105 static bool GetVersion( 108 static bool GetVersion(
106 const DictionaryValue& parsed_json, uint16* major, uint16* minor); 109 const base::DictionaryValue& parsed_json, uint16* major, uint16* minor);
107 110
108 private: 111 private:
109 class VersionInfo { 112 class VersionInfo {
110 public: 113 public:
111 VersionInfo(const std::string& version_op, 114 VersionInfo(const std::string& version_op,
112 const std::string& version_string, 115 const std::string& version_string,
113 const std::string& version_string2); 116 const std::string& version_string2);
114 ~VersionInfo(); 117 ~VersionInfo();
115 118
116 // Determines if a given version is included in the VersionInfo range. 119 // Determines if a given version is included in the VersionInfo range.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 190
188 Op op_; 191 Op op_;
189 std::string value_; 192 std::string value_;
190 }; 193 };
191 194
192 class GpuBlacklistEntry { 195 class GpuBlacklistEntry {
193 public: 196 public:
194 // Constructs GpuBlacklistEntry from DictionaryValue loaded from json. 197 // Constructs GpuBlacklistEntry from DictionaryValue loaded from json.
195 // Top-level entry must have an id number. Others are exceptions. 198 // Top-level entry must have an id number. Others are exceptions.
196 static GpuBlacklistEntry* GetGpuBlacklistEntryFromValue( 199 static GpuBlacklistEntry* GetGpuBlacklistEntryFromValue(
197 DictionaryValue* value, bool top_level); 200 base::DictionaryValue* value, bool top_level);
198 201
199 // Determines if a given os/gc/driver is included in the Entry set. 202 // Determines if a given os/gc/driver is included in the Entry set.
200 bool Contains(OsType os_type, 203 bool Contains(OsType os_type,
201 const Version& os_version, 204 const Version& os_version,
202 const GPUInfo& gpu_info) const; 205 const GPUInfo& gpu_info) const;
203 206
204 // Returns the OsType. 207 // Returns the OsType.
205 OsType GetOsType() const; 208 OsType GetOsType() const;
206 209
207 // Returns the entry's unique id. 0 is reserved. 210 // Returns the entry's unique id. 0 is reserved.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 static OsType GetOsType(); 280 static OsType GetOsType();
278 281
279 void Clear(); 282 void Clear();
280 283
281 bool IsFeatureBlacklisted(GpuFeatureFlags::GpuFeatureType feature) const; 284 bool IsFeatureBlacklisted(GpuFeatureFlags::GpuFeatureType feature) const;
282 285
283 // Check if the entry is supported by the current version of browser. 286 // Check if the entry is supported by the current version of browser.
284 // By default, if there is no browser version information in the entry, 287 // By default, if there is no browser version information in the entry,
285 // return kSupported; 288 // return kSupported;
286 BrowserVersionSupport IsEntrySupportedByCurrentBrowserVersion( 289 BrowserVersionSupport IsEntrySupportedByCurrentBrowserVersion(
287 DictionaryValue* value); 290 base::DictionaryValue* value);
288 291
289 scoped_ptr<Version> version_; 292 scoped_ptr<Version> version_;
290 std::vector<GpuBlacklistEntry*> blacklist_; 293 std::vector<GpuBlacklistEntry*> blacklist_;
291 294
292 scoped_ptr<Version> browser_version_; 295 scoped_ptr<Version> browser_version_;
293 296
294 // This records all the blacklist entries that are appliable to the current 297 // This records all the blacklist entries that are appliable to the current
295 // user machine. It is updated everytime DetermineGpuFeatureFlags() is 298 // user machine. It is updated everytime DetermineGpuFeatureFlags() is
296 // called and is used later by GetGpuFeatureFlagEntries(). 299 // called and is used later by GetGpuFeatureFlagEntries().
297 std::vector<GpuBlacklistEntry*> active_entries_; 300 std::vector<GpuBlacklistEntry*> active_entries_;
298 301
299 uint32 max_entry_id_; 302 uint32 max_entry_id_;
300 303
301 DISALLOW_COPY_AND_ASSIGN(GpuBlacklist); 304 DISALLOW_COPY_AND_ASSIGN(GpuBlacklist);
302 }; 305 };
303 306
304 #endif // CONTENT_BROWSER_GPU_GPU_BLACKLIST_H_ 307 #endif // CONTENT_BROWSER_GPU_GPU_BLACKLIST_H_
OLDNEW
« no previous file with comments | « content/browser/font_list_async.h ('k') | content/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698