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

Unified Diff: cc/test/layer_tree_json_parser.cc

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/values.cc ('k') | chrome/browser/banners/app_banner_settings_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/layer_tree_json_parser.cc
diff --git a/cc/test/layer_tree_json_parser.cc b/cc/test/layer_tree_json_parser.cc
index 5ed266b28a6e148fc32695f22a7abe1b58fafa36..11645168b3c4ede8cad8abb8ebf734b0cb083cea 100644
--- a/cc/test/layer_tree_json_parser.cc
+++ b/cc/test/layer_tree_json_parser.cc
@@ -19,14 +19,14 @@ namespace cc {
namespace {
-scoped_refptr<Layer> ParseTreeFromValue(base::Value* val,
+scoped_refptr<Layer> ParseTreeFromValue(const base::Value& val,
ContentLayerClient* content_client) {
- base::DictionaryValue* dict;
+ const base::DictionaryValue* dict;
bool success = true;
- success &= val->GetAsDictionary(&dict);
+ success &= val.GetAsDictionary(&dict);
std::string layer_type;
success &= dict->GetString("LayerType", &layer_type);
- base::ListValue* list;
+ const base::ListValue* list;
success &= dict->GetList("Bounds", &list);
int width, height;
success &= list->GetInteger(0, &width);
@@ -50,7 +50,7 @@ scoped_refptr<Layer> ParseTreeFromValue(base::Value* val,
success &= list->GetInteger(2, &aperture_width);
success &= list->GetInteger(3, &aperture_height);
- base::ListValue* bounds;
+ const base::ListValue* bounds;
success &= dict->GetList("ImageBounds", &bounds);
double image_width, image_height;
success &= bounds->GetDouble(0, &image_width);
@@ -151,9 +151,8 @@ scoped_refptr<Layer> ParseTreeFromValue(base::Value* val,
new_layer->SetTransform(layer_transform);
success &= dict->GetList("Children", &list);
- for (base::ListValue::const_iterator it = list->begin();
- it != list->end(); ++it) {
- new_layer->AddChild(ParseTreeFromValue(*it, content_client));
+ for (const auto& value : *list) {
+ new_layer->AddChild(ParseTreeFromValue(*value, content_client));
}
if (!success)
@@ -167,7 +166,7 @@ scoped_refptr<Layer> ParseTreeFromValue(base::Value* val,
scoped_refptr<Layer> ParseTreeFromJson(std::string json,
ContentLayerClient* content_client) {
std::unique_ptr<base::Value> val = base::test::ParseJson(json);
- return ParseTreeFromValue(val.get(), content_client);
+ return ParseTreeFromValue(*val, content_client);
}
} // namespace cc
« no previous file with comments | « base/values.cc ('k') | chrome/browser/banners/app_banner_settings_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698