[WPE] Do not create a PlatformDisplay in the Service Worker process
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Mar 2019 11:59:27 +0000 (11:59 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Mar 2019 11:59:27 +0000 (11:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194830

Patch by Loïc Yhuel <loic.yhuel@softathome.com> on 2019-03-05
Reviewed by Žan Doberšek.

It avoids opening the Wayland socket in this WPEWebProcess, which might cause issues
depending on the platform, and allocates unneeded resources.

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h: Add new isServiceWorkerProcess parameter.
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::initializeNewWebProcess): Set isServiceWorkerProcess parameter.
* UIProcess/glib/WebProcessPoolGLib.cpp:
(WebKit::WebProcessPool::platformInitializeWebProcess): No implementationLibraryName and hostClientFileDescriptor for Service Worker.
* WebProcess/glib/WebProcessGLib.cpp:
(WebKit::WebProcess::platformInitializeWebProcess): No wpe_loader_init nor PlatformDisplayLibWPE for Service Worker.

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

Source/WebKit/ChangeLog
Source/WebKit/Shared/WebProcessCreationParameters.cpp
Source/WebKit/Shared/WebProcessCreationParameters.h
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp
Source/WebKit/WebProcess/glib/WebProcessGLib.cpp

index df60a18..dedb8ab 100644 (file)
@@ -1,3 +1,24 @@
+2019-03-05  Loïc Yhuel  <loic.yhuel@softathome.com>
+
+        [WPE] Do not create a PlatformDisplay in the Service Worker process
+        https://bugs.webkit.org/show_bug.cgi?id=194830
+
+        Reviewed by Žan Doberšek.
+
+        It avoids opening the Wayland socket in this WPEWebProcess, which might cause issues
+        depending on the platform, and allocates unneeded resources.
+
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode const):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h: Add new isServiceWorkerProcess parameter.
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::initializeNewWebProcess): Set isServiceWorkerProcess parameter.
+        * UIProcess/glib/WebProcessPoolGLib.cpp:
+        (WebKit::WebProcessPool::platformInitializeWebProcess): No implementationLibraryName and hostClientFileDescriptor for Service Worker.
+        * WebProcess/glib/WebProcessGLib.cpp:
+        (WebKit::WebProcess::platformInitializeWebProcess): No wpe_loader_init nor PlatformDisplayLibWPE for Service Worker.
+
 2019-03-04  Brady Eidson  <beidson@apple.com>
 
         Unreviewed, rolling out r242376.
index 3ecb1f1..1b6ec16 100644 (file)
@@ -161,6 +161,7 @@ void WebProcessCreationParameters::encode(IPC::Encoder& encoder) const
 #endif
 
 #if PLATFORM(WPE)
+    encoder << isServiceWorkerProcess;
     encoder << hostClientFileDescriptor;
     encoder << implementationLibraryName;
 #endif
@@ -427,6 +428,8 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat
 #endif
 
 #if PLATFORM(WPE)
+    if (!decoder.decode(parameters.isServiceWorkerProcess))
+        return false;
     if (!decoder.decode(parameters.hostClientFileDescriptor))
         return false;
     if (!decoder.decode(parameters.implementationLibraryName))
index 86f55e1..33a7830 100644 (file)
@@ -200,6 +200,7 @@ struct WebProcessCreationParameters {
 #endif
 
 #if PLATFORM(WPE)
+    bool isServiceWorkerProcess { false };
     IPC::Attachment hostClientFileDescriptor;
     CString implementationLibraryName;
 #endif
index 9c6b926..b7efa1c 100644 (file)
@@ -949,6 +949,10 @@ void WebProcessPool::initializeNewWebProcess(WebProcessProxy& process, WebsiteDa
     parameters.mediaMIMETypes = process.mediaMIMETypes();
 #endif
 
+#if PLATFORM(WPE)
+    parameters.isServiceWorkerProcess = process.isServiceWorkerProcess();
+#endif
+
     // Add any platform specific parameters
     platformInitializeWebProcess(parameters);
 
index 45d52e1..4417711 100644 (file)
@@ -95,8 +95,10 @@ void WebProcessPool::platformInitialize()
 void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
 {
 #if PLATFORM(WPE)
-    parameters.hostClientFileDescriptor = wpe_renderer_host_create_client();
-    parameters.implementationLibraryName = FileSystem::fileSystemRepresentation(wpe_loader_get_loaded_implementation_library_name());
+    if (!parameters.isServiceWorkerProcess) {
+        parameters.hostClientFileDescriptor = wpe_renderer_host_create_client();
+        parameters.implementationLibraryName = FileSystem::fileSystemRepresentation(wpe_loader_get_loaded_implementation_library_name());
+    }
 #endif
 
     parameters.memoryCacheDisabled = m_memoryCacheDisabled || cacheModel() == CacheModel::DocumentViewer;
index 192a117..fe896e2 100644 (file)
@@ -50,11 +50,14 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel)
 void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters&& parameters)
 {
 #if PLATFORM(WPE)
-    auto& implementationLibraryName = parameters.implementationLibraryName;
-    if (!implementationLibraryName.isNull() && implementationLibraryName.data()[0] != '\0')
-        wpe_loader_init(parameters.implementationLibraryName.data());
-    RELEASE_ASSERT(is<PlatformDisplayLibWPE>(PlatformDisplay::sharedDisplay()));
-    downcast<PlatformDisplayLibWPE>(PlatformDisplay::sharedDisplay()).initialize(parameters.hostClientFileDescriptor.releaseFileDescriptor());
+    if (!parameters.isServiceWorkerProcess) {
+        auto& implementationLibraryName = parameters.implementationLibraryName;
+        if (!implementationLibraryName.isNull() && implementationLibraryName.data()[0] != '\0')
+            wpe_loader_init(parameters.implementationLibraryName.data());
+
+        RELEASE_ASSERT(is<PlatformDisplayLibWPE>(PlatformDisplay::sharedDisplay()));
+        downcast<PlatformDisplayLibWPE>(PlatformDisplay::sharedDisplay()).initialize(parameters.hostClientFileDescriptor.releaseFileDescriptor());
+    }
 #endif
 #if PLATFORM(WAYLAND)
     m_waylandCompositorDisplay = WaylandCompositorDisplay::create(parameters.waylandCompositorDisplayName);