| 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 2ef20332c7c0c9235a66901cc161996478c6a610..4b1ad99a649a03712598848445aa4e16976fffa5 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() {
|
| - return [[[WKUserScript alloc]
|
| + return [[WKUserScript alloc]
|
| initWithSource:GetEarlyPageScript()
|
| injectionTime:WKUserScriptInjectionTimeAtDocumentStart
|
| - forMainFrameOnly:YES] autorelease];
|
| + forMainFrameOnly:YES];
|
| }
|
|
|
| } // namespace
|
| @@ -57,7 +61,7 @@ WKWebViewConfiguration*
|
| WKWebViewConfigurationProvider::GetWebViewConfiguration() {
|
| DCHECK([NSThread isMainThread]);
|
| if (!configuration_) {
|
| - configuration_.reset([[WKWebViewConfiguration alloc] init]);
|
| + configuration_ = [[WKWebViewConfiguration alloc] init];
|
| if (is_off_the_record_) {
|
| [configuration_
|
| setWebsiteDataStore:[WKWebsiteDataStore nonPersistentDataStore]];
|
| @@ -78,7 +82,7 @@ WKWebViewConfigurationProvider::GetWebViewConfiguration() {
|
| addUserScript:InternalGetEarlyPageScript()];
|
| }
|
| // Prevent callers from changing the internals of configuration.
|
| - return [[configuration_ copy] autorelease];
|
| + return [configuration_ copy];
|
| }
|
|
|
| CRWWKScriptMessageRouter*
|
| @@ -87,8 +91,8 @@ WKWebViewConfigurationProvider::GetScriptMessageRouter() {
|
| if (!router_) {
|
| WKUserContentController* userContentController =
|
| [GetWebViewConfiguration() userContentController];
|
| - router_.reset([[CRWWKScriptMessageRouter alloc]
|
| - initWithUserContentController:userContentController]);
|
| + router_ = [[CRWWKScriptMessageRouter alloc]
|
| + initWithUserContentController:userContentController];
|
| }
|
| return router_;
|
| }
|
| @@ -96,12 +100,14 @@ WKWebViewConfigurationProvider::GetScriptMessageRouter() {
|
| void WKWebViewConfigurationProvider::Purge() {
|
| DCHECK([NSThread isMainThread]);
|
| #if !defined(NDEBUG) || !defined(DCHECK_ALWAYS_ON) // Matches DCHECK_IS_ON.
|
| - base::WeakNSObject<id> weak_configuration(configuration_);
|
| - base::WeakNSObject<id> weak_router(router_);
|
| - base::WeakNSObject<id> weak_process_pool([configuration_ processPool]);
|
| + __weak id weak_configuration = configuration_;
|
| + __weak id weak_router = router_;
|
| + __weak id weak_process_pool = [configuration_ processPool];
|
| +// TODO(crbug.com/522672): Remove this pragma.
|
| +#pragma unused(weak_process_pool)
|
| #endif // !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
|
| - configuration_.reset();
|
| - router_.reset();
|
| + configuration_ = nil;
|
| + router_ = nil;
|
| // Make sure that no one retains configuration, router, processPool.
|
| DCHECK(!weak_configuration);
|
| DCHECK(!weak_router);
|
|
|