Revert "Add @autoreleasepool to ios/chrome/app/chrome_exe_main.mm."
This reverts commit ef344143929225c301200cc7687272a3490833fa.
Reason for revert: This CL breaks ios integration egtests.
Original change's description:
> Add @autoreleasepool to ios/chrome/app/chrome_exe_main.mm.
>
> This CL adds @autoreleasepool to ios/chrome/app/chrome_exe_main.mm, and
> serves as a parent CL of https://codereview.chromium.org/2887413002/
> so that ios/chrome/app:main can be converted to ARC.
>
> Bug: 624363
> Change-Id: I434a40bc8b6a4482d03c4be7e642a218aed61b94
> Reviewed-on: https://chromium-review.googlesource.com/534874
> Reviewed-by: Mark Cogan <[email protected]>
> Reviewed-by: Stepan Khapugin <[email protected]>
> Commit-Queue: Yuke Liao <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#479722}
[email protected],[email protected],[email protected],[email protected]
Change-Id: I91dc13ccccba78d772a78095484bb545dd06cf39
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 624363
Reviewed-on: https://chromium-review.googlesource.com/537219
Reviewed-by: Yuke Liao <[email protected]>
Commit-Queue: Yuke Liao <[email protected]>
Cr-Commit-Position: refs/heads/master@{#479787}
diff --git a/ios/chrome/app/chrome_exe_main.mm b/ios/chrome/app/chrome_exe_main.mm
index a1c8bce..b2cdcd3 100644
--- a/ios/chrome/app/chrome_exe_main.mm
+++ b/ios/chrome/app/chrome_exe_main.mm
@@ -28,35 +28,39 @@
int main(int argc, char* argv[]) {
IOSChromeMain::InitStartTime();
- @autoreleasepool {
- NSUserDefaults* standardDefaults = [NSUserDefaults standardUserDefaults];
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
- // Set NSUserDefaults keys to force pseudo-RTL if needed.
- if ([standardDefaults boolForKey:@"EnablePseudoRTL"]) {
- NSDictionary* pseudoDict = @{ @"YES" : @"AppleTextDirection" };
- [standardDefaults registerDefaults:pseudoDict];
- }
+ NSUserDefaults* standardDefaults = [NSUserDefaults standardUserDefaults];
- // Create this here since it's needed to start the crash handler.
- base::AtExitManager at_exit;
-
- // The Crash Controller is started here even if the user opted out since we
- // don't have yet preferences. Later on it is stopped if the user opted out.
- // In any case reports are not sent if the user opted out.
- StartCrashController();
-
- // Always ignore SIGPIPE. We check the return value of write().
- CHECK_NE(SIG_ERR, signal(SIGPIPE, SIG_IGN));
+ // Set NSUserDefaults keys to force pseudo-RTL if needed.
+ if ([standardDefaults boolForKey:@"EnablePseudoRTL"]) {
+ NSDictionary* pseudoDict = @{ @"YES" : @"AppleTextDirection" };
+ [standardDefaults registerDefaults:pseudoDict];
}
- @autoreleasepool {
- // Part of code that requires us to specify which UIApplication delegate
- // class to use by adding "UIApplicationDelegate" key to Info.plist file.
- NSString* delegateClassName = [[NSBundle mainBundle]
- objectForInfoDictionaryKey:kUIApplicationDelegateInfoKey];
- CHECK(delegateClassName);
+ // Create this here since it's needed to start the crash handler.
+ base::AtExitManager at_exit;
- int retVal = UIApplicationMain(argc, argv, nil, delegateClassName);
- return retVal;
- }
+ // The Crash Controller is started here even if the user opted out since we
+ // don't have yet preferences. Later on it is stopped if the user opted out.
+ // In any case reports are not sent if the user opted out.
+ StartCrashController();
+
+ // Always ignore SIGPIPE. We check the return value of write().
+ CHECK_NE(SIG_ERR, signal(SIGPIPE, SIG_IGN));
+
+ // Purging the pool to prevent autorelease objects created by the previous
+ // calls to live forever.
+ [pool release];
+ pool = [[NSAutoreleasePool alloc] init];
+
+ // Part of code that requires us to specify which UIApplication delegate class
+ // to use by adding "UIApplicationDelegate" key to Info.plist file.
+ NSString* delegateClassName = [[NSBundle mainBundle]
+ objectForInfoDictionaryKey:kUIApplicationDelegateInfoKey];
+ CHECK(delegateClassName);
+
+ int retVal = UIApplicationMain(argc, argv, nil, delegateClassName);
+ [pool release];
+ return retVal;
}