Title: [224806] trunk/Source
Revision
224806
Author
[email protected]
Date
2017-11-13 23:34:06 -0800 (Mon, 13 Nov 2017)

Log Message

Give a ServiceWorker WebContentProcess a different display name
https://bugs.webkit.org/show_bug.cgi?id=179653

Patch by Joseph Pecoraro <[email protected]> on 2017-11-13
Reviewed by Brady Eidson.

Source/WebCore:

* English.lproj/Localizable.strings:

Source/WebKit:

* UIProcess/WebProcessProxy.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::create):
Call connect after construction so virtual methods will use subclass implementations.

* UIProcess/ServiceWorkerProcessProxy.h:
* UIProcess/ServiceWorkerProcessProxy.cpp:
(WebKit::ServiceWorkerProcessProxy::create):
Copy the pattern from WebProcessProxy to ensure connect() gets called after construction.

(WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
Set a launch option to signal this is a Service Worker process.

* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::initializeProcessName):
Consume the launch option to configuration the process name.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224805 => 224806)


--- trunk/Source/WebCore/ChangeLog	2017-11-14 07:26:35 UTC (rev 224805)
+++ trunk/Source/WebCore/ChangeLog	2017-11-14 07:34:06 UTC (rev 224806)
@@ -1,3 +1,12 @@
+2017-11-13  Joseph Pecoraro  <[email protected]>
+
+        Give a ServiceWorker WebContentProcess a different display name
+        https://bugs.webkit.org/show_bug.cgi?id=179653
+
+        Reviewed by Brady Eidson.
+
+        * English.lproj/Localizable.strings:
+
 2017-11-13  Chris Dumez  <[email protected]>
 
         Send ServiceWorkerData structs to the WebProcesses instead of ServiceWorkerIdentifiers

Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (224805 => 224806)


--- trunk/Source/WebCore/English.lproj/Localizable.strings	2017-11-14 07:26:35 UTC (rev 224805)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings	2017-11-14 07:34:06 UTC (rev 224806)
@@ -40,6 +40,9 @@
 /* Text track contains subtitles for the deaf and hard of hearing */
 "%@ SDH" = "%@ SDH";
 
+/* Visible name of Service Worker process. The argument is the application name. */
+"%@ Service Worker" = "%@ Service Worker";
+
 /* visible name of the storage process. The argument is the application name. */
 "%@ Storage" = "%@ Storage";
 

Modified: trunk/Source/WebKit/ChangeLog (224805 => 224806)


--- trunk/Source/WebKit/ChangeLog	2017-11-14 07:26:35 UTC (rev 224805)
+++ trunk/Source/WebKit/ChangeLog	2017-11-14 07:34:06 UTC (rev 224806)
@@ -1,3 +1,29 @@
+2017-11-13  Joseph Pecoraro  <[email protected]>
+
+        Give a ServiceWorker WebContentProcess a different display name
+        https://bugs.webkit.org/show_bug.cgi?id=179653
+
+        Reviewed by Brady Eidson.
+
+        * UIProcess/WebProcessProxy.h:
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::create):
+        Call connect after construction so virtual methods will use subclass implementations.
+
+        * UIProcess/ServiceWorkerProcessProxy.h:
+        * UIProcess/ServiceWorkerProcessProxy.cpp:
+        (WebKit::ServiceWorkerProcessProxy::create):
+        Copy the pattern from WebProcessProxy to ensure connect() gets called after construction.
+
+        (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
+        Set a launch option to signal this is a Service Worker process.
+
+        * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
+        (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::initializeProcessName):
+        Consume the launch option to configuration the process name.
+
 2017-11-13  Ryosuke Niwa  <[email protected]>
 
         REGRESSION(r224799): WebKit crashes at launch on macOS Sierra due to a sandbox violation

Modified: trunk/Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm (224805 => 224806)


--- trunk/Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm	2017-11-14 07:26:35 UTC (rev 224805)
+++ trunk/Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm	2017-11-14 07:34:06 UTC (rev 224806)
@@ -97,6 +97,12 @@
     if (!inspectorProcess.isEmpty())
         extraInitializationData.add(ASCIILiteral("inspector-process"), inspectorProcess);
 
+#if ENABLE(SERVICE_WORKER)
+    String serviceWorkerProcess = xpc_dictionary_get_string(extraDataInitializationDataObject, "service-worker-process");
+    if (!serviceWorkerProcess.isEmpty())
+        extraInitializationData.add(ASCIILiteral("service-worker-process"), serviceWorkerProcess);
+#endif
+
     if (!isClientSandboxed()) {
         String userDirectorySuffix = xpc_dictionary_get_string(extraDataInitializationDataObject, "user-directory-suffix");
         if (!userDirectorySuffix.isEmpty())

Modified: trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp (224805 => 224806)


--- trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp	2017-11-14 07:26:35 UTC (rev 224805)
+++ trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp	2017-11-14 07:34:06 UTC (rev 224806)
@@ -35,6 +35,13 @@
 
 namespace WebKit {
 
+Ref<ServiceWorkerProcessProxy> ServiceWorkerProcessProxy::create(WebProcessPool& pool, WebsiteDataStore& store)
+{
+    auto proxy = adoptRef(*new ServiceWorkerProcessProxy { pool, store });
+    proxy->connect();
+    return proxy;
+}
+
 ServiceWorkerProcessProxy::ServiceWorkerProcessProxy(WebProcessPool& pool, WebsiteDataStore& store)
     : WebProcessProxy { pool, store }
     , m_serviceWorkerPageID(generatePageID())
@@ -45,6 +52,13 @@
 {
 }
 
+void ServiceWorkerProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions)
+{
+    WebProcessProxy::getLaunchOptions(launchOptions);
+
+    launchOptions.extraInitializationData.add(ASCIILiteral("service-worker-process"), ASCIILiteral("1"));
+}
+
 void ServiceWorkerProcessProxy::start(const WebPreferencesStore& store)
 {
     send(Messages::WebProcess::GetWorkerContextConnection(m_serviceWorkerPageID, store), 0);

Modified: trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h (224805 => 224806)


--- trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h	2017-11-14 07:26:35 UTC (rev 224805)
+++ trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h	2017-11-14 07:34:06 UTC (rev 224806)
@@ -33,10 +33,7 @@
 
 class ServiceWorkerProcessProxy final : public WebProcessProxy {
 public:
-    static Ref<ServiceWorkerProcessProxy> create(WebProcessPool& pool, WebsiteDataStore& store)
-    {
-        return adoptRef(*new ServiceWorkerProcessProxy { pool, store });
-    }
+    static Ref<ServiceWorkerProcessProxy> create(WebProcessPool&, WebsiteDataStore&);
     ~ServiceWorkerProcessProxy();
 
     void didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, Ref<AuthenticationChallengeProxy>&&);
@@ -44,6 +41,10 @@
     void start(const WebPreferencesStore&);
     uint64_t pageID() const { return m_serviceWorkerPageID; }
 
+protected:
+    // ChildProcessProxy
+    void getLaunchOptions(ProcessLauncher::LaunchOptions&) final;
+
 private:
     ServiceWorkerProcessProxy(WebProcessPool&, WebsiteDataStore&);
     uint64_t m_serviceWorkerPageID { 0 };

Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (224805 => 224806)


--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp	2017-11-14 07:26:35 UTC (rev 224805)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp	2017-11-14 07:34:06 UTC (rev 224806)
@@ -92,7 +92,9 @@
 
 Ref<WebProcessProxy> WebProcessProxy::create(WebProcessPool& processPool, WebsiteDataStore& websiteDataStore)
 {
-    return adoptRef(*new WebProcessProxy(processPool, websiteDataStore));
+    auto proxy = adoptRef(*new WebProcessProxy(processPool, websiteDataStore));
+    proxy->connect();
+    return proxy;
 }
 
 WebProcessProxy::WebProcessProxy(WebProcessPool& processPool, WebsiteDataStore& websiteDataStore)
@@ -111,8 +113,6 @@
 #endif
 {
     WebPasteboardProxy::singleton().addWebProcessProxy(*this);
-
-    connect();
 }
 
 WebProcessProxy::~WebProcessProxy()

Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (224805 => 224806)


--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h	2017-11-14 07:26:35 UTC (rev 224805)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h	2017-11-14 07:34:06 UTC (rev 224806)
@@ -194,14 +194,14 @@
 
 protected:
     static uint64_t generatePageID();
-    explicit WebProcessProxy(WebProcessPool&, WebsiteDataStore&);
+    WebProcessProxy(WebProcessPool&, WebsiteDataStore&);
 
-private:
-    // From ChildProcessProxy
+    // ChildProcessProxy
     void getLaunchOptions(ProcessLauncher::LaunchOptions&) override;
     void connectionWillOpen(IPC::Connection&) override;
     void processWillShutDown(IPC::Connection&) override;
 
+private:
     // Called when the web process has crashed or we know that it will terminate soon.
     // Will potentially cause the WebProcessProxy object to be freed.
     void shutDown();

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (224805 => 224806)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2017-11-14 07:26:35 UTC (rev 224805)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2017-11-14 07:34:06 UTC (rev 224806)
@@ -171,6 +171,10 @@
     NSString *applicationName;
     if (parameters.extraInitializationData.get(ASCIILiteral("inspector-process")) == "1")
         applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Web Inspector", "Visible name of Web Inspector's web process. The argument is the application name."), (NSString *)parameters.uiProcessName];
+#if ENABLE(SERVICE_WORKER)
+    else if (parameters.extraInitializationData.get(ASCIILiteral("service-worker-process")) == "1")
+        applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Service Worker", "Visible name of Service Worker process. The argument is the application name."), (NSString *)parameters.uiProcessName];
+#endif
     else
         applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Web Content", "Visible name of the web process. The argument is the application name."), (NSString *)parameters.uiProcessName];
     _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey, (CFStringRef)applicationName, nullptr);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to