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

Side by Side Diff: services/catalog/entry.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: Fix various builds. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/catalog/entry.h" 5 #include "services/catalog/entry.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "services/catalog/store.h" 8 #include "services/catalog/store.h"
9 #include "services/shell/public/cpp/names.h" 9 #include "services/shell/public/cpp/names.h"
10 10
11 namespace catalog { 11 namespace catalog {
12 namespace { 12 namespace {
13 13
14 bool ReadStringSet(const base::ListValue& list_value, 14 bool ReadStringSet(const base::ListValue& list_value,
15 std::set<std::string>* string_set) { 15 std::set<std::string>* string_set) {
16 DCHECK(string_set); 16 DCHECK(string_set);
17 for (auto i = list_value.begin(); i != list_value.end(); ++i) { 17 for (const auto& value_value : list_value) {
18 std::string value; 18 std::string value;
19 const base::Value* value_value = *i;
20 if (!value_value->GetAsString(&value)) { 19 if (!value_value->GetAsString(&value)) {
21 LOG(ERROR) << "Entry::Deserialize: list member must be a string"; 20 LOG(ERROR) << "Entry::Deserialize: list member must be a string";
22 return false; 21 return false;
23 } 22 }
24 string_set->insert(value); 23 string_set->insert(value);
25 } 24 }
26 return true; 25 return true;
27 } 26 }
28 27
29 bool ReadStringSetFromValue(const base::Value& value, 28 bool ReadStringSetFromValue(const base::Value& value,
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 catalog::mojom::EntryPtr 288 catalog::mojom::EntryPtr
290 TypeConverter<catalog::mojom::EntryPtr, catalog::Entry>::Convert( 289 TypeConverter<catalog::mojom::EntryPtr, catalog::Entry>::Convert(
291 const catalog::Entry& input) { 290 const catalog::Entry& input) {
292 catalog::mojom::EntryPtr result(catalog::mojom::Entry::New()); 291 catalog::mojom::EntryPtr result(catalog::mojom::Entry::New());
293 result->name = input.name(); 292 result->name = input.name();
294 result->display_name = input.display_name(); 293 result->display_name = input.display_name();
295 return result; 294 return result;
296 } 295 }
297 296
298 } // namespace mojo 297 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698