Title: [293743] trunk/Source/WebKit
Revision
293743
Author
pvol...@apple.com
Date
2022-05-03 15:23:23 -0700 (Tue, 03 May 2022)

Log Message

Add logging related to Launch Services database
https://bugs.webkit.org/show_bug.cgi?id=240032

Reviewed by Geoffrey Garen.

We have reports indicating that it can sometime take unexpectedly long time for the Network process to provide
the Launch Services database to the WebContent and GPU process. Add some logging to help diagnose the issue.
There are also some related selector response checks that can be removed now.

* NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm:
(WebKit::LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver):
(WebKit::LaunchServicesDatabaseObserver::startObserving):
(WebKit::LaunchServicesDatabaseObserver::~LaunchServicesDatabaseObserver):
(WebKit::databaseContext): Deleted.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::NetworkProcessProxy):
(WebKit::NetworkProcessProxy::didFinishLaunching):
* UIProcess/Network/NetworkProcessProxyCocoa.mm:
(WebKit::NetworkProcessProxy::sendXPCEndpointToProcess):
* WebProcess/cocoa/LaunchServicesDatabaseManager.mm:
(WebKit::LaunchServicesDatabaseManager::handleEvent):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (293742 => 293743)


--- trunk/Source/WebKit/ChangeLog	2022-05-03 22:10:46 UTC (rev 293742)
+++ trunk/Source/WebKit/ChangeLog	2022-05-03 22:23:23 UTC (rev 293743)
@@ -1,5 +1,29 @@
 2022-05-03  Per Arne Vollan  <pvol...@apple.com>
 
+        Add logging related to Launch Services database
+        https://bugs.webkit.org/show_bug.cgi?id=240032
+
+        Reviewed by Geoffrey Garen.
+
+        We have reports indicating that it can sometime take unexpectedly long time for the Network process to provide
+        the Launch Services database to the WebContent and GPU process. Add some logging to help diagnose the issue.
+        There are also some related selector response checks that can be removed now.
+
+        * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm:
+        (WebKit::LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver):
+        (WebKit::LaunchServicesDatabaseObserver::startObserving):
+        (WebKit::LaunchServicesDatabaseObserver::~LaunchServicesDatabaseObserver):
+        (WebKit::databaseContext): Deleted.
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::NetworkProcessProxy):
+        (WebKit::NetworkProcessProxy::didFinishLaunching):
+        * UIProcess/Network/NetworkProcessProxyCocoa.mm:
+        (WebKit::NetworkProcessProxy::sendXPCEndpointToProcess):
+        * WebProcess/cocoa/LaunchServicesDatabaseManager.mm:
+        (WebKit::LaunchServicesDatabaseManager::handleEvent):
+
+2022-05-03  Per Arne Vollan  <pvol...@apple.com>
+
         [iOS][WP] Only block IOKit access if all GPUP features are enabled
         https://bugs.webkit.org/show_bug.cgi?id=240010
 

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm (293742 => 293743)


--- trunk/Source/WebKit/NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm	2022-05-03 22:10:46 UTC (rev 293742)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm	2022-05-03 22:23:23 UTC (rev 293743)
@@ -33,25 +33,10 @@
 
 namespace WebKit {
 
-#if HAVE(LSDATABASECONTEXT)
-static LSDatabaseContext *databaseContext()
-{
-    static dispatch_once_t once;
-    static LSDatabaseContext *context = nullptr;
-    dispatch_once(&once, ^{
-        context = [NSClassFromString(@"LSDatabaseContext") sharedDatabaseContext];
-    });
-    return context;
-}
-#endif
-
 LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver(NetworkProcess&)
 {
 #if HAVE(LSDATABASECONTEXT)
-    if (![databaseContext() respondsToSelector:@selector(addDatabaseChangeObserver4WebKit:)])
-        return;
-
-    m_observer = [databaseContext() addDatabaseChangeObserver4WebKit:^(xpc_object_t change) {
+    m_observer = [LSDatabaseContext.sharedDatabaseContext addDatabaseChangeObserver4WebKit:^(xpc_object_t change) {
         auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
         xpc_dictionary_set_string(message.get(), XPCEndpoint::xpcMessageNameKey, LaunchServicesDatabaseXPCConstants::xpcUpdateLaunchServicesDatabaseMessageName);
         xpc_dictionary_set_value(message.get(), LaunchServicesDatabaseXPCConstants::xpcLaunchServicesDatabaseKey, change);
@@ -78,22 +63,15 @@
     }
 
 #if HAVE(LSDATABASECONTEXT)
-    if (![databaseContext() respondsToSelector:@selector(addDatabaseChangeObserver4WebKit:)]) {
+    RetainPtr<id> observer = [LSDatabaseContext.sharedDatabaseContext addDatabaseChangeObserver4WebKit:^(xpc_object_t change) {
         auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
         xpc_dictionary_set_string(message.get(), XPCEndpoint::xpcMessageNameKey, LaunchServicesDatabaseXPCConstants::xpcUpdateLaunchServicesDatabaseMessageName);
-        xpc_connection_send_message(connection.get(), message.get());
-        return;
-    }
-
-    RetainPtr<id> observer = [databaseContext() addDatabaseChangeObserver4WebKit:^(xpc_object_t change) {
-        auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
-        xpc_dictionary_set_string(message.get(), XPCEndpoint::xpcMessageNameKey, LaunchServicesDatabaseXPCConstants::xpcUpdateLaunchServicesDatabaseMessageName);
         xpc_dictionary_set_value(message.get(), LaunchServicesDatabaseXPCConstants::xpcLaunchServicesDatabaseKey, change);
 
         xpc_connection_send_message(connection.get(), message.get());
     }];
 
-    [databaseContext() removeDatabaseChangeObserver4WebKit:observer.get()];
+    [LSDatabaseContext.sharedDatabaseContext removeDatabaseChangeObserver4WebKit:observer.get()];
 #else
     auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
     xpc_dictionary_set_string(message.get(), XPCEndpoint::xpcMessageNameKey, LaunchServicesDatabaseXPCConstants::xpcUpdateLaunchServicesDatabaseMessageName);
@@ -104,10 +82,7 @@
 LaunchServicesDatabaseObserver::~LaunchServicesDatabaseObserver()
 {
 #if HAVE(LSDATABASECONTEXT)
-    if (![databaseContext() respondsToSelector:@selector(removeDatabaseChangeObserver4WebKit:)])
-        return;
-
-    [databaseContext() removeDatabaseChangeObserver4WebKit:m_observer.get()];
+    [LSDatabaseContext.sharedDatabaseContext removeDatabaseChangeObserver4WebKit:m_observer.get()];
 #endif
 }
 

Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (293742 => 293743)


--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp	2022-05-03 22:10:46 UTC (rev 293742)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp	2022-05-03 22:23:23 UTC (rev 293743)
@@ -241,6 +241,8 @@
     , m_throttler(*this, WebProcessPool::anyProcessPoolNeedsUIBackgroundAssertion())
     , m_cookieManager(makeUniqueRef<WebCookieManagerProxy>(*this))
 {
+    RELEASE_LOG(Process, "%p - NetworkProcessProxy::NetworkProcessProxy", this);
+
     connect();
     sendCreationParametersToNewProcess();
     updateProcessAssertion();
@@ -549,6 +551,8 @@
 
 void NetworkProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Connection::Identifier connectionIdentifier)
 {
+    RELEASE_LOG(Process, "%p - NetworkProcessProxy::didFinishLaunching", this);
+
     AuxiliaryProcessProxy::didFinishLaunching(launcher, connectionIdentifier);
 
     if (!IPC::Connection::identifierIsValid(connectionIdentifier)) {

Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm (293742 => 293743)


--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm	2022-05-03 22:10:46 UTC (rev 293742)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm	2022-05-03 22:23:23 UTC (rev 293743)
@@ -80,6 +80,8 @@
 
 bool NetworkProcessProxy::sendXPCEndpointToProcess(AuxiliaryProcessProxy& process)
 {
+    RELEASE_LOG(Process, "%p - NetworkProcessProxy::sendXPCEndpointToProcess(%p) state = %d connection = %p XPC endpoint message = %p", this, &process, process.state(), process.connection(), xpcEndpointMessage());
+
     if (process.state() != AuxiliaryProcessProxy::State::Running)
         return false;
     auto* connection = process.connection();

Modified: trunk/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm (293742 => 293743)


--- trunk/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm	2022-05-03 22:10:46 UTC (rev 293742)
+++ trunk/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm	2022-05-03 22:23:23 UTC (rev 293743)
@@ -49,12 +49,10 @@
 #if HAVE(LSDATABASECONTEXT)
         auto database = xpc_dictionary_get_value(message, LaunchServicesDatabaseXPCConstants::xpcLaunchServicesDatabaseKey);
 
-        if (database) {
-            auto context = [NSClassFromString(@"LSDatabaseContext") sharedDatabaseContext];
-            if (![context respondsToSelector:@selector(observeDatabaseChange4WebKit:)])
-                return;
-            [context observeDatabaseChange4WebKit:database];
-        }
+        RELEASE_LOG(Loading, "Received Launch Services database %p", database);
+
+        if (database)
+            [LSDatabaseContext.sharedDatabaseContext observeDatabaseChange4WebKit:database];
 #endif
         m_semaphore.signal();
         m_hasReceivedLaunchServicesDatabase = true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to