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

Unified Diff: ios/web/web_state/web_view_internal_creation_util.mm

Issue 2916473002: [ObjC ARC] Converts ios/web:web to ARC. (Closed)
Patch Set: Review feedback and change away from NSAutoreleasePool Created 3 years, 6 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/web_view_internal_creation_util.mm
diff --git a/ios/web/web_state/web_view_internal_creation_util.mm b/ios/web/web_state/web_view_internal_creation_util.mm
index 5095110ff5225cd65dde288949e61442d8614181..937a6f61dc9f6993c982c8c2fa7b65af0820764a 100644
--- a/ios/web/web_state/web_view_internal_creation_util.mm
+++ b/ios/web/web_state/web_view_internal_creation_util.mm
@@ -7,12 +7,15 @@
#import <objc/runtime.h>
#include "base/logging.h"
-#import "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
#import "ios/web/public/web_client.h"
#import "ios/web/web_state/ui/crw_context_menu_controller.h"
#import "ios/web/web_state/ui/wk_web_view_configuration_provider.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
namespace web {
namespace {
@@ -60,17 +63,17 @@ WKWebView* BuildWKWebView(CGRect frame,
web_view.allowsLinkPreview = NO;
if (context_menu_delegate) {
- base::scoped_nsobject<CRWContextMenuController> context_menu_controller(
- [[CRWContextMenuController alloc]
- initWithWebView:web_view
- injectionEvaluator:nil
- delegate:context_menu_delegate]);
- objc_setAssociatedObject(web_view, context_menu_controller.get(),
- context_menu_controller.get(),
+ CRWContextMenuController* context_menu_controller = [
+ [CRWContextMenuController alloc] initWithWebView:web_view
+ injectionEvaluator:nil
+ delegate:context_menu_delegate];
+ void* associatedObjectKey = (__bridge void*)context_menu_controller;
Eugene But (OOO till 7-30) 2017/06/14 01:27:59 Sorry, missed in the previous round s/associatedOb
PL 2017/06/15 22:51:32 Done! Sorry, old habits!
+ objc_setAssociatedObject(web_view, associatedObjectKey,
+ context_menu_controller,
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- return [web_view autorelease];
+ return web_view;
}
WKWebView* BuildWKWebView(CGRect frame,

Powered by Google App Engine
This is Rietveld 408576698