| 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 <utility> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" |
| 8 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 11 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 12 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
| 16 #include "base/values.h" |
| 13 #include "gpu/config/gpu_info.h" | 17 #include "gpu/config/gpu_info.h" |
| 14 #include "third_party/re2/src/re2/re2.h" | 18 #include "third_party/re2/src/re2/re2.h" |
| 15 | 19 |
| 16 namespace gpu { | 20 namespace gpu { |
| 17 namespace { | 21 namespace { |
| 18 | 22 |
| 19 // Break a version string into segments. Return true if each segment is | 23 // Break a version string into segments. Return true if each segment is |
| 20 // a valid number, and not all segment is 0. | 24 // a valid number, and not all segment is 0. |
| 21 bool ProcessVersionString(const std::string& version_string, | 25 bool ProcessVersionString(const std::string& version_string, |
| 22 char splitter, | 26 char splitter, |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 } | 578 } |
| 575 return std::vector<std::string>(disabled_extensions.begin(), | 579 return std::vector<std::string>(disabled_extensions.begin(), |
| 576 disabled_extensions.end()); | 580 disabled_extensions.end()); |
| 577 } | 581 } |
| 578 | 582 |
| 579 void GpuControlList::GetReasons(base::ListValue* problem_list, | 583 void GpuControlList::GetReasons(base::ListValue* problem_list, |
| 580 const std::string& tag) const { | 584 const std::string& tag) const { |
| 581 DCHECK(problem_list); | 585 DCHECK(problem_list); |
| 582 for (auto index : active_entries_) { | 586 for (auto index : active_entries_) { |
| 583 const Entry& entry = entries_[index]; | 587 const Entry& entry = entries_[index]; |
| 584 std::unique_ptr<base::DictionaryValue> problem(new base::DictionaryValue()); | 588 auto problem = base::MakeUnique<base::DictionaryValue>(); |
| 585 | 589 |
| 586 problem->SetString("description", entry.description); | 590 problem->SetString("description", entry.description); |
| 587 | 591 |
| 588 base::ListValue* cr_bugs = new base::ListValue(); | 592 auto cr_bugs = base::MakeUnique<base::ListValue>(); |
| 589 for (size_t jj = 0; jj < entry.cr_bug_size; ++jj) | 593 for (size_t jj = 0; jj < entry.cr_bug_size; ++jj) |
| 590 cr_bugs->AppendInteger(entry.cr_bugs[jj]); | 594 cr_bugs->AppendInteger(entry.cr_bugs[jj]); |
| 591 problem->Set("crBugs", cr_bugs); | 595 problem->Set("crBugs", std::move(cr_bugs)); |
| 592 | 596 |
| 593 base::ListValue* features = new base::ListValue(); | 597 auto features = base::MakeUnique<base::ListValue>(); |
| 594 entry.GetFeatureNames(features, feature_map_); | 598 entry.GetFeatureNames(features.get(), feature_map_); |
| 595 problem->Set("affectedGpuSettings", features); | 599 problem->Set("affectedGpuSettings", std::move(features)); |
| 596 | 600 |
| 597 DCHECK(tag == "workarounds" || tag == "disabledFeatures"); | 601 DCHECK(tag == "workarounds" || tag == "disabledFeatures"); |
| 598 problem->SetString("tag", tag); | 602 problem->SetString("tag", tag); |
| 599 | 603 |
| 600 problem_list->Append(std::move(problem)); | 604 problem_list->Append(std::move(problem)); |
| 601 } | 605 } |
| 602 } | 606 } |
| 603 | 607 |
| 604 size_t GpuControlList::num_entries() const { | 608 size_t GpuControlList::num_entries() const { |
| 605 return entry_count_; | 609 return entry_count_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 629 return kOsAny; | 633 return kOsAny; |
| 630 #endif | 634 #endif |
| 631 } | 635 } |
| 632 | 636 |
| 633 void GpuControlList::AddSupportedFeature( | 637 void GpuControlList::AddSupportedFeature( |
| 634 const std::string& feature_name, int feature_id) { | 638 const std::string& feature_name, int feature_id) { |
| 635 feature_map_[feature_id] = feature_name; | 639 feature_map_[feature_id] = feature_name; |
| 636 } | 640 } |
| 637 | 641 |
| 638 } // namespace gpu | 642 } // namespace gpu |
| OLD | NEW |