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

Side by Side Diff: trunk/src/gpu/config/gpu_control_list.cc

Issue 23775004: Revert 221114 "Enable GPU blacklist in tests." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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
OLDNEW
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 #include "gpu/config/gpu_control_list.h" 5 #include "gpu/config/gpu_control_list.h"
6 6
7 #include "base/cpu.h" 7 #include "base/cpu.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_split.h" 11 #include "base/strings/string_split.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h"
14 #include "base/sys_info.h" 13 #include "base/sys_info.h"
15 #include "gpu/config/gpu_info.h" 14 #include "gpu/config/gpu_info.h"
16 #include "gpu/config/gpu_util.h" 15 #include "gpu/config/gpu_util.h"
17 16
18 namespace gpu { 17 namespace gpu {
19 namespace { 18 namespace {
20 19
21 // Break a version string into segments. Return true if each segment is 20 // Break a version string into segments. Return true if each segment is
22 // a valid number. 21 // a valid number.
23 bool ProcessVersionString(const std::string& version_string, 22 bool ProcessVersionString(const std::string& version_string,
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 const std::string& category) { 1029 const std::string& category) {
1031 if (category == kMultiGpuCategoryStringPrimary) 1030 if (category == kMultiGpuCategoryStringPrimary)
1032 return kMultiGpuCategoryPrimary; 1031 return kMultiGpuCategoryPrimary;
1033 if (category == kMultiGpuCategoryStringSecondary) 1032 if (category == kMultiGpuCategoryStringSecondary)
1034 return kMultiGpuCategorySecondary; 1033 return kMultiGpuCategorySecondary;
1035 if (category == kMultiGpuCategoryStringAny) 1034 if (category == kMultiGpuCategoryStringAny)
1036 return kMultiGpuCategoryAny; 1035 return kMultiGpuCategoryAny;
1037 return kMultiGpuCategoryNone; 1036 return kMultiGpuCategoryNone;
1038 } 1037 }
1039 1038
1040 void GpuControlList::GpuControlListEntry::LogControlListMatch() const {
1041 static const char kControlListMatchMessage[] =
1042 "Control list match for rule #%u.";
1043 LOG(INFO) << base::StringPrintf(kControlListMatchMessage, id_);
1044 }
1045
1046 bool GpuControlList::GpuControlListEntry::Contains( 1039 bool GpuControlList::GpuControlListEntry::Contains(
1047 OsType os_type, const std::string& os_version, 1040 OsType os_type, const std::string& os_version,
1048 const GPUInfo& gpu_info) const { 1041 const GPUInfo& gpu_info) const {
1049 DCHECK(os_type != kOsAny); 1042 DCHECK(os_type != kOsAny);
1050 if (os_info_.get() != NULL && !os_info_->Contains(os_type, os_version)) 1043 if (os_info_.get() != NULL && !os_info_->Contains(os_type, os_version))
1051 return false; 1044 return false;
1052 bool is_not_primary_gpu = 1045 bool is_not_primary_gpu =
1053 GpuUnmatched(vendor_id_, device_id_list_, gpu_info.gpu); 1046 GpuUnmatched(vendor_id_, device_id_list_, gpu_info.gpu);
1054 bool is_not_secondary_gpu = true; 1047 bool is_not_secondary_gpu = true;
1055 for (size_t i = 0; i < gpu_info.secondary_gpus.size(); ++i) { 1048 for (size_t i = 0; i < gpu_info.secondary_gpus.size(); ++i) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 *feature_id = iter->second; 1185 *feature_id = iter->second;
1193 return true; 1186 return true;
1194 } 1187 }
1195 return false; 1188 return false;
1196 } 1189 }
1197 1190
1198 GpuControlList::GpuControlList() 1191 GpuControlList::GpuControlList()
1199 : max_entry_id_(0), 1192 : max_entry_id_(0),
1200 contains_unknown_fields_(false), 1193 contains_unknown_fields_(false),
1201 needs_more_info_(false), 1194 needs_more_info_(false),
1202 supports_feature_type_all_(false), 1195 supports_feature_type_all_(false) {
1203 control_list_logging_enabled_(false) {
1204 } 1196 }
1205 1197
1206 GpuControlList::~GpuControlList() { 1198 GpuControlList::~GpuControlList() {
1207 Clear(); 1199 Clear();
1208 } 1200 }
1209 1201
1210 bool GpuControlList::LoadList( 1202 bool GpuControlList::LoadList(
1211 const std::string& json_context, GpuControlList::OsFilter os_filter) { 1203 const std::string& json_context, GpuControlList::OsFilter os_filter) {
1212 const std::string browser_version_string = "0"; 1204 const std::string browser_version_string = "0";
1213 return LoadList(browser_version_string, json_context, os_filter); 1205 return LoadList(browser_version_string, json_context, os_filter);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 if (pos != std::string::npos) 1302 if (pos != std::string::npos)
1311 os_version = os_version.substr(0, pos); 1303 os_version = os_version.substr(0, pos);
1312 } 1304 }
1313 std::vector<std::string> pieces; 1305 std::vector<std::string> pieces;
1314 if (!ProcessVersionString(os_version, '.', &pieces)) 1306 if (!ProcessVersionString(os_version, '.', &pieces))
1315 os_version = "0"; 1307 os_version = "0";
1316 1308
1317 for (size_t i = 0; i < entries_.size(); ++i) { 1309 for (size_t i = 0; i < entries_.size(); ++i) {
1318 if (entries_[i]->Contains(os, os_version, gpu_info)) { 1310 if (entries_[i]->Contains(os, os_version, gpu_info)) {
1319 if (!entries_[i]->disabled()) { 1311 if (!entries_[i]->disabled()) {
1320 if (control_list_logging_enabled_)
1321 entries_[i]->LogControlListMatch();
1322 MergeFeatureSets(&possible_features, entries_[i]->features()); 1312 MergeFeatureSets(&possible_features, entries_[i]->features());
1323 if (!entries_[i]->NeedsMoreInfo(gpu_info)) 1313 if (!entries_[i]->NeedsMoreInfo(gpu_info))
1324 MergeFeatureSets(&features, entries_[i]->features()); 1314 MergeFeatureSets(&features, entries_[i]->features());
1325 } 1315 }
1326 active_entries_.push_back(entries_[i]); 1316 active_entries_.push_back(entries_[i]);
1327 } 1317 }
1328 } 1318 }
1329 1319
1330 if (possible_features.size() > features.size()) 1320 if (possible_features.size() > features.size())
1331 needs_more_info_ = true; 1321 needs_more_info_ = true;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 const std::string& feature_name, int feature_id) { 1441 const std::string& feature_name, int feature_id) {
1452 feature_map_[feature_name] = feature_id; 1442 feature_map_[feature_name] = feature_id;
1453 } 1443 }
1454 1444
1455 void GpuControlList::set_supports_feature_type_all(bool supported) { 1445 void GpuControlList::set_supports_feature_type_all(bool supported) {
1456 supports_feature_type_all_ = supported; 1446 supports_feature_type_all_ = supported;
1457 } 1447 }
1458 1448
1459 } // namespace gpu 1449 } // namespace gpu
1460 1450
OLDNEW
« no previous file with comments | « trunk/src/gpu/config/gpu_control_list.h ('k') | trunk/src/gpu/config/software_rendering_list_json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698