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

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

Issue 23703017: Enable GPU control lists in tests on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge up to r228383 Created 7 years, 2 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"
13 #include "base/sys_info.h" 14 #include "base/sys_info.h"
14 #include "gpu/config/gpu_info.h" 15 #include "gpu/config/gpu_info.h"
15 #include "gpu/config/gpu_util.h" 16 #include "gpu/config/gpu_util.h"
16 17
17 namespace gpu { 18 namespace gpu {
18 namespace { 19 namespace {
19 20
20 // Break a version string into segments. Return true if each segment is 21 // Break a version string into segments. Return true if each segment is
21 // a valid number. 22 // a valid number.
22 bool ProcessVersionString(const std::string& version_string, 23 bool ProcessVersionString(const std::string& version_string,
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 const std::string& category) { 1024 const std::string& category) {
1024 if (category == kMultiGpuCategoryStringPrimary) 1025 if (category == kMultiGpuCategoryStringPrimary)
1025 return kMultiGpuCategoryPrimary; 1026 return kMultiGpuCategoryPrimary;
1026 if (category == kMultiGpuCategoryStringSecondary) 1027 if (category == kMultiGpuCategoryStringSecondary)
1027 return kMultiGpuCategorySecondary; 1028 return kMultiGpuCategorySecondary;
1028 if (category == kMultiGpuCategoryStringAny) 1029 if (category == kMultiGpuCategoryStringAny)
1029 return kMultiGpuCategoryAny; 1030 return kMultiGpuCategoryAny;
1030 return kMultiGpuCategoryNone; 1031 return kMultiGpuCategoryNone;
1031 } 1032 }
1032 1033
1034 void GpuControlList::GpuControlListEntry::LogControlListMatch(
1035 const std::string& control_list_logging_name) const {
1036 static const char kControlListMatchMessage[] =
1037 "Control list match for rule #%u in %s.";
1038 LOG(INFO) << base::StringPrintf(kControlListMatchMessage, id_,
1039 control_list_logging_name.c_str());
1040 }
1041
1033 bool GpuControlList::GpuControlListEntry::Contains( 1042 bool GpuControlList::GpuControlListEntry::Contains(
1034 OsType os_type, const std::string& os_version, 1043 OsType os_type, const std::string& os_version,
1035 const GPUInfo& gpu_info) const { 1044 const GPUInfo& gpu_info) const {
1036 DCHECK(os_type != kOsAny); 1045 DCHECK(os_type != kOsAny);
1037 if (os_info_.get() != NULL && !os_info_->Contains(os_type, os_version)) 1046 if (os_info_.get() != NULL && !os_info_->Contains(os_type, os_version))
1038 return false; 1047 return false;
1039 bool is_not_primary_gpu = 1048 bool is_not_primary_gpu =
1040 GpuUnmatched(vendor_id_, device_id_list_, gpu_info.gpu); 1049 GpuUnmatched(vendor_id_, device_id_list_, gpu_info.gpu);
1041 bool is_not_secondary_gpu = true; 1050 bool is_not_secondary_gpu = true;
1042 for (size_t i = 0; i < gpu_info.secondary_gpus.size(); ++i) { 1051 for (size_t i = 0; i < gpu_info.secondary_gpus.size(); ++i) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 if (iter != feature_map.end()) { 1187 if (iter != feature_map.end()) {
1179 *feature_id = iter->second; 1188 *feature_id = iter->second;
1180 return true; 1189 return true;
1181 } 1190 }
1182 return false; 1191 return false;
1183 } 1192 }
1184 1193
1185 GpuControlList::GpuControlList() 1194 GpuControlList::GpuControlList()
1186 : max_entry_id_(0), 1195 : max_entry_id_(0),
1187 needs_more_info_(false), 1196 needs_more_info_(false),
1188 supports_feature_type_all_(false) { 1197 supports_feature_type_all_(false),
1198 control_list_logging_enabled_(false) {
1189 } 1199 }
1190 1200
1191 GpuControlList::~GpuControlList() { 1201 GpuControlList::~GpuControlList() {
1192 Clear(); 1202 Clear();
1193 } 1203 }
1194 1204
1195 bool GpuControlList::LoadList( 1205 bool GpuControlList::LoadList(
1196 const std::string& json_context, GpuControlList::OsFilter os_filter) { 1206 const std::string& json_context, GpuControlList::OsFilter os_filter) {
1197 const std::string browser_version_string = "0"; 1207 const std::string browser_version_string = "0";
1198 return LoadList(browser_version_string, json_context, os_filter); 1208 return LoadList(browser_version_string, json_context, os_filter);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 if (pos != std::string::npos) 1295 if (pos != std::string::npos)
1286 os_version = os_version.substr(0, pos); 1296 os_version = os_version.substr(0, pos);
1287 } 1297 }
1288 std::vector<std::string> pieces; 1298 std::vector<std::string> pieces;
1289 if (!ProcessVersionString(os_version, '.', &pieces)) 1299 if (!ProcessVersionString(os_version, '.', &pieces))
1290 os_version = "0"; 1300 os_version = "0";
1291 1301
1292 for (size_t i = 0; i < entries_.size(); ++i) { 1302 for (size_t i = 0; i < entries_.size(); ++i) {
1293 if (entries_[i]->Contains(os, os_version, gpu_info)) { 1303 if (entries_[i]->Contains(os, os_version, gpu_info)) {
1294 if (!entries_[i]->disabled()) { 1304 if (!entries_[i]->disabled()) {
1305 if (control_list_logging_enabled_)
1306 entries_[i]->LogControlListMatch(control_list_logging_name_);
1295 MergeFeatureSets(&possible_features, entries_[i]->features()); 1307 MergeFeatureSets(&possible_features, entries_[i]->features());
1296 if (!entries_[i]->NeedsMoreInfo(gpu_info)) 1308 if (!entries_[i]->NeedsMoreInfo(gpu_info))
1297 MergeFeatureSets(&features, entries_[i]->features()); 1309 MergeFeatureSets(&features, entries_[i]->features());
1298 } 1310 }
1299 active_entries_.push_back(entries_[i]); 1311 active_entries_.push_back(entries_[i]);
1300 } 1312 }
1301 } 1313 }
1302 1314
1303 if (possible_features.size() > features.size()) 1315 if (possible_features.size() > features.size())
1304 needs_more_info_ = true; 1316 needs_more_info_ = true;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 const std::string& feature_name, int feature_id) { 1435 const std::string& feature_name, int feature_id) {
1424 feature_map_[feature_name] = feature_id; 1436 feature_map_[feature_name] = feature_id;
1425 } 1437 }
1426 1438
1427 void GpuControlList::set_supports_feature_type_all(bool supported) { 1439 void GpuControlList::set_supports_feature_type_all(bool supported) {
1428 supports_feature_type_all_ = supported; 1440 supports_feature_type_all_ = supported;
1429 } 1441 }
1430 1442
1431 } // namespace gpu 1443 } // namespace gpu
1432 1444
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698