OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ios/chrome/browser/crash_loop_detection_util.h" | 5 #include "ios/chrome/browser/crash_loop_detection_util.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." |
| 11 #endif |
| 12 |
9 namespace { | 13 namespace { |
10 NSString* const kAppStartupFailureCountKey = @"AppStartupFailureCount"; | 14 NSString* const kAppStartupFailureCountKey = @"AppStartupFailureCount"; |
11 } | 15 } |
12 | 16 |
13 namespace crash_util { | 17 namespace crash_util { |
14 | 18 |
15 int GetFailedStartupAttemptCount() { | 19 int GetFailedStartupAttemptCount() { |
16 static int startup_attempt_count = -1; | 20 static int startup_attempt_count = -1; |
17 if (startup_attempt_count == -1) { | 21 if (startup_attempt_count == -1) { |
18 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | 22 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; |
(...skipping 13 matching lines...) Expand all Loading... |
32 | 36 |
33 void ResetFailedStartupAttemptCount() { | 37 void ResetFailedStartupAttemptCount() { |
34 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | 38 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; |
35 if ([defaults integerForKey:kAppStartupFailureCountKey] != 0) { | 39 if ([defaults integerForKey:kAppStartupFailureCountKey] != 0) { |
36 [defaults setInteger:0 forKey:kAppStartupFailureCountKey]; | 40 [defaults setInteger:0 forKey:kAppStartupFailureCountKey]; |
37 [defaults synchronize]; | 41 [defaults synchronize]; |
38 } | 42 } |
39 } | 43 } |
40 | 44 |
41 } // namespace crash_util | 45 } // namespace crash_util |
OLD | NEW |