haikuwebkit/Source/WTF/wtf/Logging.h

55 lines
1.9 KiB
C
Raw Permalink Normal View History

Support WTF logging channels https://bugs.webkit.org/show_bug.cgi?id=228768 Source/WebKit: Reviewed by Fujii Hironori. No new tests because there is no behavior change. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::initializeGPUProcess): * GPUProcess/GPUProcessCreationParameters.cpp: (WebKit::GPUProcessCreationParameters::encode const): (WebKit::GPUProcessCreationParameters::decode): * GPUProcess/GPUProcessCreationParameters.h: * Shared/AuxiliaryProcess.cpp: (WebKit::AuxiliaryProcess::initialize): * Shared/WebKit2Initialize.cpp: (WebKit::InitializeWebKit2): * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/GPUProcessProxyCocoa.mm: (WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters): * UIProcess/WebProcessPool.cpp: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Source/WebKitLegacy/mac: Reviewed by Fujii Hironori. * WebView/WebView.mm: (-[WebView _commonInitializationWithFrameName:groupName:]): Source/WTF: This patch builds on top of https://bugs.webkit.org/show_bug.cgi?id=228809, which added shared infrastructure for logging. This patch simply triggers that shared infrastructure for WTF. There is no change in behavior - the existing WTF logging channels currently are all implemented independently in custom ways, so this patch just migrates them over to use the shared infrastructure. Reviewed by Fujii Hironori. * WTF.xcodeproj/project.pbxproj: * wtf/Assertions.h: * wtf/CMakeLists.txt: * wtf/LogInitialization.cpp: Added. (WTF::logChannels): * wtf/LogInitialization.h: Added. * wtf/Logging.cpp: Added. * wtf/Logging.h: Added. * wtf/MemoryPressureHandler.cpp: (WTF::MemoryPressureHandler::singleton): * wtf/MemoryPressureHandler.h: * wtf/PlatformFTW.cmake: * wtf/PlatformGTK.cmake: * wtf/PlatformJSCOnly.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformPlayStation.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/RefCountedLeakCounter.cpp: * wtf/cocoa/LoggingCocoa.mm: Copied from Source/WebKit/UIProcess/Cocoa/GPUProcessProxyCocoa.mm. (WTF::logLevelString): * wtf/cocoa/MachSendRight.cpp: * wtf/cocoa/MainThreadCocoa.mm: * wtf/cocoa/MemoryPressureHandlerCocoa.mm: * wtf/unix/LoggingUnix.cpp: Added. (WTF::logLevelString): * wtf/win/LoggingWin.cpp: Added. (WTF::logLevelString): Canonical link: https://commits.webkit.org/240373@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280795 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-09 21:14:53 +00:00
/*
* Copyright (C) 2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include <wtf/Assertions.h>
#include <wtf/Forward.h>
namespace WTF {
#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
#ifndef LOG_CHANNEL_PREFIX
#define LOG_CHANNEL_PREFIX WTFLog
#endif
#define WTF_LOG_CHANNELS(M) \
Create a Language log channel https://bugs.webkit.org/show_bug.cgi?id=228764 Reviewed by Simon Fraser. Source/WebKit: * Platform/Logging.h: * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::setAppleLanguagesPreference): * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::setOverrideLanguages): (WebKit::WebProcessPool::initializeNewWebProcess): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::getLaunchOptions): * WebProcess/WebProcess.cpp: (WebKit::WebProcess::initializeWebProcess): (WebKit::WebProcess::userPreferredLanguagesChanged const): Source/WTF: There have been a variety of bug reports over the past months/years about the procedure by which we determine navigator.language. It's actually somewhat convoluted, so this patch adds a (debug) log channel for it so we can follow what it's doing easily. To enable all the logging, run these commands: % defaults write com.apple.WebKit.WebContent.Development WTFLogging Language % defaults write com.apple.WebKit.WebContent.Development WebKit2Logging Language % defaults write com.apple.WebKit.WebContent WTFLogging Language % defaults write com.apple.WebKit.WebContent WebKit2Logging Language % defaults write -g WTFLogging Language % defaults write -g WebKit2Logging Language % defaults write /Users/$USER/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist WTFLogging Language % defaults write /Users/$USER/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist WebKit2Logging Language * wtf/Language.cpp: (WTF::defaultLanguage): (WTF::overrideUserPreferredLanguages): (WTF::userPreferredLanguages): * wtf/Logging.cpp: * wtf/Logging.h: * wtf/cf/LanguageCF.cpp: (WTF::platformUserPreferredLanguages): * wtf/cocoa/LanguageCocoa.mm: (WTF::minimizedLanguagesFromLanguages): Canonical link: https://commits.webkit.org/240381@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280811 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-10 00:07:45 +00:00
M(Language) \
Support WTF logging channels https://bugs.webkit.org/show_bug.cgi?id=228768 Source/WebKit: Reviewed by Fujii Hironori. No new tests because there is no behavior change. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::initializeGPUProcess): * GPUProcess/GPUProcessCreationParameters.cpp: (WebKit::GPUProcessCreationParameters::encode const): (WebKit::GPUProcessCreationParameters::decode): * GPUProcess/GPUProcessCreationParameters.h: * Shared/AuxiliaryProcess.cpp: (WebKit::AuxiliaryProcess::initialize): * Shared/WebKit2Initialize.cpp: (WebKit::InitializeWebKit2): * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/GPUProcessProxyCocoa.mm: (WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters): * UIProcess/WebProcessPool.cpp: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Source/WebKitLegacy/mac: Reviewed by Fujii Hironori. * WebView/WebView.mm: (-[WebView _commonInitializationWithFrameName:groupName:]): Source/WTF: This patch builds on top of https://bugs.webkit.org/show_bug.cgi?id=228809, which added shared infrastructure for logging. This patch simply triggers that shared infrastructure for WTF. There is no change in behavior - the existing WTF logging channels currently are all implemented independently in custom ways, so this patch just migrates them over to use the shared infrastructure. Reviewed by Fujii Hironori. * WTF.xcodeproj/project.pbxproj: * wtf/Assertions.h: * wtf/CMakeLists.txt: * wtf/LogInitialization.cpp: Added. (WTF::logChannels): * wtf/LogInitialization.h: Added. * wtf/Logging.cpp: Added. * wtf/Logging.h: Added. * wtf/MemoryPressureHandler.cpp: (WTF::MemoryPressureHandler::singleton): * wtf/MemoryPressureHandler.h: * wtf/PlatformFTW.cmake: * wtf/PlatformGTK.cmake: * wtf/PlatformJSCOnly.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformPlayStation.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/RefCountedLeakCounter.cpp: * wtf/cocoa/LoggingCocoa.mm: Copied from Source/WebKit/UIProcess/Cocoa/GPUProcessProxyCocoa.mm. (WTF::logLevelString): * wtf/cocoa/MachSendRight.cpp: * wtf/cocoa/MainThreadCocoa.mm: * wtf/cocoa/MemoryPressureHandlerCocoa.mm: * wtf/unix/LoggingUnix.cpp: Added. (WTF::logLevelString): * wtf/win/LoggingWin.cpp: Added. (WTF::logLevelString): Canonical link: https://commits.webkit.org/240373@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280795 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-09 21:14:53 +00:00
M(RefCountedLeaks) \
M(Process) \
M(Threading) \
M(MemoryPressure) \
#undef DECLARE_LOG_CHANNEL
#define DECLARE_LOG_CHANNEL(name) \
WTF_EXPORT_PRIVATE extern WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name);
WTF_LOG_CHANNELS(DECLARE_LOG_CHANNEL)
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
} // namespace WTF