[Cocoa] Disable CF prefs direct mode
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Mar 2020 16:59:32 +0000 (16:59 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Mar 2020 16:59:32 +0000 (16:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=209166
<rdar://problem/60517387>

Reviewed by Brent Fulgham.

Revert <https://trac.webkit.org/changeset/258064> by disabling the CF prefs direct mode feature,
since it caused performance regressions.

Source/WebKit:

* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceMain):
* UIProcess/Cocoa/PreferenceObserver.mm:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::grantAccessToPreferenceService):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.h:
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

Source/WTF:

* wtf/PlatformEnable.h:

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

14 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/PlatformEnable.h
Source/WebKit/ChangeLog
Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb
Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm
Source/WebKit/UIProcess/Cocoa/PreferenceObserver.mm
Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/WebProcessProxy.h
Source/WebKit/WebProcess/WebProcess.h
Source/WebKit/WebProcess/WebProcess.messages.in
Source/WebKit/WebProcess/com.apple.WebProcess.sb.in

index dccae98..0d2893a 100644 (file)
@@ -1,3 +1,16 @@
+2020-03-17  Per Arne Vollan  <pvollan@apple.com>
+
+        [Cocoa] Disable CF prefs direct mode
+        https://bugs.webkit.org/show_bug.cgi?id=209166
+        <rdar://problem/60517387>
+
+        Reviewed by Brent Fulgham.
+
+        Revert <https://trac.webkit.org/changeset/258064> by disabling the CF prefs direct mode feature,
+        since it caused performance regressions.
+
+        * wtf/PlatformEnable.h:
+
 2020-03-17  Philippe Normand  <pnormand@igalia.com>
 
         RELEASE_LOG should not be Cocoa specific
index 43e729e..94cd037 100644 (file)
 #error "ENABLE(WEBGL2) requires ENABLE(WEBGL)"
 #endif
 
-#define ENABLE_CFPREFS_DIRECT_MODE 1
+#define ENABLE_CFPREFS_DIRECT_MODE 0
index 7ca1150..cb641a4 100644 (file)
@@ -1,3 +1,27 @@
+2020-03-17  Per Arne Vollan  <pvollan@apple.com>
+
+        [Cocoa] Disable CF prefs direct mode
+        https://bugs.webkit.org/show_bug.cgi?id=209166
+        <rdar://problem/60517387>
+
+        Reviewed by Brent Fulgham.
+
+        Revert <https://trac.webkit.org/changeset/258064> by disabling the CF prefs direct mode feature,
+        since it caused performance regressions.
+
+        * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
+        * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
+        (WebKit::XPCServiceMain):
+        * UIProcess/Cocoa/PreferenceObserver.mm:
+        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+        (WebKit::WebPageProxy::grantAccessToPreferenceService):
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
+        * UIProcess/WebProcessPool.h:
+        * UIProcess/WebProcessProxy.h:
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in:
+
 2020-03-17  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, reverting r258339.
index ea0b9ca..92e2fff 100644 (file)
 (allow mach-lookup
     (global-name "com.apple.logd")
     (global-name "com.apple.logd.events")
+    (global-name "com.apple.cfprefsd.daemon")
 )
 
 (deny mach-lookup (with telemetry)
index 210efbb..85b7656 100644 (file)
@@ -114,6 +114,9 @@ int XPCServiceMain(int argc, const char** argv)
         // Enable CFPrefs direct mode to avoid unsuccessfully attempting to connect to the daemon and getting blocked by the sandbox.
         _CFPrefsSetDirectModeEnabled(YES);
     }
+#else
+    UNUSED_PARAM(argc);
+    UNUSED_PARAM(argv);
 #endif
 
     auto bootstrap = adoptOSObject(xpc_copy_bootstrap());
index 8d813d8..35df713 100644 (file)
@@ -220,10 +220,12 @@ static void registerDefaultsOverride(id self, SEL selector, NSDictionary<NSStrin
 
 - (void)preferenceDidChange:(NSString *)domain key:(NSString *)key encodedValue:(NSString *)encodedValue
 {
+#if ENABLE(CFPREFS_DIRECT_MODE)
     Optional<String> encodedString;
     if (encodedValue)
         encodedString = String(encodedValue);
     for (auto* processPool : WebKit::WebProcessPool::allProcessPools())
         processPool->notifyPreferencesChanged(domain, key, encodedString);
+#endif
 }
 @end
index c6316d1..cd0f0d4 100644 (file)
@@ -352,7 +352,9 @@ void WebPageProxy::didCreateContextInGPUProcessForVisibilityPropagation(LayerHos
 
 void WebPageProxy::grantAccessToPreferenceService()
 {
+#if ENABLE(CFPREFS_DIRECT_MODE)
     process().unblockPreferenceServiceIfNeeded();
+#endif
 }
 
 } // namespace WebKit
index c767754..69c5810 100644 (file)
@@ -851,10 +851,12 @@ NSSet *WebProcessPool::allowedClassesForParameterCoding() const
     return m_classesForParameterCoder.get();
 }
 
+#if ENABLE(CFPREFS_DIRECT_MODE)
 void WebProcessPool::notifyPreferencesChanged(const String& domain, const String& key, const Optional<String>& encodedValue)
 {
     for (auto process : m_processes)
         process->send(Messages::WebProcess::NotifyPreferencesChanged(domain, key, encodedValue), 0);
 }
+#endif
 
 } // namespace WebKit
index c2cb06f..4548aa3 100644 (file)
@@ -229,6 +229,7 @@ void WebProcessProxy::unblockAccessibilityServerIfNeeded()
     m_hasSentMessageToUnblockAccessibilityServer = true;
 }
 
+#if ENABLE(CFPREFS_DIRECT_MODE)
 void WebProcessProxy::unblockPreferenceServiceIfNeeded()
 {
     if (m_hasSentMessageToUnblockPreferenceService)
@@ -245,5 +246,6 @@ void WebProcessProxy::unblockPreferenceServiceIfNeeded()
     send(Messages::WebProcess::UnblockPreferenceService(handle), 0);
     m_hasSentMessageToUnblockPreferenceService = true;
 }
+#endif
 
 }
index d5b9c26..cc686c9 100644 (file)
@@ -541,7 +541,7 @@ public:
     void setUseSeparateServiceWorkerProcess(bool);
     bool useSeparateServiceWorkerProcess() const { return m_useSeparateServiceWorkerProcess; }
 
-#if PLATFORM(COCOA)
+#if ENABLE(CFPREFS_DIRECT_MODE)
     void notifyPreferencesChanged(const String& domain, const String& key, const Optional<String>& encodedValue);
 #endif
 
index 37f823f..b26ec15 100644 (file)
@@ -338,8 +338,10 @@ public:
     
 #if PLATFORM(COCOA)
     void unblockAccessibilityServerIfNeeded();
+#if ENABLE(CFPREFS_DIRECT_MODE)
     void unblockPreferenceServiceIfNeeded();
 #endif
+#endif
 
     void webPageMediaStateDidChange(WebPageProxy&);
 
index f0c2d7a..419bec4 100644 (file)
@@ -302,10 +302,12 @@ public:
 #if ENABLE(REMOTE_INSPECTOR)
     void enableRemoteWebInspector(const SandboxExtension::Handle&);
 #endif
-    void notifyPreferencesChanged(const String& domain, const String& key, const Optional<String>& encodedValue);
     void unblockAccessibilityServer(const SandboxExtension::Handle&);
+#if ENABLE(CFPREFS_DIRECT_MODE)
+    void notifyPreferencesChanged(const String& domain, const String& key, const Optional<String>& encodedValue);
     void unblockPreferenceService(const SandboxExtension::Handle&);
 #endif
+#endif
 
     bool areAllPagesThrottleable() const;
 
index 683ff69..7c3a005 100644 (file)
@@ -167,8 +167,10 @@ messages -> WebProcess LegacyReceiver NotRefCounted {
 #endif
 
 #if PLATFORM(COCOA)
-    NotifyPreferencesChanged(String domain, String key, Optional<String> encodedValue)
     UnblockAccessibilityServer(WebKit::SandboxExtension::Handle handle)
+#if ENABLE(CFPREFS_DIRECT_MODE)
+    NotifyPreferencesChanged(String domain, String key, Optional<String> encodedValue)
     UnblockPreferenceService(WebKit::SandboxExtension::Handle handle)
 #endif
+#endif
 }
index c25b4bb..9fc4905 100644 (file)
     (with report) (with telemetry)
 #endif
     (global-name "com.apple.PowerManagement.control")
-#if !ENABLE(CFPREFS_DIRECT_MODE)
     (global-name "com.apple.cfprefsd.daemon")
-#endif
     (global-name "com.apple.coreservices.launchservicesd")
     (global-name "com.apple.lsd.mapdb")
     (global-name "com.apple.trustd.agent")