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

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

Issue 2145543002: Use base::FooValue::From() to simplify gpu code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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
« no previous file with comments | « no previous file | gpu/tools/compositor_model_bench/compositor_model_bench.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 control_list_logging_enabled_(false) { 1387 control_list_logging_enabled_(false) {
1388 } 1388 }
1389 1389
1390 GpuControlList::~GpuControlList() { 1390 GpuControlList::~GpuControlList() {
1391 Clear(); 1391 Clear();
1392 } 1392 }
1393 1393
1394 bool GpuControlList::LoadList( 1394 bool GpuControlList::LoadList(
1395 const std::string& json_context, 1395 const std::string& json_context,
1396 GpuControlList::OsFilter os_filter) { 1396 GpuControlList::OsFilter os_filter) {
1397 std::unique_ptr<base::Value> root = base::JSONReader::Read(json_context); 1397 std::unique_ptr<base::DictionaryValue> root =
1398 if (root.get() == NULL || !root->IsType(base::Value::TYPE_DICTIONARY)) 1398 base::DictionaryValue::From(base::JSONReader::Read(json_context));
1399 if (!root)
1399 return false; 1400 return false;
1400 1401 return LoadList(*root, os_filter);
1401 base::DictionaryValue* root_dictionary =
1402 static_cast<base::DictionaryValue*>(root.get());
1403 DCHECK(root_dictionary);
1404 return LoadList(*root_dictionary, os_filter);
1405 } 1402 }
1406 1403
1407 bool GpuControlList::LoadList(const base::DictionaryValue& parsed_json, 1404 bool GpuControlList::LoadList(const base::DictionaryValue& parsed_json,
1408 GpuControlList::OsFilter os_filter) { 1405 GpuControlList::OsFilter os_filter) {
1409 std::vector<ScopedGpuControlListEntry> entries; 1406 std::vector<ScopedGpuControlListEntry> entries;
1410 1407
1411 parsed_json.GetString("version", &version_); 1408 parsed_json.GetString("version", &version_);
1412 std::vector<std::string> pieces; 1409 std::vector<std::string> pieces;
1413 if (!ProcessVersionString(version_, '.', &pieces)) 1410 if (!ProcessVersionString(version_, '.', &pieces))
1414 return false; 1411 return false;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 const std::string& feature_name, int feature_id) { 1613 const std::string& feature_name, int feature_id) {
1617 feature_map_[feature_name] = feature_id; 1614 feature_map_[feature_name] = feature_id;
1618 } 1615 }
1619 1616
1620 void GpuControlList::set_supports_feature_type_all(bool supported) { 1617 void GpuControlList::set_supports_feature_type_all(bool supported) {
1621 supports_feature_type_all_ = supported; 1618 supports_feature_type_all_ = supported;
1622 } 1619 }
1623 1620
1624 } // namespace gpu 1621 } // namespace gpu
1625 1622
OLDNEW
« no previous file with comments | « no previous file | gpu/tools/compositor_model_bench/compositor_model_bench.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698