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

Side by Side Diff: chrome/browser/metrics/plugin_metrics_provider.cc

Issue 308433004: Reduce plugin_metrics_provider_ usage in MetricsService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/metrics/plugin_metrics_provider.h" 5 #include "chrome/browser/metrics/plugin_metrics_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/prefs/pref_registry_simple.h" 9 #include "base/prefs/pref_registry_simple.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 int loading_errors = 0; 184 int loading_errors = 0;
185 plugin_dict->GetInteger(prefs::kStabilityPluginLoadingErrors, 185 plugin_dict->GetInteger(prefs::kStabilityPluginLoadingErrors,
186 &loading_errors); 186 &loading_errors);
187 if (loading_errors > 0) 187 if (loading_errors > 0)
188 plugin_stability->set_loading_error_count(loading_errors); 188 plugin_stability->set_loading_error_count(loading_errors);
189 } 189 }
190 190
191 local_state_->ClearPref(prefs::kStabilityPluginStats); 191 local_state_->ClearPref(prefs::kStabilityPluginStats);
192 } 192 }
193 193
194 void PluginMetricsProvider::RecordPluginChanges() { 194 // Saves plugin-related updates from the in-object buffer to Local State
195 // for retrieval next time we send a Profile log (generally next launch).
196 void PluginMetricsProvider::RecordCurrentState() {
195 ListPrefUpdate update(local_state_, prefs::kStabilityPluginStats); 197 ListPrefUpdate update(local_state_, prefs::kStabilityPluginStats);
196 base::ListValue* plugins = update.Get(); 198 base::ListValue* plugins = update.Get();
197 DCHECK(plugins); 199 DCHECK(plugins);
198 200
199 for (base::ListValue::iterator value_iter = plugins->begin(); 201 for (base::ListValue::iterator value_iter = plugins->begin();
200 value_iter != plugins->end(); ++value_iter) { 202 value_iter != plugins->end(); ++value_iter) {
201 if (!(*value_iter)->IsType(base::Value::TYPE_DICTIONARY)) { 203 if (!(*value_iter)->IsType(base::Value::TYPE_DICTIONARY)) {
202 NOTREACHED(); 204 NOTREACHED();
203 continue; 205 continue;
204 } 206 }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 343
342 void PluginMetricsProvider::BrowserChildProcessCrashed( 344 void PluginMetricsProvider::BrowserChildProcessCrashed(
343 const content::ChildProcessData& data) { 345 const content::ChildProcessData& data) {
344 GetChildProcessStats(data).process_crashes++; 346 GetChildProcessStats(data).process_crashes++;
345 } 347 }
346 348
347 void PluginMetricsProvider::BrowserChildProcessInstanceCreated( 349 void PluginMetricsProvider::BrowserChildProcessInstanceCreated(
348 const content::ChildProcessData& data) { 350 const content::ChildProcessData& data) {
349 GetChildProcessStats(data).instances++; 351 GetChildProcessStats(data).instances++;
350 } 352 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/plugin_metrics_provider.h ('k') | chrome/browser/plugins/plugin_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698