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

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

Issue 2916473002: [ObjC ARC] Converts ios/web:web to ARC. (Closed)
Patch Set: Fixing silly mistake 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
« no previous file with comments | « ios/web/web_state/ui/web_view_js_utils.mm ('k') | ios/web/web_state/web_state_impl.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/ui/wk_web_view_configuration_provider.mm
diff --git a/ios/web/web_state/ui/wk_web_view_configuration_provider.mm b/ios/web/web_state/ui/wk_web_view_configuration_provider.mm
index 7527133963eaf71a5d883e8b9da24a8d72e6df5a..209746341d51ce18344f1a7e7b68b8e944b77421 100644
--- a/ios/web/web_state/ui/wk_web_view_configuration_provider.mm
+++ b/ios/web/web_state/ui/wk_web_view_configuration_provider.mm
@@ -14,6 +14,10 @@
#import "ios/web/web_state/js/page_script_util.h"
#import "ios/web/web_state/ui/crw_wk_script_message_router.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
namespace web {
namespace {
@@ -23,10 +27,10 @@ const char kWKWebViewConfigProviderKeyName[] = "wk_web_view_config_provider";
// Returns an autoreleased instance of WKUserScript to be added to
// configuration's userContentController.
WKUserScript* InternalGetEarlyPageScript(BrowserState* browser_state) {
- return [[[WKUserScript alloc]
+ return [[WKUserScript alloc]
initWithSource:GetEarlyPageScript(browser_state)
injectionTime:WKUserScriptInjectionTimeAtDocumentStart
- forMainFrameOnly:YES] autorelease];
+ forMainFrameOnly:YES];
}
} // namespace
@@ -70,7 +74,7 @@ WKWebViewConfigurationProvider::GetWebViewConfiguration() {
addUserScript:InternalGetEarlyPageScript(browser_state_)];
}
// Prevent callers from changing the internals of configuration.
- return [[configuration_ copy] autorelease];
+ return [configuration_ copy];
}
CRWWKScriptMessageRouter*
@@ -88,9 +92,16 @@ WKWebViewConfigurationProvider::GetScriptMessageRouter() {
void WKWebViewConfigurationProvider::Purge() {
DCHECK([NSThread isMainThread]);
#if DCHECK_IS_ON()
- base::WeakNSObject<id> weak_configuration(configuration_);
- base::WeakNSObject<id> weak_router(router_);
- base::WeakNSObject<id> weak_process_pool([configuration_ processPool]);
+ base::WeakNSObject<id> weak_configuration;
+ base::WeakNSObject<id> weak_router;
+ // It's expected that the weak objects auto-nil by the end of this method.
+ // They should not be in any autoreleasepool that might keep them alive.
+ @autoreleasepool {
+ weak_configuration.reset(configuration_);
+ weak_router.reset(router_);
+ }
+// TODO(crbug.com/522672): See commented out DCHECK below.
+// __weak id weak_process_pool = [configuration_ processPool];
#endif // DCHECK_IS_ON()
configuration_.reset();
router_.reset();
« no previous file with comments | « ios/web/web_state/ui/web_view_js_utils.mm ('k') | ios/web/web_state/web_state_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698