⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 290654 in webkit


Ignore:
Timestamp:
Mar 1, 2022, 10:12:13 AM (5 years ago)
Author:
jer.noble@apple.com
Message:

[Cocoa] Allow logging to be configured by NSDefaults (without regressing launch time)
​https://bugs.webkit.org/show_bug.cgi?id=237183

Reviewed by Darin Adler.

In r220780, code was added to WebProcessPoolCocoa to explicitly pass the results of a NSUserDefaults
to newly created WebContent processes to determine log channel levels. Later, in r232158, NSUserDefaults
were removed from the default logLevelString() implementations in WTF, WebCore, and WebKit to improve
process launch time performance. In r279796, the same technique sued in WebProcessPoolCocoa was added
to GPUProcessProxyCocoa to pass those log level strings to the GPUProcess. And then in r286484, all the
uses of NSUserDefaults were removed from WebProcessPoolCocoa and GPUProcessProxyCocoa were removed,
removing the ability to increase the log channel levels at runtime through NSUserDefualts.

Add back in the ability to define log levels for the UIProcess and all AuxiliaryProcesses without
regressing launch time by only checking the NSUserDefault once, only in the UIProcess, storing the result
in a static variable, and passing the results of that check to all AuxiliaryProcesses at creation time.

  • UIProcess/AuxiliaryProcessProxy.cpp:

(WebKit::AuxiliaryProcessProxy::auxiliaryProcessParameters):

  • UIProcess/Cocoa/UIProcessLogInitializationCocoa.mm: Added.

(WebKit::UIProcess::wtfLogLevelString):
(WebKit::UIProcess::webCoreLogLevelString):
(WebKit::UIProcess::webKitLogLevelString):

  • UIProcess/UIProcessLogInitialization.cpp: Added.

(WebKit::UIProcess::initializeLoggingIfNecessary):
(WebKit::UIProcess::wtfLogLevelString):
(WebKit::UIProcess::webCoreLogLevelString):
(WebKit::UIProcess::webKitLogLevelString):

  • UIProcess/UIProcessLogInitialization.h: Added.
  • UIProcess/WebProcessPool.cpp:
Location:
trunk/Source/WebKit
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r290653 r290654  
     12022-03-01  Jer Noble  <jer.noble@apple.com>
     2
     3        [Cocoa] Allow logging to be configured by NSDefaults (without regressing launch time)
     4        https://bugs.webkit.org/show_bug.cgi?id=237183
     5
     6        Reviewed by Darin Adler.
     7
     8        In r220780, code was added to WebProcessPoolCocoa to explicitly pass the results of a NSUserDefaults
     9        to newly created WebContent processes to determine log channel levels. Later, in r232158, NSUserDefaults
     10        were removed from the default logLevelString() implementations in WTF, WebCore, and WebKit to improve
     11        process launch time performance. In r279796, the same technique sued in WebProcessPoolCocoa was added
     12        to GPUProcessProxyCocoa to pass those log level strings to the GPUProcess. And then in r286484, all the
     13        uses of NSUserDefaults were removed from WebProcessPoolCocoa and GPUProcessProxyCocoa were removed,
     14        removing the ability to increase the log channel levels at runtime through NSUserDefualts.
     15
     16        Add back in the ability to define log levels for the UIProcess and all AuxiliaryProcesses without
     17        regressing launch time by only checking the NSUserDefault once, only in the UIProcess, storing the result
     18        in a static variable, and passing the results of that check to all AuxiliaryProcesses at creation time.
     19
     20        * UIProcess/AuxiliaryProcessProxy.cpp:
     21        (WebKit::AuxiliaryProcessProxy::auxiliaryProcessParameters):
     22        * UIProcess/Cocoa/UIProcessLogInitializationCocoa.mm: Added.
     23        (WebKit::UIProcess::wtfLogLevelString):
     24        (WebKit::UIProcess::webCoreLogLevelString):
     25        (WebKit::UIProcess::webKitLogLevelString):
     26        * UIProcess/UIProcessLogInitialization.cpp: Added.
     27        (WebKit::UIProcess::initializeLoggingIfNecessary):
     28        (WebKit::UIProcess::wtfLogLevelString):
     29        (WebKit::UIProcess::webCoreLogLevelString):
     30        (WebKit::UIProcess::webKitLogLevelString):
     31        * UIProcess/UIProcessLogInitialization.h: Added.
     32        * UIProcess/WebProcessPool.cpp:
     33
    1342022-03-01  Youenn Fablet  <youenn@apple.com>
    235
  • trunk/Source/WebKit/Sources.txt

    r290594 r290654  
    428428UIProcess/TextChecker.cpp
    429429UIProcess/TextCheckerCompletion.cpp
     430UIProcess/UIProcessLogInitialization.cpp
    430431UIProcess/UserMediaPermissionCheckProxy.cpp
    431432UIProcess/UserMediaPermissionRequestManagerProxy.cpp
  • trunk/Source/WebKit/SourcesCocoa.txt

    r289872 r290654  
    424424UIProcess/Cocoa/TextCheckingController.mm
    425425UIProcess/Cocoa/UIDelegate.mm
     426UIProcess/Cocoa/UIProcessLogInitializationCocoa.mm
    426427UIProcess/Cocoa/UIRemoteObjectRegistry.cpp
    427428UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp
  • trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp

    r286484 r290654  
    2828
    2929#include "AuxiliaryProcessMessages.h"
    30 #include "LogInitialization.h"
    3130#include "Logging.h"
     31#include "UIProcessLogInitialization.h"
    3232#include "WebPageProxy.h"
    3333#include "WebProcessProxy.h"
    34 #include <WebCore/LogInitialization.h>
    35 #include <wtf/LogInitialization.h>
    3634#include <wtf/RunLoop.h>
    3735
    … …  
    409407    AuxiliaryProcessCreationParameters parameters;
    410408#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
    411     parameters.wtfLoggingChannels = WTF::logLevelString();
    412     parameters.webCoreLoggingChannels = WebCore::logLevelString();
    413     parameters.webKitLoggingChannels = WebKit::logLevelString();
     409    parameters.wtfLoggingChannels = UIProcess::wtfLogLevelString();
     410    parameters.webCoreLoggingChannels = UIProcess::webCoreLogLevelString();
     411    parameters.webKitLoggingChannels = UIProcess::webKitLogLevelString();
    414412#endif
    415413    return parameters;
  • trunk/Source/WebKit/UIProcess/WebProcessPool.cpp

    r290552 r290654  
    4646#include "HighPerformanceGraphicsUsageSampler.h"
    4747#include "LegacyGlobalSettings.h"
    48 #include "LogInitialization.h"
    4948#include "Logging.h"
    5049#include "NetworkProcessCreationParameters.h"
    … …  
    5756#include "UIGamepad.h"
    5857#include "UIGamepadProvider.h"
     58#include "UIProcessLogInitialization.h"
    5959#include "WKContextPrivate.h"
    6060#include "WebAutomationSession.h"
    … …  
    8686#include <JavaScriptCore/JSCInlines.h>
    8787#include <WebCore/ApplicationCacheStorage.h>
    88 #include <WebCore/LogInitialization.h>
    8988#include <WebCore/MockRealtimeMediaSourceCenter.h>
    9089#include <WebCore/NetworkStorageSession.h>
    … …  
    9897#include <pal/SessionID.h>
    9998#include <wtf/CallbackAggregator.h>
    100 #include <wtf/LogInitialization.h>
    10199#include <wtf/MainThread.h>
    102100#include <wtf/NeverDestroyed.h>
    … …  
    270268
    271269#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
    272     WTF::logChannels().initializeLogChannelsIfNecessary();
    273     WebCore::logChannels().initializeLogChannelsIfNecessary();
    274     WebKit::logChannels().initializeLogChannelsIfNecessary();
     270    UIProcess::initializeLoggingIfNecessary();
    275271#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
    276272
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r290594 r290654  
    62666266                CD8252E125D4918500862FD8 /* RemoteRemoteCommandListenerMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteRemoteCommandListenerMessages.h; sourceTree = "<group>"; };
    62676267                CD95493526159004008372D9 /* libWebKitSwift.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libWebKitSwift.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
     6268                CD9A649F27C8972C003827C0 /* UIProcessLogInitialization.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIProcessLogInitialization.h; sourceTree = "<group>"; };
     6269                CD9A64A027C8972C003827C0 /* UIProcessLogInitialization.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UIProcessLogInitialization.cpp; sourceTree = "<group>"; };
     6270                CD9A64A127C89742003827C0 /* UIProcessLogInitializationCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UIProcessLogInitializationCocoa.mm; sourceTree = "<group>"; };
    62686271                CDA041F31ACE2105004A13EC /* BackBoardServicesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackBoardServicesSPI.h; sourceTree = "<group>"; };
    62696272                CDA29A181CBDBF4100901CCF /* PlaybackSessionManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlaybackSessionManager.mm; sourceTree = "<group>"; };
    … …  
    76327635                                1AFE436418B6C081009C7A48 /* UIDelegate.h */,
    76337636                                1AFE436318B6C081009C7A48 /* UIDelegate.mm */,
     7637                                CD9A64A127C89742003827C0 /* UIProcessLogInitializationCocoa.mm */,
    76347638                                463236862314833F00A48FA7 /* UIRemoteObjectRegistry.cpp */,
    76357639                                463236852314833F00A48FA7 /* UIRemoteObjectRegistry.h */,
    … …  
    1115711161                                53CFBBC62224D1B000266546 /* TextCheckerCompletion.cpp */,
    1115811162                                53CFBBC72224D1B000266546 /* TextCheckerCompletion.h */,
     11163                                CD9A64A027C8972C003827C0 /* UIProcessLogInitialization.cpp */,
     11164                                CD9A649F27C8972C003827C0 /* UIProcessLogInitialization.h */,
    1115911165                                07297F9C1C17BBEA003F0735 /* UserMediaPermissionCheckProxy.cpp */,
    1116011166                                07297F9D1C17BBEA003F0735 /* UserMediaPermissionCheckProxy.h */,
Note: See TracChangeset for help on using the changeset viewer.