Changeset 265774 in webkit


Ignore:
Timestamp:
Aug 17, 2020 2:54:42 PM (4 years ago)
Author:
pvollan@apple.com
Message:

[Cocoa] Avoid waiting for Launch Services on every load
https://bugs.webkit.org/show_bug.cgi?id=215569

Reviewed by Darin Adler.

Currently, we are waiting for the Launch Services database to be present on every load in the WebContent process.
It should be sufficient to wait only on the first load. Since we now are waiting only once per WebContent process,
increase the maximum wait time from 1s to 5s.

No new tests, covered by existing tests.

  • WebProcess/WebPage/Cocoa/WebPageCocoa.mm:

(WebKit::WebPage::platformDidReceiveLoadParameters):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r265761 r265774  
     12020-08-17  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [Cocoa] Avoid waiting for Launch Services on every load
     4        https://bugs.webkit.org/show_bug.cgi?id=215569
     5
     6        Reviewed by Darin Adler.
     7
     8        Currently, we are waiting for the Launch Services database to be present on every load in the WebContent process.
     9        It should be sufficient to wait only on the first load. Since we now are waiting only once per WebContent process,
     10        increase the maximum wait time from 1s to 5s.
     11
     12        No new tests, covered by existing tests.
     13
     14        * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
     15        (WebKit::WebPage::platformDidReceiveLoadParameters):
     16
    1172020-08-17  Jer Noble  <jer.noble@apple.com>
    218
  • trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm

    r265427 r265774  
    6666{
    6767#if HAVE(LSDATABASECONTEXT)
    68     auto startTime = WallTime::now();
    69     bool databaseUpdated = LaunchServicesDatabaseManager::singleton().waitForDatabaseUpdate(1_s);
    70     auto elapsedTime = WallTime::now() - startTime;
    71     if (elapsedTime.value() > 0.5)
    72         RELEASE_LOG(Loading, "Waiting for Launch Services database update took %f seconds", elapsedTime.value());
    73     ASSERT_UNUSED(databaseUpdated, databaseUpdated);
    74     if (!databaseUpdated)
    75         RELEASE_LOG_ERROR(Loading, "Timed out waiting for Launch Services database update.");
     68    static bool hasWaitedForLaunchServicesDatabase = false;
     69    if (!hasWaitedForLaunchServicesDatabase) {
     70        auto startTime = WallTime::now();
     71        bool databaseUpdated = LaunchServicesDatabaseManager::singleton().waitForDatabaseUpdate(5_s);
     72        auto elapsedTime = WallTime::now() - startTime;
     73        if (elapsedTime.value() > 0.5)
     74            RELEASE_LOG(Loading, "Waiting for Launch Services database update took %f seconds", elapsedTime.value());
     75        ASSERT_UNUSED(databaseUpdated, databaseUpdated);
     76        if (!databaseUpdated)
     77            RELEASE_LOG_ERROR(Loading, "Timed out waiting for Launch Services database update.");
     78        hasWaitedForLaunchServicesDatabase = true;
     79    }
    7680#endif
    7781
Note: See TracChangeset for help on using the changeset viewer.