Chromium Code Reviews| 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 #include "gpu/config/gpu_control_list.h" | 5 #include "gpu/config/gpu_control_list.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | |
| 10 #include "base/cpu.h" | 11 #include "base/cpu.h" |
| 11 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
| 15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 17 #include "base/sys_info.h" | 18 #include "base/sys_info.h" |
| 18 #include "gpu/config/gpu_info.h" | 19 #include "gpu/config/gpu_info.h" |
| 20 #include "gpu/config/gpu_switches.h" | |
| 19 #include "gpu/config/gpu_util.h" | 21 #include "gpu/config/gpu_util.h" |
| 20 #include "third_party/re2/src/re2/re2.h" | 22 #include "third_party/re2/src/re2/re2.h" |
| 21 | 23 |
| 22 namespace gpu { | 24 namespace gpu { |
| 23 namespace { | 25 namespace { |
| 24 | 26 |
| 25 // Break a version string into segments. Return true if each segment is | 27 // Break a version string into segments. Return true if each segment is |
| 26 // a valid number, and not all segment is 0. | 28 // a valid number, and not all segment is 0. |
| 27 bool ProcessVersionString(const std::string& version_string, | 29 bool ProcessVersionString(const std::string& version_string, |
| 28 char splitter, | 30 char splitter, |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1424 std::set<int> permanent_features; | 1426 std::set<int> permanent_features; |
| 1425 // Has all features absent from "features" set that could potentially be | 1427 // Has all features absent from "features" set that could potentially be |
| 1426 // included later with more information. | 1428 // included later with more information. |
| 1427 std::set<int> potential_features; | 1429 std::set<int> potential_features; |
| 1428 | 1430 |
| 1429 if (os == kOsAny) | 1431 if (os == kOsAny) |
| 1430 os = GetOsType(); | 1432 os = GetOsType(); |
| 1431 if (os_version.empty()) | 1433 if (os_version.empty()) |
| 1432 os_version = base::SysInfo::OperatingSystemVersion(); | 1434 os_version = base::SysInfo::OperatingSystemVersion(); |
| 1433 | 1435 |
| 1436 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
|
Zhenyao Mo
2016/01/29 22:40:35
I disagree with this method of hacking all over th
| |
| 1437 if (command_line->HasSwitch(switches::kGpuTestingOsVersion)) | |
| 1438 os_version = | |
| 1439 command_line->GetSwitchValueASCII(switches::kGpuTestingOsVersion); | |
| 1440 | |
| 1434 for (size_t i = 0; i < entries_.size(); ++i) { | 1441 for (size_t i = 0; i < entries_.size(); ++i) { |
| 1435 ScopedGpuControlListEntry entry = entries_[i]; | 1442 ScopedGpuControlListEntry entry = entries_[i]; |
| 1436 if (entry->Contains(os, os_version, gpu_info)) { | 1443 if (entry->Contains(os, os_version, gpu_info)) { |
| 1437 bool needs_more_info_main = entry->NeedsMoreInfo(gpu_info, false); | 1444 bool needs_more_info_main = entry->NeedsMoreInfo(gpu_info, false); |
| 1438 bool needs_more_info_exception = entry->NeedsMoreInfo(gpu_info, true); | 1445 bool needs_more_info_exception = entry->NeedsMoreInfo(gpu_info, true); |
| 1439 | 1446 |
| 1440 if (!entry->disabled()) { | 1447 if (!entry->disabled()) { |
| 1441 if (control_list_logging_enabled_) | 1448 if (control_list_logging_enabled_) |
| 1442 entry->LogControlListMatch(control_list_logging_name_); | 1449 entry->LogControlListMatch(control_list_logging_name_); |
| 1443 // Only look at main entry info when deciding what to add to "features" | 1450 // Only look at main entry info when deciding what to add to "features" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1583 const std::string& feature_name, int feature_id) { | 1590 const std::string& feature_name, int feature_id) { |
| 1584 feature_map_[feature_name] = feature_id; | 1591 feature_map_[feature_name] = feature_id; |
| 1585 } | 1592 } |
| 1586 | 1593 |
| 1587 void GpuControlList::set_supports_feature_type_all(bool supported) { | 1594 void GpuControlList::set_supports_feature_type_all(bool supported) { |
| 1588 supports_feature_type_all_ = supported; | 1595 supports_feature_type_all_ = supported; |
| 1589 } | 1596 } |
| 1590 | 1597 |
| 1591 } // namespace gpu | 1598 } // namespace gpu |
| 1592 | 1599 |
| OLD | NEW |