Title: [246101] trunk/Source/WebKit
Revision
246101
Author
[email protected]
Date
2019-06-05 00:42:09 -0700 (Wed, 05 Jun 2019)

Log Message

[GTK][WPE] Re-enable process warming
https://bugs.webkit.org/show_bug.cgi?id=198526

Reviewed by Michael Catanzaro.

It was disabled in r243490 because bubblewrap sandbox needs a valid WebsiteDataStore before launching the web
process. We can use the default WebsiteDataStore from the WebProcessPool and only use the prewarmed process
later if the given WebsiteDataStore is the same as the WebProcessPool one.

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::tryTakePrewarmedProcess): Do not use the prewarmed process if WebsiteDataStore is
different than the one used to launch the process when sandboxing is enabled.
* UIProcess/glib/WebProcessPoolGLib.cpp:
(WebKit::WebProcessPool::platformInitialize): Do not disable process warming.
* UIProcess/glib/WebProcessProxyGLib.cpp:
(WebKit::WebProcessProxy::platformGetLaunchOptions): Use the WebsiteDataStore from the WebProcessPool if process
is prewarmed and sandboxing is enabled.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (246100 => 246101)


--- trunk/Source/WebKit/ChangeLog	2019-06-05 06:34:56 UTC (rev 246100)
+++ trunk/Source/WebKit/ChangeLog	2019-06-05 07:42:09 UTC (rev 246101)
@@ -1,3 +1,23 @@
+2019-06-05  Carlos Garcia Campos  <[email protected]>
+
+        [GTK][WPE] Re-enable process warming
+        https://bugs.webkit.org/show_bug.cgi?id=198526
+
+        Reviewed by Michael Catanzaro.
+
+        It was disabled in r243490 because bubblewrap sandbox needs a valid WebsiteDataStore before launching the web
+        process. We can use the default WebsiteDataStore from the WebProcessPool and only use the prewarmed process
+        later if the given WebsiteDataStore is the same as the WebProcessPool one.
+
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::tryTakePrewarmedProcess): Do not use the prewarmed process if WebsiteDataStore is
+        different than the one used to launch the process when sandboxing is enabled.
+        * UIProcess/glib/WebProcessPoolGLib.cpp:
+        (WebKit::WebProcessPool::platformInitialize): Do not disable process warming.
+        * UIProcess/glib/WebProcessProxyGLib.cpp:
+        (WebKit::WebProcessProxy::platformGetLaunchOptions): Use the WebsiteDataStore from the WebProcessPool if process
+        is prewarmed and sandboxing is enabled.
+
 2019-06-04  Chris Dumez  <[email protected]>
 
         Cookies set via [WKHTTPCookieStore setCookie:] on store right after constructing WKWebView get lost

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (246100 => 246101)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2019-06-05 06:34:56 UTC (rev 246100)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2019-06-05 07:42:09 UTC (rev 246101)
@@ -820,6 +820,13 @@
     if (!m_prewarmedProcess)
         return nullptr;
 
+#if PLATFORM(GTK) || PLATFORM(WPE)
+    // In platforms using Bubblewrap for sandboxing, prewarmed process is launched using the WebProcessPool primary WebsiteDataStore,
+    // so we don't use it in case of using a different WebsiteDataStore.
+    if (m_sandboxEnabled && m_websiteDataStore && &m_websiteDataStore->websiteDataStore() != &websiteDataStore)
+        return nullptr;
+#endif
+
     ASSERT(m_prewarmedProcess->isPrewarmed());
     m_prewarmedProcess->markIsNoLongerInPrewarmedPool();
 

Modified: trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp (246100 => 246101)


--- trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp	2019-06-05 06:34:56 UTC (rev 246100)
+++ trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp	2019-06-05 07:42:09 UTC (rev 246101)
@@ -98,13 +98,6 @@
 
     if (!memoryPressureMonitorDisabled())
         installMemoryPressureHandler();
-
-    // Process warming is incompatible with the fact our WebProcessProxy::platformGetLaunchOptions()
-    // requires a valid WebsiteDataStore at initialization time for our sandbox permissions.
-    // FIXME: With process warming disabled, the performance of
-    // process-swap-on-navigation is not going to be great. So this needs to be
-    // re-enabled when we enable PSON.
-    configuration().setIsAutomaticProcessWarmingEnabled(false);
 }
 
 void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& parameters)

Modified: trunk/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp (246100 => 246101)


--- trunk/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp	2019-06-05 06:34:56 UTC (rev 246100)
+++ trunk/Source/WebKit/UIProcess/glib/WebProcessProxyGLib.cpp	2019-06-05 07:42:09 UTC (rev 246101)
@@ -38,12 +38,23 @@
 {
     launchOptions.extraInitializationData.set("enable-sandbox", m_processPool->sandboxEnabled() ? "true" : "false");
 
-    websiteDataStore().resolveDirectoriesIfNecessary();
-    launchOptions.extraInitializationData.set("webSQLDatabaseDirectory", websiteDataStore().resolvedDatabaseDirectory());
-    launchOptions.extraInitializationData.set("mediaKeysDirectory", websiteDataStore().resolvedMediaKeysDirectory());
-    launchOptions.extraInitializationData.set("applicationCacheDirectory", websiteDataStore().resolvedApplicationCacheDirectory());
+    if (m_processPool->sandboxEnabled()) {
+        WebsiteDataStore* dataStore = m_websiteDataStore.get();
+        if (!dataStore) {
+            // Prewarmed processes don't have a WebsiteDataStore yet, so use the primary WebsiteDataStore from the WebProcessPool.
+            // The process won't be used if current WebsiteDataStore is different than the WebProcessPool primary one.
+            if (auto* apiDataStore = m_processPool->websiteDataStore())
+                dataStore = &apiDataStore->websiteDataStore();
+        }
 
-    launchOptions.extraWebProcessSandboxPaths = m_processPool->sandboxPaths();
+        ASSERT(dataStore);
+        dataStore->resolveDirectoriesIfNecessary();
+        launchOptions.extraInitializationData.set("webSQLDatabaseDirectory", dataStore->resolvedDatabaseDirectory());
+        launchOptions.extraInitializationData.set("mediaKeysDirectory", dataStore->resolvedMediaKeysDirectory());
+        launchOptions.extraInitializationData.set("applicationCacheDirectory", dataStore->resolvedApplicationCacheDirectory());
+
+        launchOptions.extraWebProcessSandboxPaths = m_processPool->sandboxPaths();
+    }
 }
 
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to