| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |