| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "ios/chrome/app/application_delegate/memory_warning_helper.h" | 5 #import "ios/chrome/app/application_delegate/memory_warning_helper.h" |
| 6 | 6 |
| 7 #include "base/memory/memory_pressure_listener.h" | 7 #include "base/memory/memory_pressure_listener.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "ios/chrome/browser/crash_report/breakpad_helper.h" | 9 #include "ios/chrome/browser/crash_report/breakpad_helper.h" |
| 10 #import "ios/chrome/browser/metrics/previous_session_info.h" | 10 #import "ios/chrome/browser/metrics/previous_session_info.h" |
| 11 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
| 12 namespace { | 16 namespace { |
| 13 // The number of seconds to wait after a memory warning to clear the flag used | 17 // The number of seconds to wait after a memory warning to clear the flag used |
| 14 // to detect Out Of Memory crashes. | 18 // to detect Out Of Memory crashes. |
| 15 // NOTE: From local tests on various devices, this interval ranges between 1 and | 19 // NOTE: From local tests on various devices, this interval ranges between 1 and |
| 16 // 3 seconds. It is set to 5 to ensure all out of memory crashes are identified, | 20 // 3 seconds. It is set to 5 to ensure all out of memory crashes are identified, |
| 17 // even if this may lead to overcounting them. | 21 // even if this may lead to overcounting them. |
| 18 const CFTimeInterval kOutOfMemoryResetTimeInterval = 5; | 22 const CFTimeInterval kOutOfMemoryResetTimeInterval = 5; |
| 19 } | 23 } |
| 20 | 24 |
| 21 @interface MemoryWarningHelper () { | 25 @interface MemoryWarningHelper () { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 [[PreviousSessionInfo sharedInstance] resetMemoryWarningFlag]; | 64 [[PreviousSessionInfo sharedInstance] resetMemoryWarningFlag]; |
| 61 breakpad_helper::SetMemoryWarningInProgress(false); | 65 breakpad_helper::SetMemoryWarningInProgress(false); |
| 62 } | 66 } |
| 63 | 67 |
| 64 - (void)resetForegroundMemoryWarningCount { | 68 - (void)resetForegroundMemoryWarningCount { |
| 65 _foregroundMemoryWarningCount = 0; | 69 _foregroundMemoryWarningCount = 0; |
| 66 breakpad_helper::SetMemoryWarningCount(0); | 70 breakpad_helper::SetMemoryWarningCount(0); |
| 67 } | 71 } |
| 68 | 72 |
| 69 @end | 73 @end |
| OLD | NEW |