Changeset 293758 in webkit


Ignore:
Timestamp:
May 3, 2022 8:17:09 PM (2 years ago)
Author:
pvollan@apple.com
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):

Location:
trunk/Source/WebKit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r293757 r293758  
     12022-05-03  Per Arne Vollan  <pvollan@apple.com>
     2
     3        Add logging related to Launch Services database
     4        https://bugs.webkit.org/show_bug.cgi?id=240032
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        We have reports indicating that it can sometime take unexpectedly long time for the Network process to provide
     9        the Launch Services database to the WebContent and GPU process. Add some logging to help diagnose the issue.
     10        There are also some related selector response checks that can be removed now.
     11
     12        * NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm:
     13        (WebKit::LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver):
     14        (WebKit::LaunchServicesDatabaseObserver::startObserving):
     15        (WebKit::LaunchServicesDatabaseObserver::~LaunchServicesDatabaseObserver):
     16        (WebKit::databaseContext): Deleted.
     17        * UIProcess/Network/NetworkProcessProxy.cpp:
     18        (WebKit::NetworkProcessProxy::NetworkProcessProxy):
     19        (WebKit::NetworkProcessProxy::didFinishLaunching):
     20        * UIProcess/Network/NetworkProcessProxyCocoa.mm:
     21        (WebKit::NetworkProcessProxy::sendXPCEndpointToProcess):
     22        * WebProcess/cocoa/LaunchServicesDatabaseManager.mm:
     23        (WebKit::LaunchServicesDatabaseManager::handleEvent):
     24
    1252022-05-03  Yusuke Suzuki  <ysuzuki@apple.com>
    226
  • trunk/Source/WebKit/NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm

    r293744 r293758  
    3434namespace WebKit {
    3535
    36 #if HAVE(LSDATABASECONTEXT)
    37 static LSDatabaseContext *databaseContext()
    38 {
    39     static dispatch_once_t once;
    40     static LSDatabaseContext *context = nullptr;
    41     dispatch_once(&once, ^{
    42         context = [NSClassFromString(@"LSDatabaseContext") sharedDatabaseContext];
    43     });
    44     return context;
    45 }
    46 #endif
    47 
    4836LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver(NetworkProcess&)
    4937{
    5038#if HAVE(LSDATABASECONTEXT)
    51     if (![databaseContext() respondsToSelector:@selector(addDatabaseChangeObserver4WebKit:)])
    52         return;
    53 
    54     m_observer = [databaseContext() addDatabaseChangeObserver4WebKit:^(xpc_object_t change) {
     39    m_observer = [LSDatabaseContext.sharedDatabaseContext addDatabaseChangeObserver4WebKit:^(xpc_object_t change) {
    5540        auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
    5641        xpc_dictionary_set_string(message.get(), XPCEndpoint::xpcMessageNameKey, LaunchServicesDatabaseXPCConstants::xpcUpdateLaunchServicesDatabaseMessageName);
     
    7964
    8065#if HAVE(LSDATABASECONTEXT)
    81     if (![databaseContext() respondsToSelector:@selector(addDatabaseChangeObserver4WebKit:)]) {
    82         auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
    83         xpc_dictionary_set_string(message.get(), XPCEndpoint::xpcMessageNameKey, LaunchServicesDatabaseXPCConstants::xpcUpdateLaunchServicesDatabaseMessageName);
    84         xpc_connection_send_message(connection.get(), message.get());
    85         return;
    86     }
    87 
    88     RetainPtr<id> observer = [databaseContext() addDatabaseChangeObserver4WebKit:^(xpc_object_t change) {
     66    RetainPtr<id> observer = [LSDatabaseContext.sharedDatabaseContext addDatabaseChangeObserver4WebKit:^(xpc_object_t change) {
    8967        auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
    9068        xpc_dictionary_set_string(message.get(), XPCEndpoint::xpcMessageNameKey, LaunchServicesDatabaseXPCConstants::xpcUpdateLaunchServicesDatabaseMessageName);
     
    9472    }];
    9573
    96     [databaseContext() removeDatabaseChangeObserver4WebKit:observer.get()];
     74    [LSDatabaseContext.sharedDatabaseContext removeDatabaseChangeObserver4WebKit:observer.get()];
    9775#else
    9876    auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
     
    10583{
    10684#if HAVE(LSDATABASECONTEXT)
    107     if (![databaseContext() respondsToSelector:@selector(removeDatabaseChangeObserver4WebKit:)])
    108         return;
    109 
    110     [databaseContext() removeDatabaseChangeObserver4WebKit:m_observer.get()];
     85    [LSDatabaseContext.sharedDatabaseContext removeDatabaseChangeObserver4WebKit:m_observer.get()];
    11186#endif
    11287}
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp

    r293744 r293758  
    242242    , m_cookieManager(makeUniqueRef<WebCookieManagerProxy>(*this))
    243243{
     244    RELEASE_LOG(Process, "%p - NetworkProcessProxy::NetworkProcessProxy", this);
     245
    244246    connect();
    245247    sendCreationParametersToNewProcess();
     
    550552void NetworkProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Connection::Identifier connectionIdentifier)
    551553{
     554    RELEASE_LOG(Process, "%p - NetworkProcessProxy::didFinishLaunching", this);
     555
    552556    AuxiliaryProcessProxy::didFinishLaunching(launcher, connectionIdentifier);
    553557
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm

    r293744 r293758  
    8181bool NetworkProcessProxy::sendXPCEndpointToProcess(AuxiliaryProcessProxy& process)
    8282{
     83    RELEASE_LOG(Process, "%p - NetworkProcessProxy::sendXPCEndpointToProcess(%p) state = %d has connection = %d XPC endpoint message = %p", this, &process, process.state(), process.hasConnection(), xpcEndpointMessage());
     84
    8385    if (process.state() != AuxiliaryProcessProxy::State::Running)
    8486        return false;
    85     auto* connection = process.connection();
    86     if (!connection)
     87    if (!process.hasConnection())
    8788        return false;
    8889    auto message = xpcEndpointMessage();
    8990    if (!message)
    9091        return false;
    91     xpc_connection_send_message(connection->xpcConnection(), message);
     92    auto xpcConnection = process.connection()->xpcConnection();
     93    RELEASE_ASSERT(xpcConnection);
     94    xpc_connection_send_message(xpcConnection, message);
    9295    return true;
    9396}
  • trunk/Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm

    r293744 r293758  
    5050        auto database = xpc_dictionary_get_value(message, LaunchServicesDatabaseXPCConstants::xpcLaunchServicesDatabaseKey);
    5151
    52         if (database) {
    53             auto context = [NSClassFromString(@"LSDatabaseContext") sharedDatabaseContext];
    54             if (![context respondsToSelector:@selector(observeDatabaseChange4WebKit:)])
    55                 return;
    56             [context observeDatabaseChange4WebKit:database];
    57         }
     52        RELEASE_LOG(Loading, "Received Launch Services database %p", database);
     53
     54        if (database)
     55            [LSDatabaseContext.sharedDatabaseContext observeDatabaseChange4WebKit:database];
    5856#endif
    5957        m_semaphore.signal();
Note: See TracChangeset for help on using the changeset viewer.