| 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 bool needs_more_info() const { return needs_more_info_; } | 86 bool needs_more_info() const { return needs_more_info_; } |
| 87 | 87 |
| 88 // Returns the number of entries. This is only for tests. | 88 // Returns the number of entries. This is only for tests. |
| 89 size_t num_entries() const; | 89 size_t num_entries() const; |
| 90 | 90 |
| 91 // Register a feature to FeatureMap - used to construct a GpuControlList. | 91 // Register a feature to FeatureMap - used to construct a GpuControlList. |
| 92 void AddSupportedFeature(const std::string& feature_name, int feature_id); | 92 void AddSupportedFeature(const std::string& feature_name, int feature_id); |
| 93 // Register whether "all" is recognized as all features. | 93 // Register whether "all" is recognized as all features. |
| 94 void set_supports_feature_type_all(bool supported); | 94 void set_supports_feature_type_all(bool supported); |
| 95 | 95 |
| 96 // Enables logging of control list decisions. |
| 97 void enable_control_list_logging( |
| 98 const std::string& control_list_logging_name) { |
| 99 control_list_logging_enabled_ = true; |
| 100 control_list_logging_name_ = control_list_logging_name; |
| 101 } |
| 102 |
| 96 private: | 103 private: |
| 97 friend class GpuControlListEntryTest; | 104 friend class GpuControlListEntryTest; |
| 98 friend class MachineModelInfoTest; | 105 friend class MachineModelInfoTest; |
| 99 friend class NumberInfoTest; | 106 friend class NumberInfoTest; |
| 100 friend class OsInfoTest; | 107 friend class OsInfoTest; |
| 101 friend class StringInfoTest; | 108 friend class StringInfoTest; |
| 102 friend class VersionInfoTest; | 109 friend class VersionInfoTest; |
| 103 | 110 |
| 104 enum BrowserVersionSupport { | 111 enum BrowserVersionSupport { |
| 105 kSupported, | 112 kSupported, |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 class GPU_EXPORT GpuControlListEntry | 289 class GPU_EXPORT GpuControlListEntry |
| 283 : public base::RefCounted<GpuControlListEntry> { | 290 : public base::RefCounted<GpuControlListEntry> { |
| 284 public: | 291 public: |
| 285 // Constructs GpuControlListEntry from DictionaryValue loaded from json. | 292 // Constructs GpuControlListEntry from DictionaryValue loaded from json. |
| 286 // Top-level entry must have an id number. Others are exceptions. | 293 // Top-level entry must have an id number. Others are exceptions. |
| 287 static ScopedGpuControlListEntry GetEntryFromValue( | 294 static ScopedGpuControlListEntry GetEntryFromValue( |
| 288 const base::DictionaryValue* value, bool top_level, | 295 const base::DictionaryValue* value, bool top_level, |
| 289 const FeatureMap& feature_map, | 296 const FeatureMap& feature_map, |
| 290 bool supports_feature_type_all); | 297 bool supports_feature_type_all); |
| 291 | 298 |
| 299 // Logs a control list match for this rule in the list identified by |
| 300 // |control_list_logging_name|. |
| 301 void LogControlListMatch( |
| 302 const std::string& control_list_logging_name) const; |
| 303 |
| 292 // Determines if a given os/gc/machine_model/driver is included in the | 304 // Determines if a given os/gc/machine_model/driver is included in the |
| 293 // Entry set. | 305 // Entry set. |
| 294 bool Contains(OsType os_type, const std::string& os_version, | 306 bool Contains(OsType os_type, const std::string& os_version, |
| 295 const GPUInfo& gpu_info) const; | 307 const GPUInfo& gpu_info) const; |
| 296 | 308 |
| 297 // Determines whether we needs more gpu info to make the blacklisting | 309 // Determines whether we needs more gpu info to make the blacklisting |
| 298 // decision. It should only be checked if Contains() returns true. | 310 // decision. It should only be checked if Contains() returns true. |
| 299 bool NeedsMoreInfo(const GPUInfo& gpu_info) const; | 311 bool NeedsMoreInfo(const GPUInfo& gpu_info) const; |
| 300 | 312 |
| 301 // Returns the OsType. | 313 // Returns the OsType. |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 // used later by GetDecisionEntries(). | 484 // used later by GetDecisionEntries(). |
| 473 std::vector<ScopedGpuControlListEntry> active_entries_; | 485 std::vector<ScopedGpuControlListEntry> active_entries_; |
| 474 | 486 |
| 475 uint32 max_entry_id_; | 487 uint32 max_entry_id_; |
| 476 | 488 |
| 477 bool needs_more_info_; | 489 bool needs_more_info_; |
| 478 | 490 |
| 479 // The features a GpuControlList recognizes and handles. | 491 // The features a GpuControlList recognizes and handles. |
| 480 FeatureMap feature_map_; | 492 FeatureMap feature_map_; |
| 481 bool supports_feature_type_all_; | 493 bool supports_feature_type_all_; |
| 494 |
| 495 bool control_list_logging_enabled_; |
| 496 std::string control_list_logging_name_; |
| 482 }; | 497 }; |
| 483 | 498 |
| 484 } // namespace gpu | 499 } // namespace gpu |
| 485 | 500 |
| 486 #endif // GPU_CONFIG_GPU_CONTROL_LIST_H_ | 501 #endif // GPU_CONFIG_GPU_CONTROL_LIST_H_ |
| 487 | 502 |
| OLD | NEW |