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

Unified Diff: ios/chrome/browser/metrics/ios_stability_metrics_provider.h

Issue 1207353005: [iOS] Upstream some stability code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 | « ios/chrome/browser/metrics/OWNERS ('k') | ios/chrome/browser/metrics/ios_stability_metrics_provider.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/metrics/ios_stability_metrics_provider.h
diff --git a/ios/chrome/browser/metrics/ios_stability_metrics_provider.h b/ios/chrome/browser/metrics/ios_stability_metrics_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..915430766014d11c73d40743c517ff0cc4a1cfaa
--- /dev/null
+++ b/ios/chrome/browser/metrics/ios_stability_metrics_provider.h
@@ -0,0 +1,63 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_METRICS_IOS_STABILITY_METRICS_PROVIDER_H_
+#define IOS_CHROME_BROWSER_METRICS_IOS_STABILITY_METRICS_PROVIDER_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "components/metrics/metrics_provider.h"
+
+namespace metrics {
+class MetricsService;
+}
+
+// Exposed for testing purposes only.
+// Values of the UMA Stability.MobileSessionShutdownType histogram.
+enum MobileSessionShutdownType {
+ SHUTDOWN_IN_BACKGROUND = 0,
+ SHUTDOWN_IN_FOREGROUND_NO_CRASH_LOG_NO_MEMORY_WARNING,
+ SHUTDOWN_IN_FOREGROUND_WITH_CRASH_LOG_NO_MEMORY_WARNING,
+ SHUTDOWN_IN_FOREGROUND_NO_CRASH_LOG_WITH_MEMORY_WARNING,
+ SHUTDOWN_IN_FOREGROUND_WITH_CRASH_LOG_WITH_MEMORY_WARNING,
+ FIRST_LAUNCH_AFTER_UPGRADE,
+ MOBILE_SESSION_SHUTDOWN_TYPE_COUNT,
+};
+
+class IOSStabilityMetricsProvider : public metrics::MetricsProvider {
+ public:
+ explicit IOSStabilityMetricsProvider(
+ metrics::MetricsService* metrics_service);
+ ~IOSStabilityMetricsProvider() override;
+
+ // metrics::MetricsProvider
+ bool HasInitialStabilityMetrics() override;
+ void ProvideInitialStabilityMetrics(
+ metrics::SystemProfileProto* system_profile_proto) override;
+
+ protected:
+ // Provides information on the last session environment, used to decide what
+ // stability metrics to provide in ProvideInitialStabilityMetrics.
+ // These methods are virtual to be overridden in the tests.
+ // The default implementations return the real values.
+
+ // Whether this is the first time the app is launched after an upgrade.
+ virtual bool IsFirstLaunchAfterUpgrade();
+
+ // Whether there are crash reports to upload.
+ virtual bool HasCrashLogs();
+
+ // Whether there were crash reports that have been uploaded in background
+ // since the last full start.
+ virtual bool HasUploadedCrashReportsInBackground();
+
+ // Whether there was a memory warning shortly before last shutdown.
+ virtual bool ReceivedMemoryWarningBeforeLastShutdown();
+
+ private:
+ metrics::MetricsService* metrics_service_;
+ DISALLOW_COPY_AND_ASSIGN(IOSStabilityMetricsProvider);
+};
+
+#endif // IOS_CHROME_BROWSER_METRICS_IOS_STABILITY_METRICS_PROVIDER_H_
« no previous file with comments | « ios/chrome/browser/metrics/OWNERS ('k') | ios/chrome/browser/metrics/ios_stability_metrics_provider.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698