| OLD | NEW |
| 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> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 kOsUnknown | 32 kOsUnknown |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 explicit GpuBlacklist(const std::string& browser_version_string); | 35 explicit GpuBlacklist(const std::string& browser_version_string); |
| 36 ~GpuBlacklist(); | 36 ~GpuBlacklist(); |
| 37 | 37 |
| 38 // Loads blacklist information from a json file. | 38 // Loads blacklist information from a json file. |
| 39 // 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 |
| 40 // 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 |
| 41 // for testing purpose. | 41 // for testing purpose. |
| 42 // tolerate_errors==true indicates ignore entries that cause processing |
| 43 // errors but keep the rest - this is important for backward compatibility |
| 44 // when new fields are added; tolerate_errors==false should only be used for |
| 45 // testing purpose. |
| 42 // If failed, the current GpuBlacklist is un-touched. | 46 // If failed, the current GpuBlacklist is un-touched. |
| 43 bool LoadGpuBlacklist(const std::string& json_context, | 47 bool LoadGpuBlacklist(const std::string& json_context, |
| 44 bool current_os_only); | 48 bool current_os_only, |
| 49 bool tolerate_errors); |
| 45 bool LoadGpuBlacklist(const base::DictionaryValue& parsed_json, | 50 bool LoadGpuBlacklist(const base::DictionaryValue& parsed_json, |
| 46 bool current_os_only); | 51 bool current_os_only, |
| 52 bool tolerate_errors); |
| 47 | 53 |
| 48 // Collects system information and combines them with gpu_info and blacklist | 54 // Collects system information and combines them with gpu_info and blacklist |
| 49 // information to determine gpu feature flags. | 55 // information to determine gpu feature flags. |
| 50 // If os is kOsAny, use the current OS; if os_version is null, use the | 56 // If os is kOsAny, use the current OS; if os_version is null, use the |
| 51 // current OS version. | 57 // current OS version. |
| 52 GpuFeatureFlags DetermineGpuFeatureFlags(OsType os, | 58 GpuFeatureFlags DetermineGpuFeatureFlags(OsType os, |
| 53 Version* os_version, | 59 Version* os_version, |
| 54 const GPUInfo& gpu_info); | 60 const GPUInfo& gpu_info); |
| 55 | 61 |
| 56 // Collects the entries that set the "feature" flag from the last | 62 // Collects the entries that set the "feature" flag from the last |
| 57 // DetermineGpuFeatureFlags() call. This tells which entries are responsible | 63 // DetermineGpuFeatureFlags() call. This tells which entries are responsible |
| 58 // for raising a certain flag, i.e, for blacklisting a certain feature. | 64 // for raising a certain flag, i.e, for blacklisting a certain feature. |
| 59 // Examples of "feature": | 65 // Examples of "feature": |
| 60 // kGpuFeatureAll - any of the supported features; | 66 // kGpuFeatureAll - any of the supported features; |
| 61 // kGpuFeatureWebgl - a single feature; | 67 // kGpuFeatureWebgl - a single feature; |
| 62 // kGpuFeatureWebgl | kGpuFeatureAcceleratedCompositing - two features. | 68 // kGpuFeatureWebgl | kGpuFeatureAcceleratedCompositing - two features. |
| 63 void GetGpuFeatureFlagEntries(GpuFeatureFlags::GpuFeatureType feature, | 69 void GetGpuFeatureFlagEntries(GpuFeatureFlags::GpuFeatureType feature, |
| 64 std::vector<uint32>& entry_ids) const; | 70 std::vector<uint32>& entry_ids) const; |
| 65 | 71 |
| 66 | |
| 67 // Returns status information on the blacklist. This is two parted: | 72 // Returns status information on the blacklist. This is two parted: |
| 68 // { | 73 // { |
| 69 // featureStatus: [] | 74 // featureStatus: [] |
| 70 // problems: [] | 75 // problems: [] |
| 71 // } | 76 // } |
| 72 // | 77 // |
| 73 // Each entry in feature_status has: | 78 // Each entry in feature_status has: |
| 74 // { | 79 // { |
| 75 // name: "name of feature" | 80 // name: "name of feature" |
| 76 // status: "enabled" | "unavailable_software" | "unavailable_off" | | 81 // status: "enabled" | "unavailable_software" | "unavailable_off" | |
| (...skipping 12 matching lines...) Expand all Loading... |
| 89 // "description": "Your GPU is too old", | 94 // "description": "Your GPU is too old", |
| 90 // "crBugs": [1234], | 95 // "crBugs": [1234], |
| 91 // "webkitBugs": [] | 96 // "webkitBugs": [] |
| 92 // } | 97 // } |
| 93 base::Value* GetFeatureStatus(bool gpu_access_allowed, | 98 base::Value* GetFeatureStatus(bool gpu_access_allowed, |
| 94 bool disable_accelerated_compositing, | 99 bool disable_accelerated_compositing, |
| 95 bool disable_accelerated_2D_canvas, | 100 bool disable_accelerated_2D_canvas, |
| 96 bool disable_experimental_webgl, | 101 bool disable_experimental_webgl, |
| 97 bool disable_multisampling) const; | 102 bool disable_multisampling) const; |
| 98 | 103 |
| 104 // Returns the number of entries. |
| 105 size_t num_entries() const; |
| 106 |
| 99 // Return the largest entry id. This is used for histogramming. | 107 // Return the largest entry id. This is used for histogramming. |
| 100 uint32 max_entry_id() const; | 108 uint32 max_entry_id() const; |
| 101 | 109 |
| 102 // Collects the version of the current blacklist. Returns false and sets | 110 // Collects the version of the current blacklist. Returns false and sets |
| 103 // major and minor to 0 on failure. | 111 // major and minor to 0 on failure. |
| 104 bool GetVersion(uint16* major, uint16* monir) const; | 112 bool GetVersion(uint16* major, uint16* monir) const; |
| 105 | 113 |
| 106 // Collects the version of the current blacklist from a parsed json file. | 114 // Collects the version of the current blacklist from a parsed json file. |
| 107 // Returns false and sets major and minor to 0 on failure. | 115 // Returns false and sets major and minor to 0 on failure. |
| 108 static bool GetVersion( | 116 static bool GetVersion( |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // user machine. It is updated everytime DetermineGpuFeatureFlags() is | 306 // user machine. It is updated everytime DetermineGpuFeatureFlags() is |
| 299 // called and is used later by GetGpuFeatureFlagEntries(). | 307 // called and is used later by GetGpuFeatureFlagEntries(). |
| 300 std::vector<GpuBlacklistEntry*> active_entries_; | 308 std::vector<GpuBlacklistEntry*> active_entries_; |
| 301 | 309 |
| 302 uint32 max_entry_id_; | 310 uint32 max_entry_id_; |
| 303 | 311 |
| 304 DISALLOW_COPY_AND_ASSIGN(GpuBlacklist); | 312 DISALLOW_COPY_AND_ASSIGN(GpuBlacklist); |
| 305 }; | 313 }; |
| 306 | 314 |
| 307 #endif // CONTENT_BROWSER_GPU_GPU_BLACKLIST_H_ | 315 #endif // CONTENT_BROWSER_GPU_GPU_BLACKLIST_H_ |
| OLD | NEW |