| 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 GPU_CONFIG_GPU_CONTROL_LIST_H_ | 5 #ifndef GPU_CONFIG_GPU_CONTROL_LIST_H_ |
| 6 #define GPU_CONFIG_GPU_CONTROL_LIST_H_ | 6 #define GPU_CONFIG_GPU_CONTROL_LIST_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <set> | 11 #include <set> |
| 9 #include <string> | 12 #include <string> |
| 10 #include <vector> | 13 #include <vector> |
| 11 | 14 |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
| 14 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/values.h" | 18 #include "base/values.h" |
| 17 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 18 #include "gpu/gpu_export.h" | 20 #include "gpu/gpu_export.h" |
| 19 | 21 |
| 20 namespace gpu { | 22 namespace gpu { |
| 21 struct GPUInfo; | 23 struct GPUInfo; |
| 22 | 24 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 50 // list information to decide which entries are applied to the current | 52 // list information to decide which entries are applied to the current |
| 51 // system and returns the union of features specified in each entry. | 53 // system and returns the union of features specified in each entry. |
| 52 // If os is kOsAny, use the current OS; if os_version is empty, use the | 54 // If os is kOsAny, use the current OS; if os_version is empty, use the |
| 53 // current OS version. | 55 // current OS version. |
| 54 std::set<int> MakeDecision( | 56 std::set<int> MakeDecision( |
| 55 OsType os, std::string os_version, const GPUInfo& gpu_info); | 57 OsType os, std::string os_version, const GPUInfo& gpu_info); |
| 56 | 58 |
| 57 // Collects the active entries from the last MakeDecision() call. | 59 // Collects the active entries from the last MakeDecision() call. |
| 58 // If disabled set to true, return entries that are disabled; otherwise, | 60 // If disabled set to true, return entries that are disabled; otherwise, |
| 59 // return enabled entries. | 61 // return enabled entries. |
| 60 void GetDecisionEntries(std::vector<uint32>* entry_ids, | 62 void GetDecisionEntries(std::vector<uint32_t>* entry_ids, |
| 61 bool disabled) const; | 63 bool disabled) const; |
| 62 | 64 |
| 63 // Collects all disabled extensions. | 65 // Collects all disabled extensions. |
| 64 std::vector<std::string> GetDisabledExtensions(); | 66 std::vector<std::string> GetDisabledExtensions(); |
| 65 | 67 |
| 66 // Returns the description and bugs from active entries from the last | 68 // Returns the description and bugs from active entries from the last |
| 67 // MakeDecision() call. | 69 // MakeDecision() call. |
| 68 // | 70 // |
| 69 // Each problems has: | 71 // Each problems has: |
| 70 // { | 72 // { |
| 71 // "description": "Your GPU is too old", | 73 // "description": "Your GPU is too old", |
| 72 // "crBugs": [1234], | 74 // "crBugs": [1234], |
| 73 // "webkitBugs": [] | 75 // "webkitBugs": [] |
| 74 // } | 76 // } |
| 75 void GetReasons( | 77 void GetReasons( |
| 76 base::ListValue* problem_list, const std::string& tag) const; | 78 base::ListValue* problem_list, const std::string& tag) const; |
| 77 | 79 |
| 78 // Return the largest entry id. This is used for histogramming. | 80 // Return the largest entry id. This is used for histogramming. |
| 79 uint32 max_entry_id() const; | 81 uint32_t max_entry_id() const; |
| 80 | 82 |
| 81 // Returns the version of the control list. | 83 // Returns the version of the control list. |
| 82 std::string version() const; | 84 std::string version() const; |
| 83 | 85 |
| 84 // Check if we need more gpu info to make the decisions. | 86 // Check if we need more gpu info to make the decisions. |
| 85 // This is computed from the last MakeDecision() call. | 87 // This is computed from the last MakeDecision() call. |
| 86 // If yes, we should create a gl context and do a full gpu info collection. | 88 // If yes, we should create a gl context and do a full gpu info collection. |
| 87 bool needs_more_info() const { return needs_more_info_; } | 89 bool needs_more_info() const { return needs_more_info_; } |
| 88 | 90 |
| 89 // Returns the number of entries. This is only for tests. | 91 // Returns the number of entries. This is only for tests. |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 const GPUInfo& gpu_info) const; | 269 const GPUInfo& gpu_info) const; |
| 268 | 270 |
| 269 // Determines whether we needs more gpu info to make the blacklisting | 271 // Determines whether we needs more gpu info to make the blacklisting |
| 270 // decision. It should only be checked if Contains() returns true. | 272 // decision. It should only be checked if Contains() returns true. |
| 271 bool NeedsMoreInfo(const GPUInfo& gpu_info, bool consider_exceptions) const; | 273 bool NeedsMoreInfo(const GPUInfo& gpu_info, bool consider_exceptions) const; |
| 272 | 274 |
| 273 // Returns the OsType. | 275 // Returns the OsType. |
| 274 OsType GetOsType() const; | 276 OsType GetOsType() const; |
| 275 | 277 |
| 276 // Returns the entry's unique id. 0 is reserved. | 278 // Returns the entry's unique id. 0 is reserved. |
| 277 uint32 id() const; | 279 uint32_t id() const; |
| 278 | 280 |
| 279 // Returns whether the entry is disabled. | 281 // Returns whether the entry is disabled. |
| 280 bool disabled() const; | 282 bool disabled() const; |
| 281 | 283 |
| 282 // Returns the description of the entry | 284 // Returns the description of the entry |
| 283 const std::string& description() const { return description_; } | 285 const std::string& description() const { return description_; } |
| 284 | 286 |
| 285 // Returns a list of Chromium and Webkit bugs applicable to this entry | 287 // Returns a list of Chromium and Webkit bugs applicable to this entry |
| 286 const std::vector<int>& cr_bugs() const { return cr_bugs_; } | 288 const std::vector<int>& cr_bugs() const { return cr_bugs_; } |
| 287 const std::vector<int>& webkit_bugs() const { return webkit_bugs_; } | 289 const std::vector<int>& webkit_bugs() const { return webkit_bugs_; } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 enum GLType { | 325 enum GLType { |
| 324 kGLTypeGL, // This is default on MacOSX, Linux, ChromeOS | 326 kGLTypeGL, // This is default on MacOSX, Linux, ChromeOS |
| 325 kGLTypeGLES, // This is default on Android | 327 kGLTypeGLES, // This is default on Android |
| 326 kGLTypeANGLE, // This is default on Windows | 328 kGLTypeANGLE, // This is default on Windows |
| 327 kGLTypeNone | 329 kGLTypeNone |
| 328 }; | 330 }; |
| 329 | 331 |
| 330 GpuControlListEntry(); | 332 GpuControlListEntry(); |
| 331 ~GpuControlListEntry(); | 333 ~GpuControlListEntry(); |
| 332 | 334 |
| 333 bool SetId(uint32 id); | 335 bool SetId(uint32_t id); |
| 334 | 336 |
| 335 void SetDisabled(bool disabled); | 337 void SetDisabled(bool disabled); |
| 336 | 338 |
| 337 bool SetOsInfo(const std::string& os, | 339 bool SetOsInfo(const std::string& os, |
| 338 const std::string& version_op, | 340 const std::string& version_op, |
| 339 const std::string& version_string, | 341 const std::string& version_string, |
| 340 const std::string& version_string2); | 342 const std::string& version_string2); |
| 341 | 343 |
| 342 bool SetVendorId(const std::string& vendor_id_string); | 344 bool SetVendorId(const std::string& vendor_id_string); |
| 343 | 345 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 // map a feature_name to feature_id. If the string is not a registered | 423 // map a feature_name to feature_id. If the string is not a registered |
| 422 // feature name, return false. | 424 // feature name, return false. |
| 423 static bool StringToFeature(const std::string& feature_name, | 425 static bool StringToFeature(const std::string& feature_name, |
| 424 int* feature_id, | 426 int* feature_id, |
| 425 const FeatureMap& feature_map); | 427 const FeatureMap& feature_map); |
| 426 | 428 |
| 427 // Return the default GL type, depending on the OS. | 429 // Return the default GL type, depending on the OS. |
| 428 // See GLType declaration. | 430 // See GLType declaration. |
| 429 static GLType GetDefaultGLType(); | 431 static GLType GetDefaultGLType(); |
| 430 | 432 |
| 431 uint32 id_; | 433 uint32_t id_; |
| 432 bool disabled_; | 434 bool disabled_; |
| 433 std::string description_; | 435 std::string description_; |
| 434 std::vector<int> cr_bugs_; | 436 std::vector<int> cr_bugs_; |
| 435 std::vector<int> webkit_bugs_; | 437 std::vector<int> webkit_bugs_; |
| 436 std::vector<std::string> disabled_extensions_; | 438 std::vector<std::string> disabled_extensions_; |
| 437 scoped_ptr<OsInfo> os_info_; | 439 scoped_ptr<OsInfo> os_info_; |
| 438 uint32 vendor_id_; | 440 uint32_t vendor_id_; |
| 439 std::vector<uint32> device_id_list_; | 441 std::vector<uint32_t> device_id_list_; |
| 440 MultiGpuStyle multi_gpu_style_; | 442 MultiGpuStyle multi_gpu_style_; |
| 441 MultiGpuCategory multi_gpu_category_; | 443 MultiGpuCategory multi_gpu_category_; |
| 442 GLType gl_type_; | 444 GLType gl_type_; |
| 443 std::string driver_vendor_info_; | 445 std::string driver_vendor_info_; |
| 444 scoped_ptr<VersionInfo> driver_version_info_; | 446 scoped_ptr<VersionInfo> driver_version_info_; |
| 445 scoped_ptr<VersionInfo> driver_date_info_; | 447 scoped_ptr<VersionInfo> driver_date_info_; |
| 446 scoped_ptr<VersionInfo> gl_version_info_; | 448 scoped_ptr<VersionInfo> gl_version_info_; |
| 447 std::string gl_vendor_info_; | 449 std::string gl_vendor_info_; |
| 448 std::string gl_renderer_info_; | 450 std::string gl_renderer_info_; |
| 449 std::string gl_extensions_info_; | 451 std::string gl_extensions_info_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 471 static NumericOp StringToNumericOp(const std::string& op); | 473 static NumericOp StringToNumericOp(const std::string& op); |
| 472 | 474 |
| 473 std::string version_; | 475 std::string version_; |
| 474 std::vector<ScopedGpuControlListEntry> entries_; | 476 std::vector<ScopedGpuControlListEntry> entries_; |
| 475 | 477 |
| 476 // This records all the blacklist entries that are appliable to the current | 478 // This records all the blacklist entries that are appliable to the current |
| 477 // user machine. It is updated everytime MakeDecision() is called and is | 479 // user machine. It is updated everytime MakeDecision() is called and is |
| 478 // used later by GetDecisionEntries(). | 480 // used later by GetDecisionEntries(). |
| 479 std::vector<ScopedGpuControlListEntry> active_entries_; | 481 std::vector<ScopedGpuControlListEntry> active_entries_; |
| 480 | 482 |
| 481 uint32 max_entry_id_; | 483 uint32_t max_entry_id_; |
| 482 | 484 |
| 483 bool needs_more_info_; | 485 bool needs_more_info_; |
| 484 | 486 |
| 485 // The features a GpuControlList recognizes and handles. | 487 // The features a GpuControlList recognizes and handles. |
| 486 FeatureMap feature_map_; | 488 FeatureMap feature_map_; |
| 487 bool supports_feature_type_all_; | 489 bool supports_feature_type_all_; |
| 488 | 490 |
| 489 bool control_list_logging_enabled_; | 491 bool control_list_logging_enabled_; |
| 490 std::string control_list_logging_name_; | 492 std::string control_list_logging_name_; |
| 491 }; | 493 }; |
| 492 | 494 |
| 493 } // namespace gpu | 495 } // namespace gpu |
| 494 | 496 |
| 495 #endif // GPU_CONFIG_GPU_CONTROL_LIST_H_ | 497 #endif // GPU_CONFIG_GPU_CONTROL_LIST_H_ |
| 496 | 498 |
| OLD | NEW |