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

Side by Side Diff: chromeos/system/statistics_provider.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 unified diff | Download patch
« no previous file with comments | « chromeos/network/shill_property_handler.cc ('k') | components/arc/net/arc_net_host_impl.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chromeos/system/statistics_provider.h" 5 #include "chromeos/system/statistics_provider.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // Returns true on success. 86 // Returns true on success.
87 bool JoinListValuesToString(const base::DictionaryValue* dictionary, 87 bool JoinListValuesToString(const base::DictionaryValue* dictionary,
88 const std::string key, 88 const std::string key,
89 std::string* result) { 89 std::string* result) {
90 const base::ListValue* list = nullptr; 90 const base::ListValue* list = nullptr;
91 if (!dictionary->GetListWithoutPathExpansion(key, &list)) 91 if (!dictionary->GetListWithoutPathExpansion(key, &list))
92 return false; 92 return false;
93 93
94 std::string buffer; 94 std::string buffer;
95 bool first = true; 95 bool first = true;
96 for (const base::Value* v : *list) { 96 for (const auto& v : *list) {
97 std::string value; 97 std::string value;
98 if (!v->GetAsString(&value)) 98 if (!v->GetAsString(&value))
99 return false; 99 return false;
100 100
101 if (first) 101 if (first)
102 first = false; 102 first = false;
103 else 103 else
104 buffer += ','; 104 buffer += ',';
105 105
106 buffer += value; 106 buffer += value;
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 return StatisticsProviderImpl::GetInstance(); 571 return StatisticsProviderImpl::GetInstance();
572 } 572 }
573 573
574 // static 574 // static
575 void StatisticsProvider::SetTestProvider(StatisticsProvider* test_provider) { 575 void StatisticsProvider::SetTestProvider(StatisticsProvider* test_provider) {
576 g_test_statistics_provider = test_provider; 576 g_test_statistics_provider = test_provider;
577 } 577 }
578 578
579 } // namespace system 579 } // namespace system
580 } // namespace chromeos 580 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/shill_property_handler.cc ('k') | components/arc/net/arc_net_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698