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

Unified Diff: ios/web/web_state/ui/crw_wk_script_message_router.mm

Issue 2916473002: [ObjC ARC] Converts ios/web:web to ARC. (Closed)
Patch Set: Tweaks to unit test memory management Created 3 years, 7 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/web/web_state/ui/crw_wk_script_message_router.mm
diff --git a/ios/web/web_state/ui/crw_wk_script_message_router.mm b/ios/web/web_state/ui/crw_wk_script_message_router.mm
index ed13ddb0b878def502fbd03555fc35f32ee2a154..8aa0f7067675220e6038afdbc42efd0fbdd3406e 100644
--- a/ios/web/web_state/ui/crw_wk_script_message_router.mm
+++ b/ios/web/web_state/ui/crw_wk_script_message_router.mm
@@ -5,7 +5,10 @@
#import "ios/web/web_state/ui/crw_wk_script_message_router.h"
#include "base/logging.h"
-#import "base/mac/scoped_nsobject.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
@interface CRWWKScriptMessageRouter ()<WKScriptMessageHandler>
@@ -18,16 +21,16 @@
@implementation CRWWKScriptMessageRouter {
// Two level map of registed message handlers. Keys are message names and
// values are more maps (where keys are web views and values are handlers).
- base::scoped_nsobject<NSMutableDictionary> _handlers;
+ NSMutableDictionary* _handlers;
// Wrapped WKUserContentController.
- base::scoped_nsobject<WKUserContentController> _userContentController;
+ WKUserContentController* _userContentController;
}
#pragma mark -
#pragma mark Interface
- (WKUserContentController*)userContentController {
- return _userContentController.get();
+ return _userContentController;
}
- (instancetype)init {
@@ -39,8 +42,8 @@
(WKUserContentController*)userContentController {
DCHECK(userContentController);
if ((self = [super init])) {
- _handlers.reset([[NSMutableDictionary alloc] init]);
- _userContentController.reset([userContentController retain]);
+ _handlers = [[NSMutableDictionary alloc] init];
+ _userContentController = userContentController;
}
return self;
}
@@ -103,9 +106,7 @@
id handler = [webViewToHandlerMap objectForKey:webView];
if (!handler)
return;
- // Extend the lifetime of |handler| so removeScriptMessageHandlerForName: can
- // be called from inside of |handler|.
- [[handler retain] autorelease];
+ // ARC TODO: Discuss the lifecycle of handler here in ARC.
PL 2017/06/01 01:56:21 This is something that needs discussion. We were
if (webViewToHandlerMap.count == 1) {
[_handlers removeObjectForKey:messageName];
[_userContentController removeScriptMessageHandlerForName:messageName];

Powered by Google App Engine
This is Rietveld 408576698