Transition more WKWebViewConfiguration ivars to API::PageConfiguration values
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Aug 2018 18:49:48 +0000 (18:49 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Aug 2018 18:49:48 +0000 (18:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188665

Reviewed by Joseph Pecoraro.

APPLICATION_MANIFEST is enabled on all Cocoa platforms, so I removed some guards, too!

* UIProcess/API/APIPageConfiguration.cpp:
(API::PageConfiguration::applicationManifest const):
* UIProcess/API/APIPageConfiguration.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _applicationManifest]):
(-[WKWebViewConfiguration _setApplicationManifest:]):
(-[WKWebViewConfiguration _setCPULimit:]):
(-[WKWebViewConfiguration _cpuLimit]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234946 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/APIPageConfiguration.cpp
Source/WebKit/UIProcess/API/APIPageConfiguration.h
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm

index 393d597..1976998 100644 (file)
@@ -1,6 +1,28 @@
 2018-08-16  Alex Christensen  <achristensen@webkit.org>
 
         Transition more WKWebViewConfiguration ivars to API::PageConfiguration values
+        https://bugs.webkit.org/show_bug.cgi?id=188665
+
+        Reviewed by Joseph Pecoraro.
+
+        APPLICATION_MANIFEST is enabled on all Cocoa platforms, so I removed some guards, too!
+
+        * UIProcess/API/APIPageConfiguration.cpp:
+        (API::PageConfiguration::applicationManifest const):
+        * UIProcess/API/APIPageConfiguration.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _initializeWithConfiguration:]):
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration init]):
+        (-[WKWebViewConfiguration copyWithZone:]):
+        (-[WKWebViewConfiguration _applicationManifest]):
+        (-[WKWebViewConfiguration _setApplicationManifest:]):
+        (-[WKWebViewConfiguration _setCPULimit:]):
+        (-[WKWebViewConfiguration _cpuLimit]):
+
+2018-08-16  Alex Christensen  <achristensen@webkit.org>
+
+        Transition more WKWebViewConfiguration ivars to API::PageConfiguration values
         https://bugs.webkit.org/show_bug.cgi?id=188663
 
         Reviewed by Tim Horton.
index 230a928..12d97f6 100644 (file)
@@ -188,7 +188,7 @@ void PageConfiguration::setURLSchemeHandlerForURLScheme(Ref<WebKit::WebURLScheme
 }
 
 #if ENABLE(APPLICATION_MANIFEST)
-const ApplicationManifest* PageConfiguration::applicationManifest() const
+ApplicationManifest* PageConfiguration::applicationManifest() const
 {
     return m_applicationManifest.get();
 }
index 9336ac4..7e4a3ae 100644 (file)
@@ -111,7 +111,7 @@ public:
     void setOverrideContentSecurityPolicy(const WTF::String& overrideContentSecurityPolicy) { m_overrideContentSecurityPolicy = overrideContentSecurityPolicy; }
 
 #if ENABLE(APPLICATION_MANIFEST)
-    const ApplicationManifest* applicationManifest() const;
+    ApplicationManifest* applicationManifest() const;
     void setApplicationManifest(ApplicationManifest*);
 #endif
 
index 92b168e..0f566b7 100644 (file)
@@ -541,13 +541,7 @@ static void validate(WKWebViewConfiguration *configuration)
     pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::incompleteImageBorderEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _incompleteImageBorderEnabled]));
     pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::shouldDeferAsynchronousScriptsUntilAfterDocumentLoadKey(), WebKit::WebPreferencesStore::Value(!![_configuration _shouldDeferAsynchronousScriptsUntilAfterDocumentLoad]));
 
-#if ENABLE(APPLICATION_MANIFEST)
-    pageConfiguration->setApplicationManifest([_configuration _applicationManifest] ? [configuration _applicationManifest]->_applicationManifest.get() : nullptr);
-#endif
-
 #if PLATFORM(MAC)
-    if (auto cpuLimit = [_configuration _cpuLimit])
-        pageConfiguration->setCPULimit(cpuLimit);
     pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::showsURLsInToolTipsEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _showsURLsInToolTips]));
     pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::serviceControlsEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _serviceControlsEnabled]));
     pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::imageControlsEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _imageControlsEnabled]));
index fb1fdc2..8a8052d 100644 (file)
@@ -39,6 +39,7 @@
 #import "WKWebViewContentProviderRegistry.h"
 #import "WebKit2Initialize.h"
 #import "WebURLSchemeHandlerCocoa.h"
+#import "_WKApplicationManifestInternal.h"
 #import "_WKVisitedLinkStore.h"
 #import "_WKWebsiteDataStoreInternal.h"
 #import <WebCore/RuntimeApplicationChecks.h>
@@ -141,17 +142,12 @@ static _WKDragLiftDelay toDragLiftDelay(NSUInteger value)
 
 #if PLATFORM(MAC)
     WKRetainPtr<WKPageGroupRef> _pageGroup;
-    double _cpuLimit;
     BOOL _showsURLsInToolTips;
     BOOL _serviceControlsEnabled;
     BOOL _imageControlsEnabled;
     BOOL _requiresUserActionForEditingControlsManager;
 #endif
 
-#if ENABLE(APPLICATION_MANIFEST)
-    RetainPtr<_WKApplicationManifest> _applicationManifest;
-#endif
-
 #if ENABLE(APPLE_PAY)
     BOOL _applePayEnabled;
 #endif
@@ -206,7 +202,6 @@ static _WKDragLiftDelay toDragLiftDelay(NSUInteger value)
 #endif
 
 #if PLATFORM(MAC)
-    _cpuLimit = 0;
     _printsBackgrounds = NO;
     _respectsImageOrientation = NO;
     _showsURLsInToolTips = NO;
@@ -373,7 +368,6 @@ static _WKDragLiftDelay toDragLiftDelay(NSUInteger value)
     configuration->_systemPreviewEnabled = self->_systemPreviewEnabled;
 #endif
 #if PLATFORM(MAC)
-    configuration->_cpuLimit = self->_cpuLimit;
     configuration->_userInterfaceDirectionPolicy = self->_userInterfaceDirectionPolicy;
     configuration->_showsURLsInToolTips = self->_showsURLsInToolTips;
     configuration->_serviceControlsEnabled = self->_serviceControlsEnabled;
@@ -390,9 +384,6 @@ static _WKDragLiftDelay toDragLiftDelay(NSUInteger value)
 #if ENABLE(APPLE_PAY)
     configuration->_applePayEnabled = self->_applePayEnabled;
 #endif
-#if ENABLE(APPLICATION_MANIFEST)
-    configuration->_applicationManifest = self->_applicationManifest;
-#endif
     configuration->_needsStorageAccessFromFileURLsQuirk = self->_needsStorageAccessFromFileURLsQuirk;
 
     configuration->_mediaContentTypesRequiringHardwareSupport = adoptNS([self._mediaContentTypesRequiringHardwareSupport copyWithZone:zone]);
@@ -858,18 +849,14 @@ static NSString *defaultApplicationNameForUserAgent()
 
 - (_WKApplicationManifest *)_applicationManifest
 {
-#if ENABLE(APPLICATION_MANIFEST)
-    return _applicationManifest.get();
-#else
+    if (auto* manifest = _pageConfiguration->applicationManifest())
+        return wrapper(*manifest);
     return nil;
-#endif
 }
 
 - (void)_setApplicationManifest:(_WKApplicationManifest *)applicationManifest
 {
-#if ENABLE(APPLICATION_MANIFEST)
-    _applicationManifest = applicationManifest;
-#endif
+    _pageConfiguration->setApplicationManifest(applicationManifest ? applicationManifest->_applicationManifest.get() : nullptr);
 }
 
 #if PLATFORM(MAC)
@@ -925,12 +912,12 @@ static NSString *defaultApplicationNameForUserAgent()
 
 - (void)_setCPULimit:(double)cpuLimit
 {
-    _cpuLimit = cpuLimit;
+    _pageConfiguration->setCPULimit(cpuLimit);
 }
 
 - (double)_cpuLimit
 {
-    return _cpuLimit;
+    return _pageConfiguration->cpuLimit().value_or(0);
 }
 
 #endif // PLATFORM(MAC)