Skip to content

Commit

Permalink
Replace log object prewarming with call to topPrivatelyControlledDomain
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=258949
rdar://111873538

Reviewed by Brent Fulgham.

Instead of directly creating and prewarming log objects, call topPrivatelyControlledDomain which will
cause the same container manager log objects to be created. This appears to be a further, small
improvement in page load performance.

* Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::prewarmLogs):

Canonical link: https://commits.webkit.org/265838@main
  • Loading branch information
pvollan committed Jul 7, 2023
1 parent dbef4cf commit f51b379
Showing 1 changed file with 9 additions and 27 deletions.
36 changes: 9 additions & 27 deletions Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
#import <WebCore/PlatformMediaSessionManager.h>
#import <WebCore/PlatformScreen.h>
#import <WebCore/ProcessCapabilities.h>
#import <WebCore/PublicSuffix.h>
#import <WebCore/RuntimeApplicationChecks.h>
#import <WebCore/SWContextManager.h>
#import <WebCore/SystemBattery.h>
Expand Down Expand Up @@ -716,41 +717,22 @@ NEVER_INLINE NO_RETURN_DUE_TO_CRASH static void deliberateCrashForTesting()
#if ENABLE(LOGD_BLOCKING_IN_WEBCONTENT)
static void prewarmLogs()
{
static std::array<std::pair<const char*, const char*>, 29> logs { {
// This call will create container manager log objects.
// FIXME: this can be removed if we move all calls to topPrivatelyControlledDomain out of the WebContent process.
// This would be desirable, since the WebContent process is blocking access to the container manager daemon.
topPrivatelyControlledDomain("apple.com"_s);

static std::array<std::pair<const char*, const char*>, 5> logs { {
{ "com.apple.CFBundle", "strings" },
{ "com.apple.containermanager", "unspecified" },
{ "com.apple.containermanager", "cache" },
{ "com.apple.containermanager", "sandbox" },
{ "com.apple.containermanager", "xpc" },
{ "com.apple.containermanager", "query" },
{ "com.apple.containermanager", "paths" },
{ "com.apple.containermanager", "locking" },
{ "com.apple.containermanager", "database" },
{ "com.apple.containermanager", "upcall" },
{ "com.apple.containermanager", "lifecycle" },
{ "com.apple.containermanager", "fs" },
{ "com.apple.containermanager", "startup" },
{ "com.apple.containermanager", "test" },
{ "com.apple.containermanager", "metadata" },
{ "com.apple.containermanager", "codesignmapping" },
{ "com.apple.containermanager", "longterm" },
{ "com.apple.containermanager", "schema" },
{ "com.apple.containermanager", "codesign" },
{ "com.apple.containermanager", "repair" },
{ "com.apple.containermanager", "disk" },
{ "com.apple.containermanager", "persona" },
{ "com.apple.containermanager", "command" },
{ "com.apple.containermanager", "telemetry" },
{ "com.apple.network", "" },
{ "com.apple.CFNetwork", "ATS" },
{ "com.apple.coremedia", "" },
{ "com.apple.coremedia", "" },
{ "com.apple.SafariShared", "Translation" },
} };

for (auto& log : logs) {
auto logHandle = os_log_create(log.first, log.second);
bool enabled = os_log_type_enabled(logHandle, OS_LOG_TYPE_ERROR);
auto logHandle = adoptOSObject(os_log_create(log.first, log.second));
bool enabled = os_log_type_enabled(logHandle.get(), OS_LOG_TYPE_ERROR);
UNUSED_PARAM(enabled);
}
}
Expand Down

0 comments on commit f51b379

Please sign in to comment.