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

Unified Diff: ios/chrome/app/deferred_initialization_runner.mm

Issue 2453033002: Revert of [ObjC ARC] Converts ios/chrome/app to ARC. (Closed)
Patch Set: Created 4 years, 2 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/app/deferred_initialization_runner.mm
diff --git a/ios/chrome/app/deferred_initialization_runner.mm b/ios/chrome/app/deferred_initialization_runner.mm
index 31a396807229039913f5772799e7fe1feaed9db3..7e175b4c47d604cae0d502d959e5e4f3231a851b 100644
--- a/ios/chrome/app/deferred_initialization_runner.mm
+++ b/ios/chrome/app/deferred_initialization_runner.mm
@@ -6,13 +6,10 @@
#include <stdint.h>
+#import "base/ios/weak_nsobject.h"
#include "base/logging.h"
#include "base/mac/scoped_block.h"
#include "base/mac/scoped_nsobject.h"
-
-#if !defined(__has_feature) || !__has_feature(objc_arc)
-#error "This file requires ARC support."
-#endif
// An object encapsulating the deferred execution of a block of initialization
// code.
@@ -50,7 +47,7 @@
self = [super init];
if (self) {
_name.reset([name copy]);
- _runBlock.reset(block);
+ _runBlock.reset(block, base::scoped_policy::RETAIN);
}
return self;
}
@@ -105,8 +102,8 @@
- (instancetype)init {
self = [super init];
if (self) {
- _blocksNameQueue.reset([NSMutableArray array]);
- _runBlocks.reset([NSMutableDictionary dictionary]);
+ _blocksNameQueue.reset([[NSMutableArray array] retain]);
+ _runBlocks.reset([[NSMutableDictionary dictionary] retain]);
_isBlockScheduled = NO;
_delayBetweenBlocks = 0.2;
_delayBeforeFirstBlock = 3.0;
@@ -140,7 +137,8 @@
[_runBlocks objectForKey:nextBlockName];
DCHECK(nextBlock);
- __weak DeferredInitializationRunner* weakSelf = self;
+ base::WeakNSObject<DeferredInitializationRunner> weakSelf(self);
+
dispatch_after(
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)),
dispatch_get_main_queue(), ^{
« no previous file with comments | « ios/chrome/app/application_delegate/memory_warning_helper.mm ('k') | ios/chrome/app/safe_mode_crashing_modules_config.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698