| Index: ios/chrome/browser/installation_notifier.mm
|
| diff --git a/ios/chrome/browser/installation_notifier.mm b/ios/chrome/browser/installation_notifier.mm
|
| index 1ea3e3eefcdaad24bd8fbb20ab0e7ddf7c7aaf8f..9a1f3b7e46d63343db316193f985ddf893a45a08 100644
|
| --- a/ios/chrome/browser/installation_notifier.mm
|
| +++ b/ios/chrome/browser/installation_notifier.mm
|
| @@ -9,14 +9,16 @@
|
|
|
| #include <memory>
|
|
|
| -#include "base/ios/weak_nsobject.h"
|
| #include "base/logging.h"
|
| -#include "base/mac/scoped_nsobject.h"
|
| #include "base/metrics/histogram.h"
|
| #include "ios/web/public/web_thread.h"
|
| #include "net/base/backoff_entry.h"
|
| #include "url/gurl.h"
|
|
|
| +#if !defined(__has_feature) || !__has_feature(objc_arc)
|
| +#error "This file requires ARC support."
|
| +#endif
|
| +
|
| namespace {
|
| const net::BackoffEntry::Policy kPollingBackoffPolicy = {
|
| 0, // Number of errors to ignore.
|
| @@ -64,13 +66,13 @@ const net::BackoffEntry::Policy kPollingBackoffPolicy = {
|
|
|
| @implementation InstallationNotifier {
|
| std::unique_ptr<net::BackoffEntry> _backoffEntry;
|
| - base::scoped_nsprotocol<id<DispatcherProtocol>> _dispatcher;
|
| + id<DispatcherProtocol> _dispatcher;
|
| // Dictionary mapping URL schemes to mutable sets of observers.
|
| - base::scoped_nsobject<NSMutableDictionary> _installedAppObservers;
|
| - NSNotificationCenter* _notificationCenter; // Weak.
|
| + NSMutableDictionary* _installedAppObservers;
|
| + __weak NSNotificationCenter* _notificationCenter;
|
|
|
| // This object can be a fake application in unittests.
|
| - UIApplication* sharedApplication_; // Weak.
|
| + __weak UIApplication* sharedApplication_;
|
| }
|
|
|
| @synthesize lastCreatedBlockId = lastCreatedBlockId_;
|
| @@ -84,8 +86,8 @@ const net::BackoffEntry::Policy kPollingBackoffPolicy = {
|
| self = [super init];
|
| if (self) {
|
| lastCreatedBlockId_ = 0;
|
| - _dispatcher.reset([[DefaultDispatcher alloc] init]);
|
| - _installedAppObservers.reset([[NSMutableDictionary alloc] init]);
|
| + _dispatcher = [[DefaultDispatcher alloc] init];
|
| + _installedAppObservers = [[NSMutableDictionary alloc] init];
|
| _notificationCenter = [NSNotificationCenter defaultCenter];
|
| sharedApplication_ = [UIApplication sharedApplication];
|
| _backoffEntry.reset(new net::BackoffEntry([self backOffPolicy]));
|
| @@ -117,7 +119,7 @@ const net::BackoffEntry::Policy kPollingBackoffPolicy = {
|
| [NSValue valueWithNonretainedObject:observer];
|
| NSMutableSet* observers = [_installedAppObservers objectForKey:scheme];
|
| if (!observers)
|
| - observers = [[[NSMutableSet alloc] init] autorelease];
|
| + observers = [[NSMutableSet alloc] init];
|
| if ([observers containsObject:weakReferenceToObserver])
|
| return;
|
| [observers addObject:weakReferenceToObserver];
|
| @@ -161,12 +163,11 @@ const net::BackoffEntry::Policy kPollingBackoffPolicy = {
|
| _backoffEntry->InformOfRequest(false);
|
| int64_t delayInNSec =
|
| _backoffEntry->GetTimeUntilRelease().InMicroseconds() * NSEC_PER_USEC;
|
| - base::WeakNSObject<InstallationNotifier> weakSelf(self);
|
| + __weak InstallationNotifier* weakSelf = self;
|
| [_dispatcher dispatchAfter:delayInNSec
|
| withBlock:^{
|
| DCHECK_CURRENTLY_ON(web::WebThread::UI);
|
| - base::scoped_nsobject<InstallationNotifier> strongSelf(
|
| - [weakSelf retain]);
|
| + InstallationNotifier* strongSelf = weakSelf;
|
| if (blockId == [strongSelf lastCreatedBlockId]) {
|
| [strongSelf pollForTheInstallationOfApps];
|
| }
|
| @@ -212,7 +213,7 @@ const net::BackoffEntry::Policy kPollingBackoffPolicy = {
|
| #pragma mark Testing setters
|
|
|
| - (void)setDispatcher:(id<DispatcherProtocol>)dispatcher {
|
| - _dispatcher.reset(dispatcher);
|
| + _dispatcher = dispatcher;
|
| }
|
|
|
| - (void)setSharedApplication:(id)sharedApplication {
|
|
|