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

Unified Diff: ios/chrome/browser/metrics/previous_session_info.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
Index: ios/chrome/browser/metrics/previous_session_info.h
diff --git a/ios/chrome/browser/metrics/previous_session_info.h b/ios/chrome/browser/metrics/previous_session_info.h
new file mode 100644
index 0000000000000000000000000000000000000000..0f5a4447e61659a49d9c4702f75e5ab8f6382b8a
--- /dev/null
+++ b/ios/chrome/browser/metrics/previous_session_info.h
@@ -0,0 +1,47 @@
+// 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_PREVIOUS_SESSION_INFO_H_
+#define IOS_CHROME_BROWSER_METRICS_PREVIOUS_SESSION_INFO_H_
+
+#import <Foundation/Foundation.h>
+
+// PreviousSessionInfo has two jobs:
+// - Holding information about the last session, persisted across restart.
+// These informations are accessible via the properties on the shared
+// instance.
+// - Persist information about the current session, for use in a next session.
+@interface PreviousSessionInfo : NSObject
+
+// Whether the app received a memory warning seconds before being terminated.
+@property(nonatomic, assign, readonly)
+ BOOL didSeeMemoryWarningShortlyBeforeTerminating;
+
+// Whether the app was updated between the previous and the current session.
+@property(nonatomic, assign, readonly) BOOL isFirstSessionAfterUpgrade;
+
+// Singleton PreviousSessionInfo. During the lifetime of the app, the returned
+// object is the same, and describes the previous session, even after a new
+// session has started (by calling beginRecordingCurrentSession).
++ (instancetype)sharedInstance;
+
+// Clears the persisted information about the previous session and starts
+// persisting information about the current session, for use in a next session.
+- (void)beginRecordingCurrentSession;
+
+// When a session has begun, records that a memory warning was received.
+- (void)setMemoryWarningFlag;
+
+// When a session has begun, records that any memory warning flagged can be
+// ignored.
+- (void)resetMemoryWarningFlag;
+
+@end
+
+@interface PreviousSessionInfo (TestingOnly)
+@property(nonatomic, assign) BOOL didSeeMemoryWarningShortlyBeforeTerminating;
++ (void)resetSharedInstanceForTesting;
+@end
+
+#endif // IOS_CHROME_BROWSER_METRICS_PREVIOUS_SESSION_INFO_H_

Powered by Google App Engine
This is Rietveld 408576698