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