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

Unified Diff: chrome/browser/metrics/plugin_metrics_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/interests/interests_fetcher.cc ('k') | chrome/browser/permissions/chooser_context_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/plugin_metrics_provider.cc
diff --git a/chrome/browser/metrics/plugin_metrics_provider.cc b/chrome/browser/metrics/plugin_metrics_provider.cc
index c5292faaf349a9c63dd7330ca025fca3f532ec60..cfff039a19ca4c68eb51e59feeef14dab3e992ef 100644
--- a/chrome/browser/metrics/plugin_metrics_provider.cc
+++ b/chrome/browser/metrics/plugin_metrics_provider.cc
@@ -141,14 +141,12 @@ void PluginMetricsProvider::ProvideStabilityMetrics(
metrics::SystemProfileProto::Stability* stability =
system_profile_proto->mutable_stability();
- for (base::ListValue::const_iterator iter = plugin_stats_list->begin();
- iter != plugin_stats_list->end(); ++iter) {
- if (!(*iter)->IsType(base::Value::TYPE_DICTIONARY)) {
+ for (const auto& value : *plugin_stats_list) {
+ base::DictionaryValue* plugin_dict;
+ if (!value->GetAsDictionary(&plugin_dict)) {
NOTREACHED();
continue;
}
- base::DictionaryValue* plugin_dict =
- static_cast<base::DictionaryValue*>(*iter);
// Note that this search is potentially a quadratic operation, but given the
// low number of plugins installed on a "reasonable" setup, this should be
@@ -210,15 +208,13 @@ void PluginMetricsProvider::RecordCurrentState() {
base::ListValue* plugins = update.Get();
DCHECK(plugins);
- for (base::ListValue::iterator value_iter = plugins->begin();
- value_iter != plugins->end(); ++value_iter) {
- if (!(*value_iter)->IsType(base::Value::TYPE_DICTIONARY)) {
+ for (const auto& value : *plugins) {
+ base::DictionaryValue* plugin_dict;
+ if (!value->GetAsDictionary(&plugin_dict)) {
NOTREACHED();
continue;
}
- base::DictionaryValue* plugin_dict =
- static_cast<base::DictionaryValue*>(*value_iter);
base::string16 plugin_name;
plugin_dict->GetString(prefs::kStabilityPluginName, &plugin_name);
if (plugin_name.empty()) {
« no previous file with comments | « chrome/browser/interests/interests_fetcher.cc ('k') | chrome/browser/permissions/chooser_context_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698