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

Unified Diff: ios/chrome/browser/crash_loop_detection_util.h

Issue 1147703002: [iOS] Upstream crash loop detection utilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 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 | « no previous file | ios/chrome/browser/crash_loop_detection_util.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/crash_loop_detection_util.h
diff --git a/ios/chrome/browser/crash_loop_detection_util.h b/ios/chrome/browser/crash_loop_detection_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..0d8118ba81c7b922af8c5e07175e7fb89774fce3
--- /dev/null
+++ b/ios/chrome/browser/crash_loop_detection_util.h
@@ -0,0 +1,30 @@
+// Copyright 2013 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_CRASH_LOOP_DETECTION_UTIL_H_
+#define IOS_CHROME_BROWSER_CRASH_LOOP_DETECTION_UTIL_H_
+
+namespace crash_util {
+
+// Returns the number of consecutive failed startups ('instant' crashes) prior
+// to this one. This method always returns the number of prior failures even
+// after calls to increment or reset the value.
+int GetFailedStartupAttemptCount();
+
+// Increases the failed startup count. This should be called immediately after
+// startup, so that if there is a crash, it is recorded.
+// If |flush_immediately| is true, the value will be persisted immediately. If
+// |flush_immediately| is false, this should be followed by a call to
+// [[NSUserDefaults standardUserDefaults] synchronize]. This is optional to
+// allow coallescing of the potentially expensive call during startup.
+void IncrementFailedStartupAttemptCount(bool flush_immediately);
+
+// Resets the failed startup count. This should be called once there is some
+// indication the user isn't in a crash loop (e.g., some amount of time has
+// elapsed, or some deliberate user action has been taken).
+void ResetFailedStartupAttemptCount();
+
+} // namespace crash_util
+
+#endif // IOS_CHROME_BROWSER_CRASH_LOOP_DETECTION_UTIL_H_
« no previous file with comments | « no previous file | ios/chrome/browser/crash_loop_detection_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698