haikuwebkit/Source/WTF/wtf/AggregateLogger.h

122 lines
3.9 KiB
C
Raw Permalink Normal View History

Add AggregateLogger, a Logger specialization for singleton classes. https://bugs.webkit.org/show_bug.cgi?id=195644 Reviewed by Eric Carlson. Source/WebCore: Convert debug logging over to release logging through the use of AggregateLogger. * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::client const): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager): (WebCore::PlatformMediaSessionManager::beginInterruption): (WebCore::PlatformMediaSessionManager::endInterruption): (WebCore::PlatformMediaSessionManager::addSession): (WebCore::PlatformMediaSessionManager::removeSession): (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback): (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback): (WebCore::PlatformMediaSessionManager::setCurrentSession): (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const): (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const): (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const): (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const): (WebCore::PlatformMediaSessionManager::logChannel const): * platform/audio/PlatformMediaSessionManager.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (MediaSessionManagerCocoa::updateSessionState): (MediaSessionManagerCocoa::sessionWillBeginPlayback): (MediaSessionManagerCocoa::removeSession): (MediaSessionManagerCocoa::sessionWillEndPlayback): (MediaSessionManagerCocoa::clientCharacteristicsChanged): (MediaSessionManagerCocoa::updateNowPlayingInfo): * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::resetRestrictions): (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): Source/WTF: Add a new class, AggregateLogger, which will log messages to each of its aggregated loggers. Drive-by fixes: allow "const void*" to be directly logged by converting the pointer to a hex string. * WTF.xcodeproj/project.pbxproj: * wtf/AggregateLogger.h: Added. (WTF::AggregateLogger::create): (WTF::AggregateLogger::addLogger): (WTF::AggregateLogger::removeLogger): (WTF::AggregateLogger::logAlways const): (WTF::AggregateLogger::error const): (WTF::AggregateLogger::warning const): (WTF::AggregateLogger::info const): (WTF::AggregateLogger::debug const): (WTF::AggregateLogger::willLog const): (WTF::AggregateLogger::AggregateLogger): (WTF::AggregateLogger::log const): * wtf/CMakeLists.h: * wtf/Logger.cpp: (WTF::>::toString): * wtf/Logger.h: Canonical link: https://commits.webkit.org/209992@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-13 20:18:08 +00:00
/*
* Copyright (C) 2019 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/Algorithms.h>
#include <wtf/HashSet.h>
Add AggregateLogger, a Logger specialization for singleton classes. https://bugs.webkit.org/show_bug.cgi?id=195644 Reviewed by Eric Carlson. Source/WebCore: Convert debug logging over to release logging through the use of AggregateLogger. * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::client const): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager): (WebCore::PlatformMediaSessionManager::beginInterruption): (WebCore::PlatformMediaSessionManager::endInterruption): (WebCore::PlatformMediaSessionManager::addSession): (WebCore::PlatformMediaSessionManager::removeSession): (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback): (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback): (WebCore::PlatformMediaSessionManager::setCurrentSession): (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const): (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const): (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const): (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const): (WebCore::PlatformMediaSessionManager::logChannel const): * platform/audio/PlatformMediaSessionManager.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (MediaSessionManagerCocoa::updateSessionState): (MediaSessionManagerCocoa::sessionWillBeginPlayback): (MediaSessionManagerCocoa::removeSession): (MediaSessionManagerCocoa::sessionWillEndPlayback): (MediaSessionManagerCocoa::clientCharacteristicsChanged): (MediaSessionManagerCocoa::updateNowPlayingInfo): * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::resetRestrictions): (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): Source/WTF: Add a new class, AggregateLogger, which will log messages to each of its aggregated loggers. Drive-by fixes: allow "const void*" to be directly logged by converting the pointer to a hex string. * WTF.xcodeproj/project.pbxproj: * wtf/AggregateLogger.h: Added. (WTF::AggregateLogger::create): (WTF::AggregateLogger::addLogger): (WTF::AggregateLogger::removeLogger): (WTF::AggregateLogger::logAlways const): (WTF::AggregateLogger::error const): (WTF::AggregateLogger::warning const): (WTF::AggregateLogger::info const): (WTF::AggregateLogger::debug const): (WTF::AggregateLogger::willLog const): (WTF::AggregateLogger::AggregateLogger): (WTF::AggregateLogger::log const): * wtf/CMakeLists.h: * wtf/Logger.cpp: (WTF::>::toString): * wtf/Logger.h: Canonical link: https://commits.webkit.org/209992@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-13 20:18:08 +00:00
#include <wtf/Logger.h>
#include <wtf/Ref.h>
#include <wtf/RefPtr.h>
Add AggregateLogger, a Logger specialization for singleton classes. https://bugs.webkit.org/show_bug.cgi?id=195644 Reviewed by Eric Carlson. Source/WebCore: Convert debug logging over to release logging through the use of AggregateLogger. * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::client const): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager): (WebCore::PlatformMediaSessionManager::beginInterruption): (WebCore::PlatformMediaSessionManager::endInterruption): (WebCore::PlatformMediaSessionManager::addSession): (WebCore::PlatformMediaSessionManager::removeSession): (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback): (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback): (WebCore::PlatformMediaSessionManager::setCurrentSession): (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const): (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const): (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const): (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const): (WebCore::PlatformMediaSessionManager::logChannel const): * platform/audio/PlatformMediaSessionManager.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (MediaSessionManagerCocoa::updateSessionState): (MediaSessionManagerCocoa::sessionWillBeginPlayback): (MediaSessionManagerCocoa::removeSession): (MediaSessionManagerCocoa::sessionWillEndPlayback): (MediaSessionManagerCocoa::clientCharacteristicsChanged): (MediaSessionManagerCocoa::updateNowPlayingInfo): * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::resetRestrictions): (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): Source/WTF: Add a new class, AggregateLogger, which will log messages to each of its aggregated loggers. Drive-by fixes: allow "const void*" to be directly logged by converting the pointer to a hex string. * WTF.xcodeproj/project.pbxproj: * wtf/AggregateLogger.h: Added. (WTF::AggregateLogger::create): (WTF::AggregateLogger::addLogger): (WTF::AggregateLogger::removeLogger): (WTF::AggregateLogger::logAlways const): (WTF::AggregateLogger::error const): (WTF::AggregateLogger::warning const): (WTF::AggregateLogger::info const): (WTF::AggregateLogger::debug const): (WTF::AggregateLogger::willLog const): (WTF::AggregateLogger::AggregateLogger): (WTF::AggregateLogger::log const): * wtf/CMakeLists.h: * wtf/Logger.cpp: (WTF::>::toString): * wtf/Logger.h: Canonical link: https://commits.webkit.org/209992@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-13 20:18:08 +00:00
namespace WTF {
class AggregateLogger : public Logger {
WTF_MAKE_NONCOPYABLE(AggregateLogger);
public:
static Ref<AggregateLogger> create(const void* owner)
{
return adoptRef(*new AggregateLogger(owner));
}
void addLogger(const Logger& logger)
{
m_loggers.add(&logger);
}
void removeLogger(const Logger& logger)
{
m_loggers.remove(&logger);
}
template<typename... Arguments>
inline void logAlways(WTFLogChannel& channel, UNUSED_FUNCTION const Arguments&... arguments) const
{
#if RELEASE_LOG_DISABLED
// "Standard" WebCore logging goes to stderr, which is captured in layout test output and can generally be a problem
// on some systems, so don't allow it.
UNUSED_PARAM(channel);
#else
Make WTFLogChannelState and WTFLogLevel enum classes https://bugs.webkit.org/show_bug.cgi?id=195904 Patch by Alex Christensen <achristensen@webkit.org> on 2019-03-19 Reviewed by Eric Carlson. Source/WebCore: * Modules/mediasource/SourceBuffer.cpp: (WebCore::removeSamplesFromTrackBuffer): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): (WebCore::LibWebRTCMediaEndpoint::statsLogInterval const): * dom/Document.cpp: (WebCore::messageLevelFromWTFLogLevel): * html/FTPDirectoryDocument.cpp: (WebCore::FTPDirectoryDocument::FTPDirectoryDocument): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::seekTask): (WebCore::HTMLMediaElement::selectNextSourceChild): (WebCore::HTMLMediaElement::sourceWasAdded): (WebCore::HTMLMediaElement::sourceWasRemoved): * inspector/agents/WebConsoleAgent.cpp: (WebCore::WebConsoleAgent::getLoggingChannels): (WebCore::channelConfigurationForString): * platform/Logging.cpp: (WebCore::isLogChannelEnabled): (WebCore::setLogChannelToAccumulate): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::initializePeerConnectionFactoryAndThreads): * rendering/RenderLayerCompositor.cpp: (WebCore::compositingLogEnabled): Source/WebKit: * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage): * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::NetworkRTCProvider): Source/WTF: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Logger.h: (WTF::Logger::logAlways const): (WTF::Logger::error const): (WTF::Logger::warning const): (WTF::Logger::info const): (WTF::Logger::debug const): (WTF::Logger::willLog const): (WTF::Logger::log): * wtf/MemoryPressureHandler.cpp: * wtf/RefCountedLeakCounter.cpp: Tools: * TestWebKitAPI/Tests/WebCore/Logging.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/210210@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-19 16:47:04 +00:00
log(channel, WTFLogLevel::Always, arguments...);
Add AggregateLogger, a Logger specialization for singleton classes. https://bugs.webkit.org/show_bug.cgi?id=195644 Reviewed by Eric Carlson. Source/WebCore: Convert debug logging over to release logging through the use of AggregateLogger. * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::client const): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager): (WebCore::PlatformMediaSessionManager::beginInterruption): (WebCore::PlatformMediaSessionManager::endInterruption): (WebCore::PlatformMediaSessionManager::addSession): (WebCore::PlatformMediaSessionManager::removeSession): (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback): (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback): (WebCore::PlatformMediaSessionManager::setCurrentSession): (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const): (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const): (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const): (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const): (WebCore::PlatformMediaSessionManager::logChannel const): * platform/audio/PlatformMediaSessionManager.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (MediaSessionManagerCocoa::updateSessionState): (MediaSessionManagerCocoa::sessionWillBeginPlayback): (MediaSessionManagerCocoa::removeSession): (MediaSessionManagerCocoa::sessionWillEndPlayback): (MediaSessionManagerCocoa::clientCharacteristicsChanged): (MediaSessionManagerCocoa::updateNowPlayingInfo): * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::resetRestrictions): (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): Source/WTF: Add a new class, AggregateLogger, which will log messages to each of its aggregated loggers. Drive-by fixes: allow "const void*" to be directly logged by converting the pointer to a hex string. * WTF.xcodeproj/project.pbxproj: * wtf/AggregateLogger.h: Added. (WTF::AggregateLogger::create): (WTF::AggregateLogger::addLogger): (WTF::AggregateLogger::removeLogger): (WTF::AggregateLogger::logAlways const): (WTF::AggregateLogger::error const): (WTF::AggregateLogger::warning const): (WTF::AggregateLogger::info const): (WTF::AggregateLogger::debug const): (WTF::AggregateLogger::willLog const): (WTF::AggregateLogger::AggregateLogger): (WTF::AggregateLogger::log const): * wtf/CMakeLists.h: * wtf/Logger.cpp: (WTF::>::toString): * wtf/Logger.h: Canonical link: https://commits.webkit.org/209992@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-13 20:18:08 +00:00
#endif
}
template<typename... Arguments>
inline void error(WTFLogChannel& channel, const Arguments&... arguments) const
{
Make WTFLogChannelState and WTFLogLevel enum classes https://bugs.webkit.org/show_bug.cgi?id=195904 Patch by Alex Christensen <achristensen@webkit.org> on 2019-03-19 Reviewed by Eric Carlson. Source/WebCore: * Modules/mediasource/SourceBuffer.cpp: (WebCore::removeSamplesFromTrackBuffer): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): (WebCore::LibWebRTCMediaEndpoint::statsLogInterval const): * dom/Document.cpp: (WebCore::messageLevelFromWTFLogLevel): * html/FTPDirectoryDocument.cpp: (WebCore::FTPDirectoryDocument::FTPDirectoryDocument): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::seekTask): (WebCore::HTMLMediaElement::selectNextSourceChild): (WebCore::HTMLMediaElement::sourceWasAdded): (WebCore::HTMLMediaElement::sourceWasRemoved): * inspector/agents/WebConsoleAgent.cpp: (WebCore::WebConsoleAgent::getLoggingChannels): (WebCore::channelConfigurationForString): * platform/Logging.cpp: (WebCore::isLogChannelEnabled): (WebCore::setLogChannelToAccumulate): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::initializePeerConnectionFactoryAndThreads): * rendering/RenderLayerCompositor.cpp: (WebCore::compositingLogEnabled): Source/WebKit: * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage): * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::NetworkRTCProvider): Source/WTF: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Logger.h: (WTF::Logger::logAlways const): (WTF::Logger::error const): (WTF::Logger::warning const): (WTF::Logger::info const): (WTF::Logger::debug const): (WTF::Logger::willLog const): (WTF::Logger::log): * wtf/MemoryPressureHandler.cpp: * wtf/RefCountedLeakCounter.cpp: Tools: * TestWebKitAPI/Tests/WebCore/Logging.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/210210@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-19 16:47:04 +00:00
log(channel, WTFLogLevel::Error, arguments...);
Add AggregateLogger, a Logger specialization for singleton classes. https://bugs.webkit.org/show_bug.cgi?id=195644 Reviewed by Eric Carlson. Source/WebCore: Convert debug logging over to release logging through the use of AggregateLogger. * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::client const): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager): (WebCore::PlatformMediaSessionManager::beginInterruption): (WebCore::PlatformMediaSessionManager::endInterruption): (WebCore::PlatformMediaSessionManager::addSession): (WebCore::PlatformMediaSessionManager::removeSession): (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback): (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback): (WebCore::PlatformMediaSessionManager::setCurrentSession): (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const): (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const): (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const): (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const): (WebCore::PlatformMediaSessionManager::logChannel const): * platform/audio/PlatformMediaSessionManager.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (MediaSessionManagerCocoa::updateSessionState): (MediaSessionManagerCocoa::sessionWillBeginPlayback): (MediaSessionManagerCocoa::removeSession): (MediaSessionManagerCocoa::sessionWillEndPlayback): (MediaSessionManagerCocoa::clientCharacteristicsChanged): (MediaSessionManagerCocoa::updateNowPlayingInfo): * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::resetRestrictions): (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): Source/WTF: Add a new class, AggregateLogger, which will log messages to each of its aggregated loggers. Drive-by fixes: allow "const void*" to be directly logged by converting the pointer to a hex string. * WTF.xcodeproj/project.pbxproj: * wtf/AggregateLogger.h: Added. (WTF::AggregateLogger::create): (WTF::AggregateLogger::addLogger): (WTF::AggregateLogger::removeLogger): (WTF::AggregateLogger::logAlways const): (WTF::AggregateLogger::error const): (WTF::AggregateLogger::warning const): (WTF::AggregateLogger::info const): (WTF::AggregateLogger::debug const): (WTF::AggregateLogger::willLog const): (WTF::AggregateLogger::AggregateLogger): (WTF::AggregateLogger::log const): * wtf/CMakeLists.h: * wtf/Logger.cpp: (WTF::>::toString): * wtf/Logger.h: Canonical link: https://commits.webkit.org/209992@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-13 20:18:08 +00:00
}
template<typename... Arguments>
inline void warning(WTFLogChannel& channel, const Arguments&... arguments) const
{
Make WTFLogChannelState and WTFLogLevel enum classes https://bugs.webkit.org/show_bug.cgi?id=195904 Patch by Alex Christensen <achristensen@webkit.org> on 2019-03-19 Reviewed by Eric Carlson. Source/WebCore: * Modules/mediasource/SourceBuffer.cpp: (WebCore::removeSamplesFromTrackBuffer): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): (WebCore::LibWebRTCMediaEndpoint::statsLogInterval const): * dom/Document.cpp: (WebCore::messageLevelFromWTFLogLevel): * html/FTPDirectoryDocument.cpp: (WebCore::FTPDirectoryDocument::FTPDirectoryDocument): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::seekTask): (WebCore::HTMLMediaElement::selectNextSourceChild): (WebCore::HTMLMediaElement::sourceWasAdded): (WebCore::HTMLMediaElement::sourceWasRemoved): * inspector/agents/WebConsoleAgent.cpp: (WebCore::WebConsoleAgent::getLoggingChannels): (WebCore::channelConfigurationForString): * platform/Logging.cpp: (WebCore::isLogChannelEnabled): (WebCore::setLogChannelToAccumulate): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::initializePeerConnectionFactoryAndThreads): * rendering/RenderLayerCompositor.cpp: (WebCore::compositingLogEnabled): Source/WebKit: * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage): * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::NetworkRTCProvider): Source/WTF: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Logger.h: (WTF::Logger::logAlways const): (WTF::Logger::error const): (WTF::Logger::warning const): (WTF::Logger::info const): (WTF::Logger::debug const): (WTF::Logger::willLog const): (WTF::Logger::log): * wtf/MemoryPressureHandler.cpp: * wtf/RefCountedLeakCounter.cpp: Tools: * TestWebKitAPI/Tests/WebCore/Logging.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/210210@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-19 16:47:04 +00:00
log(channel, WTFLogLevel::Warning, arguments...);
Add AggregateLogger, a Logger specialization for singleton classes. https://bugs.webkit.org/show_bug.cgi?id=195644 Reviewed by Eric Carlson. Source/WebCore: Convert debug logging over to release logging through the use of AggregateLogger. * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::client const): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager): (WebCore::PlatformMediaSessionManager::beginInterruption): (WebCore::PlatformMediaSessionManager::endInterruption): (WebCore::PlatformMediaSessionManager::addSession): (WebCore::PlatformMediaSessionManager::removeSession): (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback): (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback): (WebCore::PlatformMediaSessionManager::setCurrentSession): (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const): (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const): (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const): (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const): (WebCore::PlatformMediaSessionManager::logChannel const): * platform/audio/PlatformMediaSessionManager.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (MediaSessionManagerCocoa::updateSessionState): (MediaSessionManagerCocoa::sessionWillBeginPlayback): (MediaSessionManagerCocoa::removeSession): (MediaSessionManagerCocoa::sessionWillEndPlayback): (MediaSessionManagerCocoa::clientCharacteristicsChanged): (MediaSessionManagerCocoa::updateNowPlayingInfo): * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::resetRestrictions): (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): Source/WTF: Add a new class, AggregateLogger, which will log messages to each of its aggregated loggers. Drive-by fixes: allow "const void*" to be directly logged by converting the pointer to a hex string. * WTF.xcodeproj/project.pbxproj: * wtf/AggregateLogger.h: Added. (WTF::AggregateLogger::create): (WTF::AggregateLogger::addLogger): (WTF::AggregateLogger::removeLogger): (WTF::AggregateLogger::logAlways const): (WTF::AggregateLogger::error const): (WTF::AggregateLogger::warning const): (WTF::AggregateLogger::info const): (WTF::AggregateLogger::debug const): (WTF::AggregateLogger::willLog const): (WTF::AggregateLogger::AggregateLogger): (WTF::AggregateLogger::log const): * wtf/CMakeLists.h: * wtf/Logger.cpp: (WTF::>::toString): * wtf/Logger.h: Canonical link: https://commits.webkit.org/209992@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-13 20:18:08 +00:00
}
template<typename... Arguments>
inline void info(WTFLogChannel& channel, const Arguments&... arguments) const
{
Make WTFLogChannelState and WTFLogLevel enum classes https://bugs.webkit.org/show_bug.cgi?id=195904 Patch by Alex Christensen <achristensen@webkit.org> on 2019-03-19 Reviewed by Eric Carlson. Source/WebCore: * Modules/mediasource/SourceBuffer.cpp: (WebCore::removeSamplesFromTrackBuffer): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): (WebCore::LibWebRTCMediaEndpoint::statsLogInterval const): * dom/Document.cpp: (WebCore::messageLevelFromWTFLogLevel): * html/FTPDirectoryDocument.cpp: (WebCore::FTPDirectoryDocument::FTPDirectoryDocument): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::seekTask): (WebCore::HTMLMediaElement::selectNextSourceChild): (WebCore::HTMLMediaElement::sourceWasAdded): (WebCore::HTMLMediaElement::sourceWasRemoved): * inspector/agents/WebConsoleAgent.cpp: (WebCore::WebConsoleAgent::getLoggingChannels): (WebCore::channelConfigurationForString): * platform/Logging.cpp: (WebCore::isLogChannelEnabled): (WebCore::setLogChannelToAccumulate): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::initializePeerConnectionFactoryAndThreads): * rendering/RenderLayerCompositor.cpp: (WebCore::compositingLogEnabled): Source/WebKit: * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage): * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::NetworkRTCProvider): Source/WTF: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Logger.h: (WTF::Logger::logAlways const): (WTF::Logger::error const): (WTF::Logger::warning const): (WTF::Logger::info const): (WTF::Logger::debug const): (WTF::Logger::willLog const): (WTF::Logger::log): * wtf/MemoryPressureHandler.cpp: * wtf/RefCountedLeakCounter.cpp: Tools: * TestWebKitAPI/Tests/WebCore/Logging.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/210210@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-19 16:47:04 +00:00
log(channel, WTFLogLevel::Info, arguments...);
Add AggregateLogger, a Logger specialization for singleton classes. https://bugs.webkit.org/show_bug.cgi?id=195644 Reviewed by Eric Carlson. Source/WebCore: Convert debug logging over to release logging through the use of AggregateLogger. * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::client const): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager): (WebCore::PlatformMediaSessionManager::beginInterruption): (WebCore::PlatformMediaSessionManager::endInterruption): (WebCore::PlatformMediaSessionManager::addSession): (WebCore::PlatformMediaSessionManager::removeSession): (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback): (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback): (WebCore::PlatformMediaSessionManager::setCurrentSession): (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const): (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const): (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const): (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const): (WebCore::PlatformMediaSessionManager::logChannel const): * platform/audio/PlatformMediaSessionManager.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (MediaSessionManagerCocoa::updateSessionState): (MediaSessionManagerCocoa::sessionWillBeginPlayback): (MediaSessionManagerCocoa::removeSession): (MediaSessionManagerCocoa::sessionWillEndPlayback): (MediaSessionManagerCocoa::clientCharacteristicsChanged): (MediaSessionManagerCocoa::updateNowPlayingInfo): * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::resetRestrictions): (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): Source/WTF: Add a new class, AggregateLogger, which will log messages to each of its aggregated loggers. Drive-by fixes: allow "const void*" to be directly logged by converting the pointer to a hex string. * WTF.xcodeproj/project.pbxproj: * wtf/AggregateLogger.h: Added. (WTF::AggregateLogger::create): (WTF::AggregateLogger::addLogger): (WTF::AggregateLogger::removeLogger): (WTF::AggregateLogger::logAlways const): (WTF::AggregateLogger::error const): (WTF::AggregateLogger::warning const): (WTF::AggregateLogger::info const): (WTF::AggregateLogger::debug const): (WTF::AggregateLogger::willLog const): (WTF::AggregateLogger::AggregateLogger): (WTF::AggregateLogger::log const): * wtf/CMakeLists.h: * wtf/Logger.cpp: (WTF::>::toString): * wtf/Logger.h: Canonical link: https://commits.webkit.org/209992@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-13 20:18:08 +00:00
}
template<typename... Arguments>
inline void debug(WTFLogChannel& channel, const Arguments&... arguments) const
{
Make WTFLogChannelState and WTFLogLevel enum classes https://bugs.webkit.org/show_bug.cgi?id=195904 Patch by Alex Christensen <achristensen@webkit.org> on 2019-03-19 Reviewed by Eric Carlson. Source/WebCore: * Modules/mediasource/SourceBuffer.cpp: (WebCore::removeSamplesFromTrackBuffer): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): (WebCore::LibWebRTCMediaEndpoint::statsLogInterval const): * dom/Document.cpp: (WebCore::messageLevelFromWTFLogLevel): * html/FTPDirectoryDocument.cpp: (WebCore::FTPDirectoryDocument::FTPDirectoryDocument): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::seekTask): (WebCore::HTMLMediaElement::selectNextSourceChild): (WebCore::HTMLMediaElement::sourceWasAdded): (WebCore::HTMLMediaElement::sourceWasRemoved): * inspector/agents/WebConsoleAgent.cpp: (WebCore::WebConsoleAgent::getLoggingChannels): (WebCore::channelConfigurationForString): * platform/Logging.cpp: (WebCore::isLogChannelEnabled): (WebCore::setLogChannelToAccumulate): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::initializePeerConnectionFactoryAndThreads): * rendering/RenderLayerCompositor.cpp: (WebCore::compositingLogEnabled): Source/WebKit: * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage): * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::NetworkRTCProvider): Source/WTF: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Logger.h: (WTF::Logger::logAlways const): (WTF::Logger::error const): (WTF::Logger::warning const): (WTF::Logger::info const): (WTF::Logger::debug const): (WTF::Logger::willLog const): (WTF::Logger::log): * wtf/MemoryPressureHandler.cpp: * wtf/RefCountedLeakCounter.cpp: Tools: * TestWebKitAPI/Tests/WebCore/Logging.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/210210@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-19 16:47:04 +00:00
log(channel, WTFLogLevel::Debug, arguments...);
Add AggregateLogger, a Logger specialization for singleton classes. https://bugs.webkit.org/show_bug.cgi?id=195644 Reviewed by Eric Carlson. Source/WebCore: Convert debug logging over to release logging through the use of AggregateLogger. * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::client const): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager): (WebCore::PlatformMediaSessionManager::beginInterruption): (WebCore::PlatformMediaSessionManager::endInterruption): (WebCore::PlatformMediaSessionManager::addSession): (WebCore::PlatformMediaSessionManager::removeSession): (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback): (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback): (WebCore::PlatformMediaSessionManager::setCurrentSession): (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const): (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const): (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const): (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const): (WebCore::PlatformMediaSessionManager::logChannel const): * platform/audio/PlatformMediaSessionManager.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (MediaSessionManagerCocoa::updateSessionState): (MediaSessionManagerCocoa::sessionWillBeginPlayback): (MediaSessionManagerCocoa::removeSession): (MediaSessionManagerCocoa::sessionWillEndPlayback): (MediaSessionManagerCocoa::clientCharacteristicsChanged): (MediaSessionManagerCocoa::updateNowPlayingInfo): * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::resetRestrictions): (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): Source/WTF: Add a new class, AggregateLogger, which will log messages to each of its aggregated loggers. Drive-by fixes: allow "const void*" to be directly logged by converting the pointer to a hex string. * WTF.xcodeproj/project.pbxproj: * wtf/AggregateLogger.h: Added. (WTF::AggregateLogger::create): (WTF::AggregateLogger::addLogger): (WTF::AggregateLogger::removeLogger): (WTF::AggregateLogger::logAlways const): (WTF::AggregateLogger::error const): (WTF::AggregateLogger::warning const): (WTF::AggregateLogger::info const): (WTF::AggregateLogger::debug const): (WTF::AggregateLogger::willLog const): (WTF::AggregateLogger::AggregateLogger): (WTF::AggregateLogger::log const): * wtf/CMakeLists.h: * wtf/Logger.cpp: (WTF::>::toString): * wtf/Logger.h: Canonical link: https://commits.webkit.org/209992@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-13 20:18:08 +00:00
}
inline bool willLog(const WTFLogChannel& channel, WTFLogLevel level) const
{
return allOf(m_loggers, [channel, level] (auto& logger) { return logger->willLog(channel, level); });
}
private:
AggregateLogger(const void* owner)
: Logger(owner)
{
}
template<typename... Argument>
inline void log(WTFLogChannel& channel, WTFLogLevel level, const Argument&... arguments) const
{
if (!willLog(channel, level))
return;
Logger::log(channel, level, arguments...);
for (const auto& logger : m_loggers) {
Add AggregateLogger, a Logger specialization for singleton classes. https://bugs.webkit.org/show_bug.cgi?id=195644 Reviewed by Eric Carlson. Source/WebCore: Convert debug logging over to release logging through the use of AggregateLogger. * platform/audio/PlatformMediaSession.h: (WebCore::PlatformMediaSession::client const): * platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager): (WebCore::PlatformMediaSessionManager::beginInterruption): (WebCore::PlatformMediaSessionManager::endInterruption): (WebCore::PlatformMediaSessionManager::addSession): (WebCore::PlatformMediaSessionManager::removeSession): (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback): (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback): (WebCore::PlatformMediaSessionManager::setCurrentSession): (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const): (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const): (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const): (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const): (WebCore::PlatformMediaSessionManager::logChannel const): * platform/audio/PlatformMediaSessionManager.h: * platform/audio/cocoa/MediaSessionManagerCocoa.mm: (MediaSessionManagerCocoa::updateSessionState): (MediaSessionManagerCocoa::sessionWillBeginPlayback): (MediaSessionManagerCocoa::removeSession): (MediaSessionManagerCocoa::sessionWillEndPlayback): (MediaSessionManagerCocoa::clientCharacteristicsChanged): (MediaSessionManagerCocoa::updateNowPlayingInfo): * platform/audio/ios/MediaSessionManagerIOS.mm: (WebCore::MediaSessionManageriOS::resetRestrictions): (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring): Source/WTF: Add a new class, AggregateLogger, which will log messages to each of its aggregated loggers. Drive-by fixes: allow "const void*" to be directly logged by converting the pointer to a hex string. * WTF.xcodeproj/project.pbxproj: * wtf/AggregateLogger.h: Added. (WTF::AggregateLogger::create): (WTF::AggregateLogger::addLogger): (WTF::AggregateLogger::removeLogger): (WTF::AggregateLogger::logAlways const): (WTF::AggregateLogger::error const): (WTF::AggregateLogger::warning const): (WTF::AggregateLogger::info const): (WTF::AggregateLogger::debug const): (WTF::AggregateLogger::willLog const): (WTF::AggregateLogger::AggregateLogger): (WTF::AggregateLogger::log const): * wtf/CMakeLists.h: * wtf/Logger.cpp: (WTF::>::toString): * wtf/Logger.h: Canonical link: https://commits.webkit.org/209992@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-13 20:18:08 +00:00
for (Observer& observer : logger->observers())
observer.didLogMessage(channel, level, { ConsoleLogValue<Argument>::toValue(arguments)... });
}
}
HashSet<RefPtr<const Logger>> m_loggers;
};
} // namespace WTF
using WTF::AggregateLogger;