| 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 #ifndef IOS_CHROME_BROWSER_METRICS_PREVIOUS_SESSION_INFO_H_ |
| 6 #define IOS_CHROME_BROWSER_METRICS_PREVIOUS_SESSION_INFO_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 // PreviousSessionInfo has two jobs: |
| 11 // - Holding information about the last session, persisted across restart. |
| 12 // These informations are accessible via the properties on the shared |
| 13 // instance. |
| 14 // - Persist information about the current session, for use in a next session. |
| 15 @interface PreviousSessionInfo : NSObject |
| 16 |
| 17 // Whether the app received a memory warning seconds before being terminated. |
| 18 @property(nonatomic, assign, readonly) |
| 19 BOOL didSeeMemoryWarningShortlyBeforeTerminating; |
| 20 |
| 21 // Whether the app was updated between the previous and the current session. |
| 22 @property(nonatomic, assign, readonly) BOOL isFirstSessionAfterUpgrade; |
| 23 |
| 24 // Singleton PreviousSessionInfo. During the lifetime of the app, the returned |
| 25 // object is the same, and describes the previous session, even after a new |
| 26 // session has started (by calling beginRecordingCurrentSession). |
| 27 + (instancetype)sharedInstance; |
| 28 |
| 29 // Clears the persisted information about the previous session and starts |
| 30 // persisting information about the current session, for use in a next session. |
| 31 - (void)beginRecordingCurrentSession; |
| 32 |
| 33 // When a session has begun, records that a memory warning was received. |
| 34 - (void)setMemoryWarningFlag; |
| 35 |
| 36 // When a session has begun, records that any memory warning flagged can be |
| 37 // ignored. |
| 38 - (void)resetMemoryWarningFlag; |
| 39 |
| 40 @end |
| 41 |
| 42 @interface PreviousSessionInfo (TestingOnly) |
| 43 @property(nonatomic, assign) BOOL didSeeMemoryWarningShortlyBeforeTerminating; |
| 44 + (void)resetSharedInstanceForTesting; |
| 45 @end |
| 46 |
| 47 #endif // IOS_CHROME_BROWSER_METRICS_PREVIOUS_SESSION_INFO_H_ |
| OLD | NEW |