| 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(), ^{
|
|
|