Diff
Modified: trunk/Source/WTF/ChangeLog (280755 => 280756)
--- trunk/Source/WTF/ChangeLog 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WTF/ChangeLog 2021-08-07 07:54:50 UTC (rev 280756)
@@ -1,3 +1,48 @@
+2021-08-07 Myles C. Maxfield <[email protected]>
+
+ Deduplicate logging channel algorithms
+ https://bugs.webkit.org/show_bug.cgi?id=228809
+
+ Reviewed by Fujii Hironori.
+
+ The current infrastructure (before this patch) had the following duplicated for each framework:
+ - A .cpp file declared the list of logging channels for that framework
+ - The .cpp file also had algorithms to search, modify, and initialize these logging channels
+
+ Each framework's .cpp file had duplicate algorithms. (The initialization algorithm was even
+ duplicated 3 times!)
+
+ Because the algorithms directly name their specific list of logging channels, a naive deduplication
+ would have had to add new parameters to these algorithms to pass in the appropriate framework's
+ list. That's fine, but this is exactly the sort of thing classes were designed for - classes are
+ an association of algorithms and data. The algorithms are shared but the data isn't, which really
+ just means we should have 3 instances of a shared class - one for the 3 sets of data.
+
+ So, this patch creates the LogChannels class which contains the deduplicated algorithms, and each
+ framework has a NeverDestroyed singleton instance of that class. There is a single virtual method
+ in the class, so the appropriate "default write" variable can be queried for each framework.
+
+ The instances cannot be declared in the Logging.h files in the frameworks, because certain WebKit2
+ files want to initialize all 3 instances of LogChannels, but you can't #include multiple Logging.h
+ files at the same time because their LOG_CHANNEL_PREFIX #defines will collide with each other.
+ Luckily, LogInitialization.h files exist exactly to solve this purpose, so that's where the
+ LogChannels instances are declared in. After this change, the Logging.h files are just for the
+ declarations of the logging channels themselves, and the LogInitialization.h files are for the
+ LogChannels instances which contain the searching/modifying/initializing algorithms on the list of
+ logging channels. If you just want to LOG(...) something, #include the relevant Logging.h file, and
+ if you want to search/modify/initialize across the entire list of channels, then #include the
+ relevant LogInitialization.h file.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/LogChannels.cpp: Copied from Source/WebCore/platform/Logging.cpp.
+ (WTF::LogChannels::isLogChannelEnabled):
+ (WTF::LogChannels::setLogChannelToAccumulate):
+ (WTF::LogChannels::clearAllLogChannelsToAccumulate):
+ (WTF::LogChannels::initializeLogChannelsIfNecessary):
+ (WTF::LogChannels::getLogChannel):
+ * wtf/LogChannels.h: Copied from Source/WebCore/platform/LogInitialization.h.
+
2021-08-05 Michael Catanzaro <[email protected]>
GCC 11 builds should use -Wno-array-bounds, -Wno-nonnull
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (280755 => 280756)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2021-08-07 07:54:50 UTC (rev 280756)
@@ -61,6 +61,7 @@
1C181C961D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp */; };
1C503BE623AAE0AE0072E66B /* LanguageCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C503BE523AAE0AE0072E66B /* LanguageCocoa.mm */; };
1CA85CA9241B0B260071C2F5 /* RuntimeApplicationChecksCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CA85CA8241B0B260071C2F5 /* RuntimeApplicationChecksCocoa.cpp */; };
+ 1CF18F3B26BB579E004B1722 /* LogChannels.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CF18F3926BB579E004B1722 /* LogChannels.cpp */; };
1FA47C8A152502DA00568D1B /* WebCoreThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1FA47C88152502DA00568D1B /* WebCoreThread.cpp */; };
2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CCD892915C0390200285083 /* GregorianDateTime.cpp */; };
2CDED0EF18115C38004DBA70 /* RunLoopCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0EE18115C38004DBA70 /* RunLoopCF.cpp */; };
@@ -351,6 +352,8 @@
1CCDB1491E566626006C73C0 /* TextBreakIteratorCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextBreakIteratorCF.h; sourceTree = "<group>"; };
1CCDB14D1E566898006C73C0 /* TextBreakIteratorICU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextBreakIteratorICU.h; sourceTree = "<group>"; };
1CCDB1511E566BC5006C73C0 /* CFStringSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFStringSPI.h; sourceTree = "<group>"; };
+ 1CF18F3926BB579E004B1722 /* LogChannels.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LogChannels.cpp; sourceTree = "<group>"; };
+ 1CF18F3A26BB579E004B1722 /* LogChannels.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LogChannels.h; sourceTree = "<group>"; };
1FA47C88152502DA00568D1B /* WebCoreThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreThread.cpp; sourceTree = "<group>"; };
1FA47C89152502DA00568D1B /* WebCoreThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreThread.h; sourceTree = "<group>"; };
24F1B248619F412296D1C19C /* RandomDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomDevice.h; sourceTree = "<group>"; };
@@ -512,8 +515,8 @@
9BB91F512648EA4D00A56217 /* CheckedPtr.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CheckedPtr.h; sourceTree = "<group>"; };
9BC70F04176C379D00101DEC /* AtomStringTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AtomStringTable.cpp; sourceTree = "<group>"; };
9BD8F40A176C2AD80002D865 /* AtomStringTable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AtomStringTable.h; sourceTree = "<group>"; };
+ 9BE153352671F00F00C7D096 /* WeakHashMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WeakHashMap.h; sourceTree = "<group>"; };
9BF00134267C4CCF00DCFB3F /* CheckedRef.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CheckedRef.h; sourceTree = "<group>"; };
- 9BE153352671F00F00C7D096 /* WeakHashMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WeakHashMap.h; sourceTree = "<group>"; };
9C67C542589348E285B49699 /* IndexedContainerIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexedContainerIterator.h; sourceTree = "<group>"; };
A1B89B87221E000F00EB4CEA /* SDKVariant.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = SDKVariant.xcconfig; sourceTree = "<group>"; };
A30D412C1F0DE0BA00B71954 /* SoftLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoftLinking.h; sourceTree = "<group>"; };
@@ -1122,6 +1125,8 @@
0F60F32E1DFCBD1B00416D6C /* LockedPrintStream.h */,
A8A472C3151A825A004123FF /* Locker.h */,
5311BD551EA7E15A00525281 /* LocklessBag.h */,
+ 1CF18F3926BB579E004B1722 /* LogChannels.cpp */,
+ 1CF18F3A26BB579E004B1722 /* LogChannels.h */,
93B5B45022171EE9004B7AA7 /* Logger.cpp */,
077CD86A1FD9CFD200828587 /* Logger.h */,
077CD86B1FD9CFD300828587 /* LoggerHelper.h */,
@@ -1738,6 +1743,7 @@
C2BCFC551F621F3F00C9222C /* LineEnding.cpp in Sources */,
0FE1646A1B6FFC9600400E7C /* Lock.cpp in Sources */,
0F60F32F1DFCBD1B00416D6C /* LockedPrintStream.cpp in Sources */,
+ 1CF18F3B26BB579E004B1722 /* LogChannels.cpp in Sources */,
93B5B45122171EEA004B7AA7 /* Logger.cpp in Sources */,
53534F2A1EC0E10E00141B2F /* MachExceptions.defs in Sources */,
7A6EBA3420746C34004F9C44 /* MachSendRight.cpp in Sources */,
Modified: trunk/Source/WTF/wtf/CMakeLists.txt (280755 => 280756)
--- trunk/Source/WTF/wtf/CMakeLists.txt 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WTF/wtf/CMakeLists.txt 2021-08-07 07:54:50 UTC (rev 280756)
@@ -123,6 +123,7 @@
LockedPrintStream.h
Locker.h
LocklessBag.h
+ LogChannels.h
Logger.h
LoggerHelper.h
LoggingAccumulator.h
@@ -422,6 +423,7 @@
LikelyDenseUnsignedIntegerSet.cpp
Lock.cpp
LockedPrintStream.cpp
+ LogChannels.cpp
Logger.cpp
MainThread.cpp
MediaTime.cpp
Copied: trunk/Source/WTF/wtf/LogChannels.cpp (from rev 280755, trunk/Source/WebCore/platform/Logging.cpp) (0 => 280756)
--- trunk/Source/WTF/wtf/LogChannels.cpp (rev 0)
+++ trunk/Source/WTF/wtf/LogChannels.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "LogChannels.h"
+
+#include <wtf/LoggingAccumulator.h>
+
+namespace WTF {
+
+#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
+
+bool LogChannels::isLogChannelEnabled(const String& name)
+{
+ WTFLogChannel* channel = WTFLogChannelByName(m_logChannels.data(), m_logChannels.size(), name.utf8().data());
+ if (!channel)
+ return false;
+ return channel->state != WTFLogChannelState::Off;
+}
+
+void LogChannels::setLogChannelToAccumulate(const String& name)
+{
+ WTFLogChannel* channel = WTFLogChannelByName(m_logChannels.data(), m_logChannels.size(), name.utf8().data());
+ if (!channel)
+ return;
+
+ channel->state = WTFLogChannelState::OnWithAccumulation;
+ m_logChannelsNeedInitialization = true;
+}
+
+void LogChannels::clearAllLogChannelsToAccumulate()
+{
+ resetAccumulatedLogs();
+ for (auto* channel : m_logChannels) {
+ if (channel->state == WTFLogChannelState::OnWithAccumulation)
+ channel->state = WTFLogChannelState::Off;
+ }
+
+ m_logChannelsNeedInitialization = true;
+}
+
+void LogChannels::initializeLogChannelsIfNecessary(std::optional<String> logChannelString)
+{
+ if (!m_logChannelsNeedInitialization && !logChannelString)
+ return;
+
+ m_logChannelsNeedInitialization = false;
+
+ String enabledChannelsString = logChannelString ? logChannelString.value() : logLevelString();
+ WTFInitializeLogChannelStatesFromString(m_logChannels.data(), m_logChannels.size(), enabledChannelsString.utf8().data());
+}
+
+WTFLogChannel* LogChannels::getLogChannel(const String& name)
+{
+ return WTFLogChannelByName(m_logChannels.data(), m_logChannels.size(), name.utf8().data());
+}
+
+#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
+
+} // namespace WTF
Copied: trunk/Source/WTF/wtf/LogChannels.h (from rev 280755, trunk/Source/WebCore/platform/LogInitialization.h) (0 => 280756)
--- trunk/Source/WTF/wtf/LogChannels.h (rev 0)
+++ trunk/Source/WTF/wtf/LogChannels.h 2021-08-07 07:54:50 UTC (rev 280756)
@@ -0,0 +1,55 @@
+/*
+ * 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 <optional>
+#include <wtf/Assertions.h>
+#include <wtf/Forward.h>
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
+
+class LogChannels {
+public:
+ virtual ~LogChannels() = default;
+ virtual String logLevelString() = 0;
+
+ bool isLogChannelEnabled(const String& name);
+ WTF_EXPORT_PRIVATE void setLogChannelToAccumulate(const String& name);
+ WTF_EXPORT_PRIVATE void clearAllLogChannelsToAccumulate();
+ WTF_EXPORT_PRIVATE void initializeLogChannelsIfNecessary(std::optional<String> = std::nullopt);
+ WTF_EXPORT_PRIVATE WTFLogChannel* getLogChannel(const String& name);
+
+protected:
+ Vector<WTFLogChannel*> m_logChannels;
+ bool m_logChannelsNeedInitialization { true };
+};
+
+#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
+
+} // namespace WTF
Modified: trunk/Source/WebCore/ChangeLog (280755 => 280756)
--- trunk/Source/WebCore/ChangeLog 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebCore/ChangeLog 2021-08-07 07:54:50 UTC (rev 280756)
@@ -1,3 +1,33 @@
+2021-08-07 Myles C. Maxfield <[email protected]>
+
+ Deduplicate logging channel algorithms
+ https://bugs.webkit.org/show_bug.cgi?id=228809
+
+ Reviewed by Fujii Hironori.
+
+ No new tests because there is no behavior change.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * accessibility/AXLogger.cpp:
+ * inspector/agents/page/PageConsoleAgent.cpp:
+ * page/Page.cpp:
+ * platform/LogInitialization.cpp: Copied from Source/WebCore/platform/LogInitialization.h.
+ (WebCore::logChannels):
+ (WebCore::getLogChannel):
+ * platform/LogInitialization.h:
+ * platform/Logging.cpp:
+ (WebCore::isLogChannelEnabled): Deleted.
+ (WebCore::setLogChannelToAccumulate): Deleted.
+ (WebCore::clearAllLogChannelsToAccumulate): Deleted.
+ (WebCore::initializeLogChannelsIfNecessary): Deleted.
+ (WebCore::getLogChannel): Deleted.
+ * platform/Logging.h:
+ * testing/js/WebCoreTestSupport.cpp:
+ (WebCoreTestSupport::setLogChannelToAccumulate):
+ (WebCoreTestSupport::clearAllLogChannelsToAccumulate):
+ (WebCoreTestSupport::initializeLogChannelsIfNecessary):
+
2021-08-06 Kate Cheney <[email protected]>
CrashTracer: com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::CryptoKeyRSA::exportJwk const
Modified: trunk/Source/WebCore/Sources.txt (280755 => 280756)
--- trunk/Source/WebCore/Sources.txt 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebCore/Sources.txt 2021-08-07 07:54:50 UTC (rev 280756)
@@ -1755,6 +1755,7 @@
platform/LengthPoint.cpp
platform/LengthSize.cpp
platform/LocalizedStrings.cpp
+platform/LogInitialization.cpp
platform/Logging.cpp
platform/LowPowerModeNotifier.cpp
platform/MIMETypeRegistry.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (280755 => 280756)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-08-07 07:54:50 UTC (rev 280756)
@@ -6977,6 +6977,7 @@
1CE8D12B2618616400FC3AEF /* DisplayListIterator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayListIterator.cpp; sourceTree = "<group>"; };
1CE8D12C2618616400FC3AEF /* DisplayListIterator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayListIterator.h; sourceTree = "<group>"; };
1CF0BFD42298706800ED2074 /* TextSizeAdjustment.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TextSizeAdjustment.cpp; sourceTree = "<group>"; };
+ 1CF18F3C26BB5AF2004B1722 /* LogInitialization.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LogInitialization.cpp; sourceTree = "<group>"; };
1CFAE3220A6D6A3F0032593D /* libobjc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libobjc.dylib; path = /usr/lib/libobjc.dylib; sourceTree = "<absolute>"; };
1D0026A22374D62300CA6CDF /* JSPictureInPictureWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPictureInPictureWindow.h; sourceTree = "<group>"; };
1D0026A32374D62400CA6CDF /* JSPictureInPictureWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPictureInPictureWindow.cpp; sourceTree = "<group>"; };
@@ -27587,6 +27588,7 @@
935207BD09BD410A00F2038D /* LocalizedStrings.h */,
A8239DFE09B3CF8A00B60641 /* Logging.cpp */,
A8239DFF09B3CF8A00B60641 /* Logging.h */,
+ 1CF18F3C26BB5AF2004B1722 /* LogInitialization.cpp */,
0FDCD7F21D47E655009F08BC /* LogInitialization.h */,
46EFAF0F1E5FB9E100E7F34B /* LowPowerModeNotifier.cpp */,
46EFAF101E5FB9E100E7F34B /* LowPowerModeNotifier.h */,
Modified: trunk/Source/WebCore/accessibility/AXLogger.cpp (280755 => 280756)
--- trunk/Source/WebCore/accessibility/AXLogger.cpp 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebCore/accessibility/AXLogger.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -36,6 +36,7 @@
#endif
#include "AXObjectCache.h"
#include "FrameView.h"
+#include "LogInitialization.h"
#include "Logging.h"
#include <wtf/text/TextStream.h>
Modified: trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.cpp (280755 => 280756)
--- trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.cpp 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -35,6 +35,7 @@
#include "CommandLineAPIHost.h"
#include "InspectorDOMAgent.h"
#include "InstrumentingAgents.h"
+#include "LogInitialization.h"
#include "Logging.h"
#include "Node.h"
#include "Page.h"
Modified: trunk/Source/WebCore/page/Page.cpp (280755 => 280756)
--- trunk/Source/WebCore/page/Page.cpp 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebCore/page/Page.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -83,6 +83,7 @@
#include "LegacySchemeRegistry.h"
#include "LibWebRTCProvider.h"
#include "LoaderStrategy.h"
+#include "LogInitialization.h"
#include "Logging.h"
#include "LowPowerModeNotifier.h"
#include "MediaCanStartListener.h"
Copied: trunk/Source/WebCore/platform/LogInitialization.cpp (from rev 280755, trunk/Source/WebCore/platform/LogInitialization.h) (0 => 280756)
--- trunk/Source/WebCore/platform/LogInitialization.cpp (rev 0)
+++ trunk/Source/WebCore/platform/LogInitialization.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2003-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.
+ */
+
+#include "config.h"
+#include "LogInitialization.h"
+
+#include "Logging.h"
+#include <wtf/LoggingAccumulator.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+
+
+#if PLATFORM(COCOA)
+#include <notify.h>
+#include <wtf/BlockPtr.h>
+#endif
+
+namespace WebCore {
+
+#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
+
+class LogChannels final : public WTF::LogChannels {
+public:
+ LogChannels()
+ {
+ m_logChannels = {
+ WEBCORE_LOG_CHANNELS(LOG_CHANNEL_ADDRESS)
+ };
+ }
+
+private:
+ String logLevelString() final
+ {
+ return WebCore::logLevelString();
+ }
+};
+
+WTF::LogChannels& logChannels()
+{
+ static NeverDestroyed<LogChannels> logChannels;
+ return logChannels.get();
+}
+
+WTFLogChannel* getLogChannel(const String& name)
+{
+ return logChannels().getLogChannel(name);
+}
+
+#else
+
+WTFLogChannel* getLogChannel(const String& name)
+{
+ return nullptr;
+}
+
+#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/platform/LogInitialization.h (280755 => 280756)
--- trunk/Source/WebCore/platform/LogInitialization.h 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebCore/platform/LogInitialization.h 2021-08-07 07:54:50 UTC (rev 280756)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2006, 2013, 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-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
@@ -25,8 +25,7 @@
#pragma once
-#include <wtf/Assertions.h>
-#include <wtf/Forward.h>
+#include <wtf/LogChannels.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -33,12 +32,11 @@
#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
-WEBCORE_EXPORT String logLevelString();
-bool isLogChannelEnabled(const String& name);
-WEBCORE_EXPORT void setLogChannelToAccumulate(const String& name);
-WEBCORE_EXPORT void clearAllLogChannelsToAccumulate();
-WEBCORE_EXPORT void initializeLogChannelsIfNecessary(std::optional<String> = std::nullopt);
+WEBCORE_EXPORT WTF::LogChannels& logChannels();
+String logLevelString();
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
+WEBCORE_EXPORT WTFLogChannel* getLogChannel(const String& name);
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/Logging.cpp (280755 => 280756)
--- trunk/Source/WebCore/platform/Logging.cpp 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebCore/platform/Logging.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -25,18 +25,7 @@
#include "config.h"
#include "Logging.h"
-#include "LogInitialization.h"
-#include <wtf/LoggingAccumulator.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
-
-#if PLATFORM(COCOA)
-#include <notify.h>
-#include <wtf/BlockPtr.h>
-#endif
-
namespace WebCore {
#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
@@ -44,67 +33,6 @@
#define DEFINE_WEBCORE_LOG_CHANNEL(name) DEFINE_LOG_CHANNEL(name, LOG_CHANNEL_WEBKIT_SUBSYSTEM)
WEBCORE_LOG_CHANNELS(DEFINE_WEBCORE_LOG_CHANNEL)
-static WTFLogChannel* logChannels[] = {
- WEBCORE_LOG_CHANNELS(LOG_CHANNEL_ADDRESS)
-};
-
-static const size_t logChannelCount = WTF_ARRAY_LENGTH(logChannels);
-
-bool isLogChannelEnabled(const String& name)
-{
- WTFLogChannel* channel = WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data());
- if (!channel)
- return false;
- return channel->state != WTFLogChannelState::Off;
-}
-
-static bool logChannelsNeedInitialization = true;
-
-void setLogChannelToAccumulate(const String& name)
-{
- WTFLogChannel* channel = WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data());
- if (!channel)
- return;
-
- channel->state = WTFLogChannelState::OnWithAccumulation;
- logChannelsNeedInitialization = true;
-}
-
-void clearAllLogChannelsToAccumulate()
-{
- resetAccumulatedLogs();
- for (auto* channel : logChannels) {
- if (channel->state == WTFLogChannelState::OnWithAccumulation)
- channel->state = WTFLogChannelState::Off;
- }
-
- logChannelsNeedInitialization = true;
-}
-
-void initializeLogChannelsIfNecessary(std::optional<String> logChannelString)
-{
- if (!logChannelsNeedInitialization && !logChannelString)
- return;
-
- logChannelsNeedInitialization = false;
-
- String enabledChannelsString = logChannelString ? logChannelString.value() : logLevelString();
- WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, enabledChannelsString.utf8().data());
-// LogEventLoop.state = WTFLogChannelState::On;
-}
-
-WTFLogChannel* getLogChannel(const String& name)
-{
- return WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data());
-}
-
-#else
-
-WTFLogChannel* getLogChannel(const String&)
-{
- return nullptr;
-}
-
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/Logging.h (280755 => 280756)
--- trunk/Source/WebCore/platform/Logging.h 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebCore/platform/Logging.h 2021-08-07 07:54:50 UTC (rev 280756)
@@ -133,6 +133,4 @@
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
-WEBCORE_EXPORT WTFLogChannel* getLogChannel(const String& name);
-
} // namespace WebCore
Modified: trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp (280755 => 280756)
--- trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -36,6 +36,7 @@
#include "JSServiceWorkerInternals.h"
#include "JSWorkerGlobalScope.h"
#include "LogInitialization.h"
+#include "Logging.h"
#include "MockGamepadProvider.h"
#include "Page.h"
#include "SWContextManager.h"
@@ -122,7 +123,7 @@
void setLogChannelToAccumulate(const String& name)
{
#if !LOG_DISABLED
- WebCore::setLogChannelToAccumulate(name);
+ logChannels().setLogChannelToAccumulate(name);
#else
UNUSED_PARAM(name);
#endif
@@ -131,7 +132,7 @@
void clearAllLogChannelsToAccumulate()
{
#if !LOG_DISABLED
- WebCore::clearAllLogChannelsToAccumulate();
+ logChannels().clearAllLogChannelsToAccumulate();
#endif
}
@@ -138,7 +139,7 @@
void initializeLogChannelsIfNecessary()
{
#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
- WebCore::initializeLogChannelsIfNecessary();
+ logChannels().initializeLogChannelsIfNecessary();
#endif
}
Modified: trunk/Source/WebKit/ChangeLog (280755 => 280756)
--- trunk/Source/WebKit/ChangeLog 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKit/ChangeLog 2021-08-07 07:54:50 UTC (rev 280756)
@@ -1,3 +1,32 @@
+2021-08-07 Myles C. Maxfield <[email protected]>
+
+ Deduplicate logging channel algorithms
+ https://bugs.webkit.org/show_bug.cgi?id=228809
+
+ Reviewed by Fujii Hironori.
+
+ * GPUProcess/GPUConnectionToWebProcess.cpp:
+ * GPUProcess/GPUProcess.cpp:
+ (WebKit::GPUProcess::initializeGPUProcess):
+ * Platform/LogInitialization.cpp: Copied from Source/WebKit/Shared/WebKit2Initialize.cpp.
+ (WebKit::logChannels):
+ (WebKit::getLogChannel):
+ * Platform/LogInitialization.h:
+ * Platform/Logging.cpp:
+ (WebKit::initializeLogChannelsIfNecessary): Deleted.
+ (WebKit::getLogChannel): Deleted.
+ * Platform/Logging.h:
+ * Shared/AuxiliaryProcess.cpp:
+ (WebKit::AuxiliaryProcess::initialize):
+ * Shared/WebKit2Initialize.cpp:
+ (WebKit::InitializeWebKit2):
+ * Sources.txt:
+ * UIProcess/WebPageProxy.cpp:
+ * UIProcess/WebProcessPool.cpp:
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::WebProcess::platformInitializeWebProcess):
+
2021-08-06 Simon Fraser <[email protected]>
Clarify some identifier naming in RemoteRenderingBackend
Modified: trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp (280755 => 280756)
--- trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -64,6 +64,7 @@
#include "WebCoreArgumentCoders.h"
#include "WebErrors.h"
#include "WebProcessMessages.h"
+#include <WebCore/LogInitialization.h>
#include <WebCore/Logging.h>
#include <WebCore/MockRealtimeMediaSourceCenter.h>
#include <WebCore/NowPlayingManager.h>
Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.cpp (280755 => 280756)
--- trunk/Source/WebKit/GPUProcess/GPUProcess.cpp 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -243,8 +243,8 @@
#endif
#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
- WebCore::initializeLogChannelsIfNecessary(parameters.webCoreLoggingChannels);
- WebKit::initializeLogChannelsIfNecessary(parameters.webKitLoggingChannels);
+ WebCore::logChannels().initializeLogChannelsIfNecessary(parameters.webCoreLoggingChannels);
+ WebKit::logChannels().initializeLogChannelsIfNecessary(parameters.webKitLoggingChannels);
#endif
// Match the QoS of the UIProcess since the GPU process is doing rendering on its behalf.
Copied: trunk/Source/WebKit/Platform/LogInitialization.cpp (from rev 280755, trunk/Source/WebKit/Shared/WebKit2Initialize.cpp) (0 => 280756)
--- trunk/Source/WebKit/Platform/LogInitialization.cpp (rev 0)
+++ trunk/Source/WebKit/Platform/LogInitialization.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -0,0 +1,72 @@
+/*
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#include "config.h"
+#include "LogInitialization.h"
+
+#include "Logging.h"
+#include <wtf/text/CString.h>
+
+namespace WebKit {
+
+#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
+
+class LogChannels final : public WTF::LogChannels {
+public:
+ LogChannels()
+ {
+ m_logChannels = {
+ WEBKIT2_LOG_CHANNELS(LOG_CHANNEL_ADDRESS)
+ };
+ }
+
+private:
+ String logLevelString() final
+ {
+ return WebKit::logLevelString();
+ }
+};
+
+WTF::LogChannels& logChannels()
+{
+ static NeverDestroyed<LogChannels> logChannels;
+ return logChannels.get();
+}
+
+WTFLogChannel* getLogChannel(const String& name)
+{
+ return logChannels().getLogChannel(name);
+}
+
+#else
+
+WTFLogChannel* getLogChannel(const String& name)
+{
+ return nullptr;
+}
+
+#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
+
+} // namespace WebKit
Modified: trunk/Source/WebKit/Platform/LogInitialization.h (280755 => 280756)
--- trunk/Source/WebKit/Platform/LogInitialization.h 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKit/Platform/LogInitialization.h 2021-08-07 07:54:50 UTC (rev 280756)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2013, 2016 Apple Inc. All rights reserved.
+ * 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
@@ -25,15 +25,18 @@
#pragma once
+#include <wtf/LogChannels.h>
#include <wtf/text/WTFString.h>
+namespace WebKit {
+
#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
-namespace WebKit {
-
-void initializeLogChannelsIfNecessary(std::optional<String> = std::nullopt);
+WTF::LogChannels& logChannels();
String logLevelString();
+#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
+
+WTFLogChannel* getLogChannel(const String& name);
+
} // namespace WebKit
-
-#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
Modified: trunk/Source/WebKit/Platform/Logging.cpp (280755 => 280756)
--- trunk/Source/WebKit/Platform/Logging.cpp 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKit/Platform/Logging.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
* Copyright (C) 2011 Samsung Electronics
*
* Redistribution and use in source and binary forms, with or without
@@ -26,40 +26,10 @@
#include "config.h"
#include "Logging.h"
-#include "LogInitialization.h"
-#include <wtf/text/CString.h>
-
#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
#define DEFINE_WEBKIT2_LOG_CHANNEL(name) DEFINE_LOG_CHANNEL(name, LOG_CHANNEL_WEBKIT_SUBSYSTEM)
WEBKIT2_LOG_CHANNELS(DEFINE_WEBKIT2_LOG_CHANNEL)
-static WTFLogChannel* logChannels[] = {
- WEBKIT2_LOG_CHANNELS(LOG_CHANNEL_ADDRESS)
-};
-
-namespace WebKit {
-
-static const size_t logChannelCount = WTF_ARRAY_LENGTH(logChannels);
-static bool logChannelsNeedInitialization = true;
-
-void initializeLogChannelsIfNecessary(std::optional<String> logChannelString)
-{
- if (!logChannelsNeedInitialization && !logChannelString)
- return;
-
- logChannelsNeedInitialization = false;
-
- String enabledChannelsString = logChannelString ? logChannelString.value() : logLevelString();
- WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, enabledChannelsString.utf8().data());
-}
-
-WTFLogChannel* getLogChannel(const String& name)
-{
- return WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data());
-}
-
-} // namespace WebKit
-
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
Modified: trunk/Source/WebKit/Platform/Logging.h (280755 => 280756)
--- trunk/Source/WebKit/Platform/Logging.h 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKit/Platform/Logging.h 2021-08-07 07:54:50 UTC (rev 280756)
@@ -112,13 +112,8 @@
#undef DECLARE_LOG_CHANNEL
-namespace WebKit {
-WTFLogChannel* getLogChannel(const String&);
-} // namespace WebKit
-
#ifdef __cplusplus
}
#endif
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
-
Modified: trunk/Source/WebKit/Shared/AuxiliaryProcess.cpp (280755 => 280756)
--- trunk/Source/WebKit/Shared/AuxiliaryProcess.cpp 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKit/Shared/AuxiliaryProcess.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -82,8 +82,8 @@
initializeSandbox(parameters, sandboxParameters);
#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
- WebCore::initializeLogChannelsIfNecessary();
- WebKit::initializeLogChannelsIfNecessary();
+ WebCore::logChannels().initializeLogChannelsIfNecessary();
+ WebKit::logChannels().initializeLogChannelsIfNecessary();
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
initializeProcessName(parameters);
Modified: trunk/Source/WebKit/Shared/WebKit2Initialize.cpp (280755 => 280756)
--- trunk/Source/WebKit/Shared/WebKit2Initialize.cpp 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKit/Shared/WebKit2Initialize.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -47,8 +47,8 @@
WTF::RefCountedBase::enableThreadingChecksGlobally();
#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
- WebCore::initializeLogChannelsIfNecessary();
- WebKit::initializeLogChannelsIfNecessary();
+ WebCore::logChannels().initializeLogChannelsIfNecessary();
+ WebKit::logChannels().initializeLogChannelsIfNecessary();
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
WebCore::populateJITOperations();
Modified: trunk/Source/WebKit/Sources.txt (280755 => 280756)
--- trunk/Source/WebKit/Sources.txt 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKit/Sources.txt 2021-08-07 07:54:50 UTC (rev 280756)
@@ -135,6 +135,7 @@
NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.cpp
// TODO: We should unify these files once GTK's PluginProcess2 is removed.
+Platform/LogInitialization.cpp @no-unify
Platform/Logging.cpp @no-unify
Platform/Module.cpp @no-unify
Platform/SharedMemory.cpp @no-unify
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (280755 => 280756)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -68,6 +68,7 @@
#include "FrameInfoData.h"
#include "LegacyGlobalSettings.h"
#include "LoadParameters.h"
+#include "LogInitialization.h"
#include "Logging.h"
#include "NativeWebGestureEvent.h"
#include "NativeWebKeyboardEvent.h"
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (280755 => 280756)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2021-08-07 07:54:50 UTC (rev 280756)
@@ -251,8 +251,8 @@
resolvePathsForSandboxExtensions();
#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
- WebCore::initializeLogChannelsIfNecessary();
- WebKit::initializeLogChannelsIfNecessary();
+ WebCore::logChannels().initializeLogChannelsIfNecessary();
+ WebKit::logChannels().initializeLogChannelsIfNecessary();
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
#ifndef NDEBUG
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (280755 => 280756)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-08-07 07:54:50 UTC (rev 280756)
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 52;
+ objectVersion = 54;
objects = {
/* Begin PBXAggregateTarget section */
@@ -441,6 +441,7 @@
1CA8B946127C882A00576C2B /* WebInspectorUIProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CA8B944127C882A00576C2B /* WebInspectorUIProxyMessages.h */; };
1CBBE4A019B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CBBE49E19B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp */; };
1CBBE4A119B66C53006B7D81 /* WebInspectorUIMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CBBE49F19B66C53006B7D81 /* WebInspectorUIMessages.h */; };
+ 1CF18F3F26BB5D95004B1722 /* LogInitialization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CF18F3E26BB5D90004B1722 /* LogInitialization.cpp */; };
1D4D737023A9E54700717A25 /* RemoteMediaResourceManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1D4D736B23A9DF5500717A25 /* RemoteMediaResourceManagerMessageReceiver.cpp */; };
1D4D737123A9E56200717A25 /* RemoteMediaResourceManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D4D736C23A9DF6000717A25 /* RemoteMediaResourceManagerMessages.h */; };
1D4D737623A9ED1800717A25 /* RemoteMediaResourceManagerMessagesReplies.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D4D737523A9EB6800717A25 /* RemoteMediaResourceManagerMessagesReplies.h */; };
@@ -3049,6 +3050,7 @@
1CA8B944127C882A00576C2B /* WebInspectorUIProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebInspectorUIProxyMessages.h; path = DerivedSources/WebKit2/WebInspectorUIProxyMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
1CBBE49E19B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebInspectorUIMessageReceiver.cpp; path = DerivedSources/WebKit2/WebInspectorUIMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
1CBBE49F19B66C53006B7D81 /* WebInspectorUIMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebInspectorUIMessages.h; path = DerivedSources/WebKit2/WebInspectorUIMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1CF18F3E26BB5D90004B1722 /* LogInitialization.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LogInitialization.cpp; sourceTree = "<group>"; };
1D0530C9258EAB4400E436F7 /* combine-feature-flags-plist.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = "combine-feature-flags-plist.py"; sourceTree = "<group>"; };
1D0530D1259162C800E436F7 /* WebKit-ios.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "WebKit-ios.plist"; sourceTree = "<group>"; };
1D0530D2259162C900E436F7 /* WebKit-appletvos.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "WebKit-appletvos.plist"; sourceTree = "<group>"; };
@@ -6000,7 +6002,6 @@
F40BBB40257FF46E0067463A /* GPUProcessWakeupMessageArguments.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUProcessWakeupMessageArguments.h; sourceTree = "<group>"; };
F40D1B68220BDC0F00B49A01 /* WebAutocorrectionContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WebAutocorrectionContext.h; path = ios/WebAutocorrectionContext.h; sourceTree = "<group>"; };
F41056612130699A0092281D /* APIAttachmentCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = APIAttachmentCocoa.mm; sourceTree = "<group>"; };
- F414CE2A269DDED100BD216A /* GPUProcessCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = GPUProcessCocoa.mm; path = cocoa/GPUProcessCocoa.mm; sourceTree = "<group>"; };
F414CE2C269DE6EA00BD216A /* RemoteRenderingBackendState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteRenderingBackendState.h; sourceTree = "<group>"; };
F42D633F22A0EFD300D2FB3A /* WebAutocorrectionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAutocorrectionData.h; path = ios/WebAutocorrectionData.h; sourceTree = "<group>"; };
F42D634022A0EFD300D2FB3A /* WebAutocorrectionData.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebAutocorrectionData.mm; path = ios/WebAutocorrectionData.mm; sourceTree = "<group>"; };
@@ -10697,6 +10698,7 @@
ECBFC1DB1E6A4D66000300C7 /* ExtraPublicSymbolsForTAPI.h */,
51A7F2F4125BF8D4008AEB1D /* Logging.cpp */,
51A7F2F2125BF820008AEB1D /* Logging.h */,
+ 1CF18F3E26BB5D90004B1722 /* LogInitialization.cpp */,
0FDCD7F61D47E92A009F08BC /* LogInitialization.h */,
C0E3AA451209E2BA00A49D01 /* Module.cpp */,
C0E3AA441209E2BA00A49D01 /* Module.h */,
@@ -11716,14 +11718,6 @@
path = cache;
sourceTree = "<group>";
};
- F414CE27269DDE8000BD216A /* cocoa */ = {
- isa = PBXGroup;
- children = (
- F414CE2A269DDED100BD216A /* GPUProcessCocoa.mm */,
- );
- name = cocoa;
- sourceTree = "<group>";
- };
F638955A133BF57D008941D5 /* mac */ = {
isa = PBXGroup;
children = (
@@ -14235,6 +14229,7 @@
51F060E11654318500F3281C /* LibWebRTCNetworkMessageReceiver.cpp in Sources */,
449D90DA21FDC30B00F677C0 /* LocalAuthenticationSoftLink.mm in Sources */,
2D92A779212B6A6100F493FD /* Logging.cpp in Sources */,
+ 1CF18F3F26BB5D95004B1722 /* LogInitialization.cpp in Sources */,
07E19EFB23D401F10094FFB4 /* MediaPlayerPrivateRemoteMessageReceiver.cpp in Sources */,
1DF29E64257F37A3003C28AF /* MediaSourcePrivateRemoteMessageReceiver.cpp in Sources */,
9B4790912531563200EC11AB /* MessageArgumentDescriptions.cpp in Sources */,
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (280755 => 280756)
--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2021-08-07 07:54:50 UTC (rev 280756)
@@ -281,8 +281,8 @@
}
#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
- WebCore::initializeLogChannelsIfNecessary(parameters.webCoreLoggingChannels);
- WebKit::initializeLogChannelsIfNecessary(parameters.webKitLoggingChannels);
+ WebCore::logChannels().initializeLogChannelsIfNecessary(parameters.webCoreLoggingChannels);
+ WebKit::logChannels().initializeLogChannelsIfNecessary(parameters.webKitLoggingChannels);
#endif
m_uiProcessBundleIdentifier = parameters.uiProcessBundleIdentifier;
Modified: trunk/Source/WebKitLegacy/ChangeLog (280755 => 280756)
--- trunk/Source/WebKitLegacy/ChangeLog 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKitLegacy/ChangeLog 2021-08-07 07:54:50 UTC (rev 280756)
@@ -1,3 +1,12 @@
+2021-08-07 Myles C. Maxfield <[email protected]>
+
+ Deduplicate logging channel algorithms
+ https://bugs.webkit.org/show_bug.cgi?id=228809
+
+ Reviewed by Fujii Hironori.
+
+ * WebKitLegacy.xcodeproj/project.pbxproj:
+
2021-08-02 Chris Dumez <[email protected]>
imported/w3c/web-platform-tests/webmessaging/broadcastchannel/blobs.html is a flaky failure since implementing BlobChannel
Modified: trunk/Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj (280755 => 280756)
--- trunk/Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj 2021-08-07 07:54:50 UTC (rev 280756)
@@ -111,6 +111,7 @@
1C68F672095B5FC100C2984E /* WebNodeHighlightView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C68F666095B5FC100C2984E /* WebNodeHighlightView.mm */; };
1C7B0C660EB2464D00A28502 /* WebInspectorClientCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C7B0C650EB2464D00A28502 /* WebInspectorClientCF.cpp */; };
1C8CB07A0AE9830C00B1F6E9 /* WebEditingDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8CB0790AE9830C00B1F6E9 /* WebEditingDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 1CF18F4126BB71B7004B1722 /* WebKitLogInitialization.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CF18F4026BB71B7004B1722 /* WebKitLogInitialization.mm */; };
22F219CC08D236730030E078 /* WebBackForwardListPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 22F219CB08D236730030E078 /* WebBackForwardListPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
29AEF960134C76FB00FE5096 /* OutlookQuirksUserScript.js in Resources */ = {isa = PBXBuildFile; fileRef = 29AEF95D134C755400FE5096 /* OutlookQuirksUserScript.js */; };
2D25396618CE85C200270222 /* WebSharingServicePickerController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D25396418CE85C200270222 /* WebSharingServicePickerController.h */; };
@@ -831,6 +832,8 @@
1C904FD30BA9DD0F0081E9D0 /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
1C904FD40BA9DD0F0081E9D0 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
1C904FD50BA9DD0F0081E9D0 /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
+ 1CF18F4026BB71B7004B1722 /* WebKitLogInitialization.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitLogInitialization.mm; sourceTree = "<group>"; };
+ 1CF18F4226BB71D3004B1722 /* WebKitLogInitialization.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebKitLogInitialization.h; sourceTree = "<group>"; };
22F219CB08D236730030E078 /* WebBackForwardListPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardListPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
2568C72C0174912D0ECA149E /* WebKit.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebKit.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
29AEF95D134C755400FE5096 /* OutlookQuirksUserScript.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = OutlookQuirksUserScript.js; sourceTree = "<group>"; };
@@ -1787,6 +1790,8 @@
5365AED92566345800704679 /* WebKitLegacy_Private.h */,
93AEB17D032C1735008635CE /* WebKitLogging.h */,
93AEB17E032C1735008635CE /* WebKitLogging.m */,
+ 1CF18F4226BB71D3004B1722 /* WebKitLogInitialization.h */,
+ 1CF18F4026BB71B7004B1722 /* WebKitLogInitialization.mm */,
7082F56F038EADAA00A80180 /* WebKitNSStringExtras.h */,
7082F570038EADAA00A80180 /* WebKitNSStringExtras.mm */,
F53444CE02E87CBA018635CA /* WebKitStatistics.h */,
@@ -3651,6 +3656,7 @@
939811030824BF01008DF038 /* WebKitErrors.m in Sources */,
CD8BFCE715531224005AFB25 /* WebKitFullScreenListener.mm in Sources */,
939810C30824BF01008DF038 /* WebKitLogging.m in Sources */,
+ 1CF18F4126BB71B7004B1722 /* WebKitLogInitialization.mm in Sources */,
939810C40824BF01008DF038 /* WebKitNSStringExtras.mm in Sources */,
1AAF5D0F0EDDE7A7008D883D /* WebKitPluginAgent.defs in Sources */,
1AAF5D000EDDE604008D883D /* WebKitPluginClient.defs in Sources */,
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (280755 => 280756)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2021-08-07 07:54:50 UTC (rev 280756)
@@ -1,3 +1,22 @@
+2021-08-07 Myles C. Maxfield <[email protected]>
+
+ Deduplicate logging channel algorithms
+ https://bugs.webkit.org/show_bug.cgi?id=228809
+
+ Reviewed by Fujii Hironori.
+
+ * Misc/WebKitLogInitialization.h: Copied from Source/WebKit/Platform/LogInitialization.h.
+ * Misc/WebKitLogInitialization.mm: Copied from Source/WebKitLegacy/mac/Misc/WebKitLogging.m.
+ (WebKit::logChannels):
+ (ReportDiscardedDelegateException):
+ * Misc/WebKitLogging.h:
+ * Misc/WebKitLogging.m:
+ (ReportDiscardedDelegateException): Deleted.
+ * WebCoreSupport/WebDragClient.mm:
+ * WebView/WebDelegateImplementationCaching.mm:
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+
2021-08-06 Peng Liu <[email protected]>
[macOS] Clean up Feature Flags related code
Copied: trunk/Source/WebKitLegacy/mac/Misc/WebKitLogInitialization.h (from rev 280755, trunk/Source/WebKit/Platform/LogInitialization.h) (0 => 280756)
--- trunk/Source/WebKitLegacy/mac/Misc/WebKitLogInitialization.h (rev 0)
+++ trunk/Source/WebKitLegacy/mac/Misc/WebKitLogInitialization.h 2021-08-07 07:54:50 UTC (rev 280756)
@@ -0,0 +1,43 @@
+/*
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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/LogChannels.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
+
+WTF::LogChannels& logChannels();
+
+#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
+
+WTFLogChannel* getLogChannel(const String& name);
+
+} // namespace WebKit
+
+void ReportDiscardedDelegateException(SEL delegateSelector, id exception);
Copied: trunk/Source/WebKitLegacy/mac/Misc/WebKitLogInitialization.mm (from rev 280755, trunk/Source/WebKitLegacy/mac/Misc/WebKitLogging.m) (0 => 280756)
--- trunk/Source/WebKitLegacy/mac/Misc/WebKitLogInitialization.mm (rev 0)
+++ trunk/Source/WebKitLegacy/mac/Misc/WebKitLogInitialization.mm 2021-08-07 07:54:50 UTC (rev 280756)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2005-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.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
+ */
+
+#include "WebKitLogInitialization.h"
+
+#include "WebKitLogging.h"
+#include <wtf/text/CString.h>
+
+namespace WebKit {
+
+#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
+
+class LogChannels final : public WTF::LogChannels {
+public:
+ LogChannels()
+ {
+ m_logChannels = {
+ WEBKIT_LOG_CHANNELS(LOG_CHANNEL_ADDRESS)
+ };
+ }
+
+private:
+ String logLevelString() final
+ {
+ static NSString * const defaultsDomain = @"WebKitLogging";
+ return [[NSUserDefaults standardUserDefaults] stringForKey:defaultsDomain];
+ }
+};
+
+WTF::LogChannels& logChannels()
+{
+ static NeverDestroyed<LogChannels> logChannels;
+ return logChannels.get();
+}
+
+#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
+
+} // namespace WebKit
+
+void ReportDiscardedDelegateException(SEL delegateSelector, id exception)
+{
+ if ([exception isKindOfClass:[NSException class]]) {
+ NSLog(@"*** WebKit discarded an uncaught exception in the %s delegate: <%@> %@",
+ sel_getName(delegateSelector), [exception name], [exception reason]);
+ } else {
+ NSLog(@"*** WebKit discarded an uncaught exception in the %s delegate: %@",
+ sel_getName(delegateSelector), exception);
+ }
+}
Modified: trunk/Source/WebKitLegacy/mac/Misc/WebKitLogging.h (280755 => 280756)
--- trunk/Source/WebKitLegacy/mac/Misc/WebKitLogging.h 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKitLegacy/mac/Misc/WebKitLogging.h 2021-08-07 07:54:50 UTC (rev 280756)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2007, 2008, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-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
@@ -68,11 +68,8 @@
#undef DECLARE_LOG_CHANNEL
-void WebKitInitializeLogChannelsIfNecessary(void);
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
-void ReportDiscardedDelegateException(SEL delegateSelector, id exception);
-
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKitLegacy/mac/Misc/WebKitLogging.m (280755 => 280756)
--- trunk/Source/WebKitLegacy/mac/Misc/WebKitLogging.m 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKitLegacy/mac/Misc/WebKitLogging.m 2021-08-07 07:54:50 UTC (rev 280756)
@@ -33,37 +33,4 @@
#define DEFINE_WEBKIT_LOG_CHANNEL(name) DEFINE_LOG_CHANNEL(name, LOG_CHANNEL_WEBKIT_SUBSYSTEM)
WEBKIT_LOG_CHANNELS(DEFINE_WEBKIT_LOG_CHANNEL)
-static WTFLogChannel* logChannels[] = {
- WEBKIT_LOG_CHANNELS(LOG_CHANNEL_ADDRESS)
-};
-
-static const size_t logChannelCount = sizeof(logChannels) / sizeof(logChannels[0]);
-
-
-static NSString * const defaultsDomain = @"WebKitLogging";
-
-void WebKitInitializeLogChannelsIfNecessary()
-{
- static bool haveInitializedLoggingChannels = false;
- if (haveInitializedLoggingChannels)
- return;
- haveInitializedLoggingChannels = true;
-
- NSString *logLevel = [[NSUserDefaults standardUserDefaults] stringForKey:defaultsDomain];
- if (!logLevel)
- return;
-
- WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, [logLevel UTF8String]);
-}
-
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
-
-void ReportDiscardedDelegateException(SEL delegateSelector, id exception)
-{
- if ([exception isKindOfClass:[NSException class]])
- NSLog(@"*** WebKit discarded an uncaught exception in the %s delegate: <%@> %@",
- sel_getName(delegateSelector), [exception name], [exception reason]);
- else
- NSLog(@"*** WebKit discarded an uncaught exception in the %s delegate: %@",
- sel_getName(delegateSelector), exception);
-}
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.mm (280755 => 280756)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.mm 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.mm 2021-08-07 07:54:50 UTC (rev 280756)
@@ -34,6 +34,7 @@
#import "WebFrameInternal.h"
#import "WebFrameView.h"
#import "WebHTMLViewInternal.h"
+#import "WebKitLogInitialization.h"
#import "WebKitLogging.h"
#import "WebKitNSStringExtras.h"
#import "WebNSURLExtras.h"
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebDelegateImplementationCaching.mm (280755 => 280756)
--- trunk/Source/WebKitLegacy/mac/WebView/WebDelegateImplementationCaching.mm 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebDelegateImplementationCaching.mm 2021-08-07 07:54:50 UTC (rev 280756)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2021 Apple Inc. All rights reserved.
* Copyright (C) 2006 David Smith ([email protected])
*
* Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
#import "WebDelegateImplementationCaching.h"
+#import "WebKitLogInitialization.h"
#import "WebKitLogging.h"
#import "WebView.h"
#import "WebViewData.h"
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (280755 => 280756)
--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm 2021-08-07 06:30:40 UTC (rev 280755)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm 2021-08-07 07:54:50 UTC (rev 280756)
@@ -81,6 +81,7 @@
#import "WebInspectorClient.h"
#import "WebKitErrors.h"
#import "WebKitFullScreenListener.h"
+#import "WebKitLogInitialization.h"
#import "WebKitLogging.h"
#import "WebKitNSStringExtras.h"
#import "WebKitStatisticsPrivate.h"
@@ -1480,8 +1481,8 @@
#endif
if (!didOneTimeInitialization) {
#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
- WebKitInitializeLogChannelsIfNecessary();
- WebCore::initializeLogChannelsIfNecessary();
+ WebCore::logChannels().initializeLogChannelsIfNecessary();
+ WebKit::logChannels().initializeLogChannelsIfNecessary();
#endif
// Initialize our platform strategies first before invoking the rest