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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 int loading_errors = 0; | 189 int loading_errors = 0; |
190 plugin_dict->GetInteger(prefs::kStabilityPluginLoadingErrors, | 190 plugin_dict->GetInteger(prefs::kStabilityPluginLoadingErrors, |
191 &loading_errors); | 191 &loading_errors); |
192 if (loading_errors > 0) | 192 if (loading_errors > 0) |
193 plugin_stability->set_loading_error_count(loading_errors); | 193 plugin_stability->set_loading_error_count(loading_errors); |
194 } | 194 } |
195 | 195 |
196 local_state_->ClearPref(prefs::kStabilityPluginStats); | 196 local_state_->ClearPref(prefs::kStabilityPluginStats); |
197 } | 197 } |
198 | 198 |
| 199 void PluginMetricsProvider::ClearSavedStabilityMetrics() { |
| 200 local_state_->ClearPref(prefs::kStabilityPluginStats); |
| 201 } |
| 202 |
199 // Saves plugin-related updates from the in-object buffer to Local State | 203 // Saves plugin-related updates from the in-object buffer to Local State |
200 // for retrieval next time we send a Profile log (generally next launch). | 204 // for retrieval next time we send a Profile log (generally next launch). |
201 void PluginMetricsProvider::RecordCurrentState() { | 205 void PluginMetricsProvider::RecordCurrentState() { |
202 ListPrefUpdate update(local_state_, prefs::kStabilityPluginStats); | 206 ListPrefUpdate update(local_state_, prefs::kStabilityPluginStats); |
203 base::ListValue* plugins = update.Get(); | 207 base::ListValue* plugins = update.Get(); |
204 DCHECK(plugins); | 208 DCHECK(plugins); |
205 | 209 |
206 for (base::ListValue::iterator value_iter = plugins->begin(); | 210 for (base::ListValue::iterator value_iter = plugins->begin(); |
207 value_iter != plugins->end(); ++value_iter) { | 211 value_iter != plugins->end(); ++value_iter) { |
208 if (!(*value_iter)->IsType(base::Value::TYPE_DICTIONARY)) { | 212 if (!(*value_iter)->IsType(base::Value::TYPE_DICTIONARY)) { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 } | 377 } |
374 | 378 |
375 bool PluginMetricsProvider::RecordCurrentStateIfPending() { | 379 bool PluginMetricsProvider::RecordCurrentStateIfPending() { |
376 if (!weak_ptr_factory_.HasWeakPtrs()) | 380 if (!weak_ptr_factory_.HasWeakPtrs()) |
377 return false; | 381 return false; |
378 | 382 |
379 weak_ptr_factory_.InvalidateWeakPtrs(); | 383 weak_ptr_factory_.InvalidateWeakPtrs(); |
380 RecordCurrentState(); | 384 RecordCurrentState(); |
381 return true; | 385 return true; |
382 } | 386 } |
OLD | NEW |