Diff
Modified: trunk/Source/WTF/ChangeLog (242900 => 242901)
--- trunk/Source/WTF/ChangeLog 2019-03-13 20:03:34 UTC (rev 242900)
+++ trunk/Source/WTF/ChangeLog 2019-03-13 20:18:08 UTC (rev 242901)
@@ -1,3 +1,32 @@
+2019-03-13 Jer Noble <jer.no...@apple.com>
+
+ Add AggregateLogger, a Logger specialization for singleton classes.
+ https://bugs.webkit.org/show_bug.cgi?id=195644
+
+ Reviewed by Eric Carlson.
+
+ 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:
+
2019-03-12 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r242747.
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (242900 => 242901)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2019-03-13 20:03:34 UTC (rev 242900)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2019-03-13 20:18:08 UTC (rev 242901)
@@ -642,6 +642,7 @@
CD5497AB15857D0300B5BC30 /* MediaTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTime.h; sourceTree = "<group>"; };
CD6D9FCD1EEF3AD4008B0671 /* Algorithms.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Algorithms.h; sourceTree = "<group>"; };
CD7600FF1F90A3CA00026E26 /* UnsafePointer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UnsafePointer.h; sourceTree = "<group>"; };
+ CDCC9BC422382FCE00FFB51C /* AggregateLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AggregateLogger.h; path = wtf/AggregateLogger.h; sourceTree = SOURCE_ROOT; };
CE73E02419DCB7AB00580D5C /* XPCSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPCSPI.h; sourceTree = "<group>"; };
DCEE21FA1CEA7538000C2396 /* CFBundleSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFBundleSPI.h; sourceTree = "<group>"; };
DCEE21FC1CEA7551000C2396 /* BlockObjCExceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlockObjCExceptions.h; sourceTree = "<group>"; };
@@ -854,6 +855,7 @@
A8A4731B151A825B004123FF /* text */,
A8A47339151A825B004123FF /* threads */,
A8A47348151A825B004123FF /* unicode */,
+ CDCC9BC422382FCE00FFB51C /* AggregateLogger.h */,
CD6D9FCD1EEF3AD4008B0671 /* Algorithms.h */,
4427C5A921F6D6C300A612A4 /* ASCIICType.cpp */,
A8A4725A151A825A004123FF /* ASCIICType.h */,
Added: trunk/Source/WTF/wtf/AggregateLogger.h (0 => 242901)
--- trunk/Source/WTF/wtf/AggregateLogger.h (rev 0)
+++ trunk/Source/WTF/wtf/AggregateLogger.h 2019-03-13 20:18:08 UTC (rev 242901)
@@ -0,0 +1,118 @@
+/*
+ * 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/Logger.h>
+
+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
+ log(channel, WTFLogLevelAlways, arguments...);
+#endif
+ }
+
+ template<typename... Arguments>
+ inline void error(WTFLogChannel& channel, const Arguments&... arguments) const
+ {
+ log(channel, WTFLogLevelError, arguments...);
+ }
+
+ template<typename... Arguments>
+ inline void warning(WTFLogChannel& channel, const Arguments&... arguments) const
+ {
+ log(channel, WTFLogLevelWarning, arguments...);
+ }
+
+ template<typename... Arguments>
+ inline void info(WTFLogChannel& channel, const Arguments&... arguments) const
+ {
+ log(channel, WTFLogLevelInfo, arguments...);
+ }
+
+ template<typename... Arguments>
+ inline void debug(WTFLogChannel& channel, const Arguments&... arguments) const
+ {
+ log(channel, WTFLogLevelDebug, arguments...);
+ }
+
+ 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 (auto logger : m_loggers) {
+ for (Observer& observer : logger->observers())
+ observer.didLogMessage(channel, level, { ConsoleLogValue<Argument>::toValue(arguments)... });
+ }
+ }
+
+ HashSet<RefPtr<const Logger>> m_loggers;
+};
+
+} // namespace WTF
+
+using WTF::AggregateLogger;
Modified: trunk/Source/WTF/wtf/CMakeLists.txt (242900 => 242901)
--- trunk/Source/WTF/wtf/CMakeLists.txt 2019-03-13 20:03:34 UTC (rev 242900)
+++ trunk/Source/WTF/wtf/CMakeLists.txt 2019-03-13 20:18:08 UTC (rev 242901)
@@ -1,5 +1,6 @@
set(WTF_PUBLIC_HEADERS
ASCIICType.h
+ AggregateLogger.h
Algorithms.h
Assertions.h
Atomics.h
Modified: trunk/Source/WTF/wtf/Logger.cpp (242900 => 242901)
--- trunk/Source/WTF/wtf/Logger.cpp 2019-03-13 20:03:34 UTC (rev 242900)
+++ trunk/Source/WTF/wtf/Logger.cpp 2019-03-13 20:18:08 UTC (rev 242901)
@@ -27,6 +27,7 @@
#include "Logger.h"
#include <wtf/HexNumber.h>
+#include <wtf/text/WTFString.h>
namespace WTF {
@@ -45,6 +46,15 @@
return builder.toString();
}
+String LogArgument<const void*>::toString(const void* argument)
+{
+ StringBuilder builder;
+ builder.append('(');
+ appendUnsignedAsHex(reinterpret_cast<uintptr_t>(argument), builder);
+ builder.append(')');
+ return builder.toString();
+}
+
} // namespace WTF
using WTF::Logger;
Modified: trunk/Source/WTF/wtf/Logger.h (242900 => 242901)
--- trunk/Source/WTF/wtf/Logger.h 2019-03-13 20:03:34 UTC (rev 242900)
+++ trunk/Source/WTF/wtf/Logger.h 2019-03-13 20:18:08 UTC (rev 242901)
@@ -223,6 +223,8 @@
}
private:
+ friend class AggregateLogger;
+
Logger(const void* owner)
: m_owner { owner }
{
@@ -259,6 +261,9 @@
template<> struct LogArgument<Logger::LogSiteIdentifier> {
static String toString(const Logger::LogSiteIdentifier& value) { return value.toString(); }
};
+template<> struct LogArgument<const void*> {
+ WTF_EXPORT static String toString(const void*);
+};
} // namespace WTF
Modified: trunk/Source/WebCore/ChangeLog (242900 => 242901)
--- trunk/Source/WebCore/ChangeLog 2019-03-13 20:03:34 UTC (rev 242900)
+++ trunk/Source/WebCore/ChangeLog 2019-03-13 20:18:08 UTC (rev 242901)
@@ -1,3 +1,40 @@
+2019-03-13 Jer Noble <jer.no...@apple.com>
+
+ Add AggregateLogger, a Logger specialization for singleton classes.
+ https://bugs.webkit.org/show_bug.cgi?id=195644
+
+ Reviewed by Eric Carlson.
+
+ 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):
+
2019-03-13 Chris Dumez <cdu...@apple.com>
Drop legacy WebCore::toRegistrableDomain() utility function
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSession.h (242900 => 242901)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSession.h 2019-03-13 20:03:34 UTC (rev 242900)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSession.h 2019-03-13 20:18:08 UTC (rev 242901)
@@ -182,9 +182,6 @@
bool hasPlayedSinceLastInterruption() const { return m_hasPlayedSinceLastInterruption; }
void clearHasPlayedSinceLastInterruption() { m_hasPlayedSinceLastInterruption = false; }
-protected:
- PlatformMediaSessionClient& client() const { return m_client; }
-
#if !RELEASE_LOG_DISABLED
const Logger& logger() const final { return m_logger.get(); }
const void* logIdentifier() const override { return reinterpret_cast<const void*>(m_logIdentifier); }
@@ -192,6 +189,9 @@
WTFLogChannel& logChannel() const final;
#endif
+protected:
+ PlatformMediaSessionClient& client() const { return m_client; }
+
private:
PlatformMediaSessionClient& m_client;
State m_state;
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp (242900 => 242901)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp 2019-03-13 20:03:34 UTC (rev 242900)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp 2019-03-13 20:18:08 UTC (rev 242901)
@@ -59,6 +59,9 @@
PlatformMediaSessionManager::PlatformMediaSessionManager()
: m_systemSleepListener(PAL::SystemSleepListener::create(*this))
+#if !RELEASE_LOG_DISABLED
+ , m_logger(AggregateLogger::create(this))
+#endif
{
resetRestrictions();
}
@@ -110,7 +113,7 @@
void PlatformMediaSessionManager::beginInterruption(PlatformMediaSession::InterruptionType type)
{
- LOG(Media, "PlatformMediaSessionManager::beginInterruption");
+ ALWAYS_LOG(LOGIDENTIFIER);
m_interrupted = true;
forEachSession([type] (PlatformMediaSession& session, size_t) {
@@ -121,7 +124,7 @@
void PlatformMediaSessionManager::endInterruption(PlatformMediaSession::EndInterruptionFlags flags)
{
- LOG(Media, "PlatformMediaSessionManager::endInterruption");
+ ALWAYS_LOG(LOGIDENTIFIER);
m_interrupted = false;
forEachSession([flags] (PlatformMediaSession& session, size_t) {
@@ -131,7 +134,7 @@
void PlatformMediaSessionManager::addSession(PlatformMediaSession& session)
{
- LOG(Media, "PlatformMediaSessionManager::addSession - %p", &session);
+ ALWAYS_LOG(LOGIDENTIFIER, session.logIdentifier());
m_sessions.append(&session);
if (m_interrupted)
@@ -143,12 +146,16 @@
if (!m_audioHardwareListener)
m_audioHardwareListener = AudioHardwareListener::create(*this);
+#if !RELEASE_LOG_DISABLED
+ m_logger->addLogger(session.logger());
+#endif
+
updateSessionState();
}
void PlatformMediaSessionManager::removeSession(PlatformMediaSession& session)
{
- LOG(Media, "PlatformMediaSessionManager::removeSession - %p", &session);
+ ALWAYS_LOG(LOGIDENTIFIER, session.logIdentifier());
size_t index = m_sessions.find(&session);
if (index == notFound)
@@ -170,6 +177,10 @@
#endif
}
+#if !RELEASE_LOG_DISABLED
+ m_logger->removeLogger(session.logger());
+#endif
+
updateSessionState();
}
@@ -193,7 +204,7 @@
bool PlatformMediaSessionManager::sessionWillBeginPlayback(PlatformMediaSession& session)
{
- LOG(Media, "PlatformMediaSessionManager::sessionWillBeginPlayback - %p", &session);
+ ALWAYS_LOG(LOGIDENTIFIER, session.logIdentifier());
setCurrentSession(session);
@@ -226,7 +237,7 @@
void PlatformMediaSessionManager::sessionWillEndPlayback(PlatformMediaSession& session)
{
- LOG(Media, "PlatformMediaSessionManager::sessionWillEndPlayback - %p", &session);
+ ALWAYS_LOG(LOGIDENTIFIER, session.logIdentifier());
if (m_sessions.size() < 2)
return;
@@ -253,7 +264,7 @@
m_sessions.remove(pausingSessionIndex);
m_sessions.insert(lastPlayingSessionIndex, &session);
- LOG(Media, "PlatformMediaSessionManager::sessionWillEndPlayback - session moved from index %zu to %zu", pausingSessionIndex, lastPlayingSessionIndex);
+ ALWAYS_LOG(LOGIDENTIFIER, "session moved from index ", pausingSessionIndex, " to ", lastPlayingSessionIndex);
}
void PlatformMediaSessionManager::sessionStateChanged(PlatformMediaSession&)
@@ -263,7 +274,7 @@
void PlatformMediaSessionManager::setCurrentSession(PlatformMediaSession& session)
{
- LOG(Media, "PlatformMediaSessionManager::setCurrentSession - %p", &session);
+ ALWAYS_LOG(LOGIDENTIFIER, session.logIdentifier());
if (m_sessions.size() < 2)
return;
@@ -278,7 +289,7 @@
if (m_remoteCommandListener)
m_remoteCommandListener->updateSupportedCommands();
- LOG(Media, "PlatformMediaSessionManager::setCurrentSession - session moved from index %zu to 0", index);
+ ALWAYS_LOG(LOGIDENTIFIER, "session moved from index ", index, " to 0");
}
PlatformMediaSession* PlatformMediaSessionManager::currentSession() const
@@ -301,7 +312,7 @@
void PlatformMediaSessionManager::applicationWillBecomeInactive() const
{
- LOG(Media, "PlatformMediaSessionManager::applicationWillBecomeInactive");
+ ALWAYS_LOG(LOGIDENTIFIER);
forEachSession([&] (PlatformMediaSession& session, size_t) {
if (m_restrictions[session.mediaType()] & InactiveProcessPlaybackRestricted)
@@ -311,7 +322,7 @@
void PlatformMediaSessionManager::applicationDidBecomeActive() const
{
- LOG(Media, "PlatformMediaSessionManager::applicationDidBecomeActive");
+ ALWAYS_LOG(LOGIDENTIFIER);
forEachSession([&] (PlatformMediaSession& session, size_t) {
if (m_restrictions[session.mediaType()] & InactiveProcessPlaybackRestricted)
@@ -321,7 +332,7 @@
void PlatformMediaSessionManager::applicationDidEnterBackground(bool suspendedUnderLock) const
{
- LOG(Media, "PlatformMediaSessionManager::applicationDidEnterBackground - suspendedUnderLock(%d)", suspendedUnderLock);
+ ALWAYS_LOG(LOGIDENTIFIER, "suspendedUnderLock: ", suspendedUnderLock);
if (m_isApplicationInBackground)
return;
@@ -338,7 +349,7 @@
void PlatformMediaSessionManager::applicationWillEnterForeground(bool suspendedUnderLock) const
{
- LOG(Media, "PlatformMediaSessionManager::applicationWillEnterForeground - suspendedUnderLock(%d)", suspendedUnderLock);
+ ALWAYS_LOG(LOGIDENTIFIER, "suspendedUnderLock: ", suspendedUnderLock);
if (!m_isApplicationInBackground)
return;
@@ -518,4 +529,11 @@
#endif // ENABLE(VIDEO) || ENABLE(WEB_AUDIO)
+#if !RELEASE_LOG_DISABLED
+WTFLogChannel& PlatformMediaSessionManager::logChannel() const
+{
+ return LogMedia;
+}
+#endif
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (242900 => 242901)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2019-03-13 20:03:34 UTC (rev 242900)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2019-03-13 20:18:08 UTC (rev 242901)
@@ -31,6 +31,7 @@
#include "RemoteCommandListener.h"
#include "Timer.h"
#include <pal/system/SystemSleepListener.h>
+#include <wtf/AggregateLogger.h>
#include <wtf/Vector.h>
namespace WebCore {
@@ -40,7 +41,14 @@
class PlatformMediaSession;
class RemoteCommandListener;
-class PlatformMediaSessionManager : private RemoteCommandListenerClient, private PAL::SystemSleepListener::Client, private AudioHardwareListener::Client {
+class PlatformMediaSessionManager
+ : private RemoteCommandListenerClient
+ , private PAL::SystemSleepListener::Client
+ , private AudioHardwareListener::Client
+#if !RELEASE_LOG_DISABLED
+ , private LoggerHelper
+#endif
+{
WTF_MAKE_FAST_ALLOCATED;
public:
WEBCORE_EXPORT static PlatformMediaSessionManager* sharedManagerIfExists();
@@ -133,6 +141,13 @@
AudioHardwareListener* audioHardwareListener() { return m_audioHardwareListener.get(); }
+#if !RELEASE_LOG_DISABLED
+ const Logger& logger() const final { return m_logger; }
+ const void* logIdentifier() const final { return nullptr; }
+ const char* logClassName() const override { return "PlatformMediaSessionManager"; }
+ WTFLogChannel& logChannel() const final;
+#endif
+
private:
friend class Internals;
@@ -172,6 +187,10 @@
#if USE(AUDIO_SESSION)
bool m_becameActive { false };
#endif
+
+#if !RELEASE_LOG_DISABLED
+ Ref<AggregateLogger> m_logger;
+#endif
};
}
Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h (242900 => 242901)
--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h 2019-03-13 20:03:34 UTC (rev 242900)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h 2019-03-13 20:18:08 UTC (rev 242901)
@@ -63,6 +63,10 @@
PlatformMediaSession* nowPlayingEligibleSession();
private:
+#if !RELEASE_LOG_DISABLED
+ const char* logClassName() const override { return "MediaSessionManagerCocoa"; }
+#endif
+
bool m_nowPlayingActive { false };
bool m_registeredAsNowPlayingApplication { false };
Modified: trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm (242900 => 242901)
--- trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm 2019-03-13 20:03:34 UTC (rev 242900)
+++ trunk/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm 2019-03-13 20:18:08 UTC (rev 242901)
@@ -62,7 +62,11 @@
void MediaSessionManagerCocoa::updateSessionState()
{
- LOG(Media, "PlatformMediaSessionManager::scheduleUpdateSessionState() - types: Video(%d), Audio(%d), WebAudio(%d)", count(PlatformMediaSession::Video), count(PlatformMediaSession::Audio), count(PlatformMediaSession::WebAudio));
+ ALWAYS_LOG(LOGIDENTIFIER, "types: "
+ "Video(", count(PlatformMediaSession::Video), "), "
+ "Audio(", count(PlatformMediaSession::Audio), "), "
+ "VideoAudio(", count(PlatformMediaSession::VideoAudio), "), "
+ "WebAudio(", count(PlatformMediaSession::WebAudio), ")");
if (has(PlatformMediaSession::WebAudio))
AudioSession::sharedSession().setPreferredBufferSize(kWebAudioBufferSize);
@@ -136,7 +140,6 @@
if (!PlatformMediaSessionManager::sessionWillBeginPlayback(session))
return false;
- LOG(Media, "MediaSessionManagerCocoa::sessionWillBeginPlayback");
scheduleUpdateNowPlayingInfo();
return true;
}
@@ -149,7 +152,6 @@
void MediaSessionManagerCocoa::removeSession(PlatformMediaSession& session)
{
PlatformMediaSessionManager::removeSession(session);
- LOG(Media, "MediaSessionManagerCocoa::removeSession");
scheduleUpdateNowPlayingInfo();
}
@@ -156,13 +158,12 @@
void MediaSessionManagerCocoa::sessionWillEndPlayback(PlatformMediaSession& session)
{
PlatformMediaSessionManager::sessionWillEndPlayback(session);
- LOG(Media, "MediaSessionManagerCocoa::sessionWillEndPlayback");
updateNowPlayingInfo();
}
-void MediaSessionManagerCocoa::clientCharacteristicsChanged(PlatformMediaSession&)
+void MediaSessionManagerCocoa::clientCharacteristicsChanged(PlatformMediaSession& session)
{
- LOG(Media, "MediaSessionManagerCocoa::clientCharacteristicsChanged");
+ ALWAYS_LOG(LOGIDENTIFIER, session.logIdentifier());
scheduleUpdateNowPlayingInfo();
}
@@ -190,13 +191,13 @@
const PlatformMediaSession* currentSession = this->nowPlayingEligibleSession();
- LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - currentSession = %p", currentSession);
+ ALWAYS_LOG(LOGIDENTIFIER, "currentSession: ", currentSession ? currentSession->logIdentifier() : nullptr);
if (!currentSession) {
if (canLoad_MediaRemote_MRMediaRemoteSetNowPlayingVisibility())
MRMediaRemoteSetNowPlayingVisibility(MRMediaRemoteGetLocalOrigin(), MRNowPlayingClientVisibilityNeverVisible);
- LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - clearing now playing info");
+ ALWAYS_LOG(LOGIDENTIFIER, "clearing now playing info");
MRMediaRemoteSetCanBeNowPlayingApplication(false);
m_registeredAsNowPlayingApplication = false;
@@ -212,7 +213,7 @@
UNUSED_PARAM(error);
#else
if (error)
- LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(stopped) failed with error %ud", error);
+ ALWAYS_LOG(LOGIDENTIFIER, "MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(stopped) failed with error ", error);
#endif
});
@@ -255,8 +256,7 @@
m_lastUpdatedNowPlayingElapsedTime = currentTime;
}
- LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - title = \"%s\", rate = %f, duration = %f, now = %f",
- title.utf8().data(), rate, duration, currentTime);
+ ALWAYS_LOG(LOGIDENTIFIER, "title = \"", title, "\", rate = ", rate, ", duration = ", duration, ", now = ", currentTime);
String parentApplication = currentSession->sourceApplicationIdentifier();
if (canLoad_MediaRemote_MRMediaRemoteSetParentApplication() && !parentApplication.isEmpty())
@@ -268,7 +268,7 @@
#if LOG_DISABLED
UNUSED_PARAM(error);
#else
- LOG(Media, "MediaSessionManagerCocoa::updateNowPlayingInfo - MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(playing) failed with error %ud", error);
+ ALWAYS_LOG(LOGIDENTIFIER, "MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(playing) failed with error ", error);
#endif
});
MRMediaRemoteSetNowPlayingInfo(info.get());
Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h (242900 => 242901)
--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h 2019-03-13 20:03:34 UTC (rev 242900)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h 2019-03-13 20:18:08 UTC (rev 242901)
@@ -58,6 +58,10 @@
void configureWireLessTargetMonitoring() override;
void providePresentingApplicationPIDIfNecessary() final;
+#if !RELEASE_LOG_DISABLED
+ const char* logClassName() const final { return "MediaSessionManageriOS"; }
+#endif
+
RetainPtr<WebMediaSessionHelper> m_objcObserver;
#if HAVE(CELESTIAL)
bool m_havePresentedApplicationPID { false };
Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (242900 => 242901)
--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2019-03-13 20:03:34 UTC (rev 242900)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2019-03-13 20:18:08 UTC (rev 242901)
@@ -137,12 +137,12 @@
{
static const size_t systemMemoryRequiredForVideoInBackgroundTabs = 1024 * 1024 * 1024;
- LOG(Media, "MediaSessionManageriOS::resetRestrictions");
+ ALWAYS_LOG(LOGIDENTIFIER);
PlatformMediaSessionManager::resetRestrictions();
if (ramSize() < systemMemoryRequiredForVideoInBackgroundTabs) {
- LOG(Media, "MediaSessionManageriOS::resetRestrictions - restricting video in background tabs because system memory = %zul", ramSize());
+ ALWAYS_LOG(LOGIDENTIFIER, "restricting video in background tabs because system memory = ", ramSize());
addRestriction(PlatformMediaSession::Video, BackgroundTabPlaybackRestricted);
}
@@ -164,7 +164,7 @@
return session.requiresPlaybackTargetRouteMonitoring();
});
- LOG(Media, "MediaSessionManageriOS::configureWireLessTargetMonitoring - requiresMonitoring = %s", requiresMonitoring ? "true" : "false");
+ ALWAYS_LOG(LOGIDENTIFIER, "requiresMonitoring = ", requiresMonitoring);
BEGIN_BLOCK_OBJC_EXCEPTIONS