| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ios/chrome/browser/metrics/ios_chrome_stability_metrics_provider.h" | |
| 6 | |
| 7 IOSChromeStabilityMetricsProvider::IOSChromeStabilityMetricsProvider( | |
| 8 PrefService* local_state) | |
| 9 : helper_(local_state), recording_enabled_(false) {} | |
| 10 | |
| 11 IOSChromeStabilityMetricsProvider::~IOSChromeStabilityMetricsProvider() {} | |
| 12 | |
| 13 void IOSChromeStabilityMetricsProvider::OnRecordingEnabled() { | |
| 14 recording_enabled_ = true; | |
| 15 } | |
| 16 | |
| 17 void IOSChromeStabilityMetricsProvider::OnRecordingDisabled() { | |
| 18 recording_enabled_ = false; | |
| 19 } | |
| 20 | |
| 21 void IOSChromeStabilityMetricsProvider::ProvideStabilityMetrics( | |
| 22 metrics::SystemProfileProto* system_profile_proto) { | |
| 23 helper_.ProvideStabilityMetrics(system_profile_proto); | |
| 24 } | |
| 25 | |
| 26 void IOSChromeStabilityMetricsProvider::ClearSavedStabilityMetrics() { | |
| 27 helper_.ClearSavedStabilityMetrics(); | |
| 28 } | |
| 29 | |
| 30 void IOSChromeStabilityMetricsProvider::LogRendererCrash() { | |
| 31 if (!recording_enabled_) | |
| 32 return; | |
| 33 | |
| 34 // The actual termination code isn't provided on iOS; use a dummy value. | |
| 35 // TODO(blundell): Think about having StabilityMetricsHelper have a variant | |
| 36 // that doesn't supply these arguments to make this cleaner. | |
| 37 int dummy_termination_code = 105; | |
| 38 helper_.LogRendererCrash(false /* not an extension process */, | |
| 39 base::TERMINATION_STATUS_ABNORMAL_TERMINATION, | |
| 40 dummy_termination_code); | |
| 41 } | |
| 42 | |
| 43 void IOSChromeStabilityMetricsProvider::WebStateDidStartLoading( | |
| 44 web::WebState* web_state) { | |
| 45 if (!recording_enabled_) | |
| 46 return; | |
| 47 | |
| 48 helper_.LogLoadStarted(); | |
| 49 } | |
| OLD | NEW |