Title: [258547] trunk
Revision
258547
Author
ph...@webkit.org
Date
2020-03-17 07:56:07 -0700 (Tue, 17 Mar 2020)

Log Message

RELEASE_LOG should not be Cocoa specific
https://bugs.webkit.org/show_bug.cgi?id=195182

Reviewed by Konstantin Tokarev.

.:

Add a Systemd Journald Logger implementation, enabled by default
in the GTK and WPE ports. When this is enabled, release logs will
be sent to the Systemd Journal. To retrieve media logs for
instance, this command can be used:

$ journalctl WEBKIT_SUBSYSTEM=WebKitGTK WEBKIT_CHANNEL=Media

* Source/cmake/FindSystemd.cmake: Added.
* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:

Source/WebCore:

WPE/GTK build fixes related with Release logging support.

* bridge/npruntime_internal.h:
* dom/ScriptedAnimationController.cpp:
(WebCore::throttlingReasonToString):
* page/PerformanceLogging.cpp:
(WebCore::toString):
* page/PerformanceMonitor.cpp:
(WebCore::stringForCPUSamplingActivityState):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::logChannel const):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(WebCore::MediaPlayerPrivateGStreamer::mediaPlayerLogIdentifier):
(WebCore::MediaPlayerPrivateGStreamer::mediaPlayerLogger):
* platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp:
(WebCore::CDMProxyClearKey::cencDecryptSubsampled):
(WebCore::CDMProxyClearKey::initializeGcrypt):
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
* platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp:
(WebCore::MediaSourceGStreamer::MediaSourceGStreamer):
(WebCore::MediaSourceGStreamer::~MediaSourceGStreamer):
(WebCore::MediaSourceGStreamer::addSourceBuffer):
(WebCore::MediaSourceGStreamer::logChannel const):
* platform/graphics/gstreamer/mse/MediaSourceGStreamer.h:
* platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
(WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer):
(WebCore::SourceBufferPrivateGStreamer::logChannel const):
* platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
* platform/mediastream/AudioMediaStreamTrackRenderer.cpp:
* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::computeLogLevel):
* platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::NetworkStorageSession::getRawCookies const):

Source/WTF:

Add sd-journal logging support and wrap the os_log calls with the USE(OS_LOG) guard.

* wtf/Assertions.cpp:
* wtf/Assertions.h:
* wtf/Logger.h:
(WTF::Logger::log):
* wtf/MemoryPressureHandler.cpp:
(WTF::toString):
* wtf/PlatformGTK.cmake:
* wtf/PlatformWPE.cmake:
* wtf/RefCountedLeakCounter.cpp:

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (258546 => 258547)


--- trunk/ChangeLog	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/ChangeLog	2020-03-17 14:56:07 UTC (rev 258547)
@@ -1,3 +1,21 @@
+2020-03-17  Philippe Normand  <pnorm...@igalia.com>
+
+        RELEASE_LOG should not be Cocoa specific
+        https://bugs.webkit.org/show_bug.cgi?id=195182
+
+        Reviewed by Konstantin Tokarev.
+
+        Add a Systemd Journald Logger implementation, enabled by default
+        in the GTK and WPE ports. When this is enabled, release logs will
+        be sent to the Systemd Journal. To retrieve media logs for
+        instance, this command can be used:
+
+        $ journalctl WEBKIT_SUBSYSTEM=WebKitGTK WEBKIT_CHANNEL=Media
+
+        * Source/cmake/FindSystemd.cmake: Added.
+        * Source/cmake/OptionsGTK.cmake:
+        * Source/cmake/OptionsWPE.cmake:
+
 2020-03-16  Keith Rollin  <krol...@apple.com>
 
         Remove support for WebKitSystemInterface

Modified: trunk/Source/WTF/ChangeLog (258546 => 258547)


--- trunk/Source/WTF/ChangeLog	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WTF/ChangeLog	2020-03-17 14:56:07 UTC (rev 258547)
@@ -1,3 +1,22 @@
+2020-03-17  Philippe Normand  <pnorm...@igalia.com>
+
+        RELEASE_LOG should not be Cocoa specific
+        https://bugs.webkit.org/show_bug.cgi?id=195182
+
+        Reviewed by Konstantin Tokarev.
+
+        Add sd-journal logging support and wrap the os_log calls with the USE(OS_LOG) guard.
+
+        * wtf/Assertions.cpp:
+        * wtf/Assertions.h:
+        * wtf/Logger.h:
+        (WTF::Logger::log):
+        * wtf/MemoryPressureHandler.cpp:
+        (WTF::toString):
+        * wtf/PlatformGTK.cmake:
+        * wtf/PlatformWPE.cmake:
+        * wtf/RefCountedLeakCounter.cpp:
+
 2020-03-16  Keith Miller  <keith_mil...@apple.com>
 
         _javascript_ identifier grammar supports unescaped astral symbols, but JSC doesn’t

Modified: trunk/Source/WTF/wtf/Assertions.cpp (258546 => 258547)


--- trunk/Source/WTF/wtf/Assertions.cpp	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WTF/wtf/Assertions.cpp	2020-03-17 14:56:07 UTC (rev 258547)
@@ -74,6 +74,10 @@
 #include <unistd.h>
 #endif
 
+#if USE(JOURNALD)
+#include <wtf/StringPrintStream.h>
+#endif
+
 namespace WTF {
 
 WTF_ATTRIBUTE_PRINTF(1, 0) static String createWithFormatAndArguments(const char* format, va_list args)
@@ -523,7 +527,7 @@
 
 void WTFInitializeLogChannelStatesFromString(WTFLogChannel* channels[], size_t count, const char* logLevel)
 {
-#if !RELEASE_LOG_DISABLED
+#if USE(OS_LOG) && !RELEASE_LOG_DISABLED
     for (size_t i = 0; i < count; ++i) {
         WTFLogChannel* channel = channels[i];
         channel->osLogChannel = os_log_create(channel->subsystem, channel->name);
@@ -577,6 +581,7 @@
         for (int frameNumber = 1; frameNumber < stackTrace->size(); ++frameNumber) {
             auto stackFrame = stack[frameNumber];
             auto demangled = WTF::StackTrace::demangle(stackFrame);
+#if USE(OS_LOG)
             if (demangled && demangled->demangledName())
                 os_log(channel->osLogChannel, "%-3d %p %{public}s", frameNumber, stackFrame, demangled->demangledName());
             else if (demangled && demangled->mangledName())
@@ -583,6 +588,16 @@
                 os_log(channel->osLogChannel, "%-3d %p %{public}s", frameNumber, stackFrame, demangled->mangledName());
             else
                 os_log(channel->osLogChannel, "%-3d %p", frameNumber, stackFrame);
+#elif USE(JOURNALD)
+            StringPrintStream out;
+            if (demangled && demangled->demangledName())
+                out.printf("%-3d %p %s", frameNumber, stackFrame, demangled->demangledName());
+            else if (demangled && demangled->mangledName())
+                out.printf("%-3d %p %s", frameNumber, stackFrame, demangled->mangledName());
+            else
+                out.printf("%-3d %p", frameNumber, stackFrame);
+            sd_journal_send("WEBKIT_SUBSYSTEM=%s", channel->subsystem, "WEBKIT_CHANNEL=%s", channel->name, "MESSAGE=%s", out.toCString().data(), nullptr);
+#endif
         }
     }
 }

Modified: trunk/Source/WTF/wtf/Assertions.h (258546 => 258547)


--- trunk/Source/WTF/wtf/Assertions.h	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WTF/wtf/Assertions.h	2020-03-17 14:56:07 UTC (rev 258547)
@@ -51,6 +51,11 @@
 #include <os/log.h>
 #endif
 
+#if USE(JOURNALD)
+#define SD_JOURNAL_SUPPRESS_LOCATION
+#include <systemd/sd-journal.h>
+#endif
+
 #ifdef __cplusplus
 #include <cstdlib>
 #include <type_traits>
@@ -91,9 +96,13 @@
 #endif
 
 #ifndef RELEASE_LOG_DISABLED
-#define RELEASE_LOG_DISABLED !(USE(OS_LOG))
+#define RELEASE_LOG_DISABLED !(USE(OS_LOG) || USE(JOURNALD))
 #endif
 
+#ifndef VERBOSE_RELEASE_LOG
+#define VERBOSE_RELEASE_LOG USE(JOURNALD)
+#endif
+
 #if COMPILER(GCC_COMPATIBLE)
 #define WTF_PRETTY_FUNCTION __PRETTY_FUNCTION__
 #else
@@ -154,6 +163,8 @@
     WTFLogLevel level;
 #if !RELEASE_LOG_DISABLED
     const char* subsystem;
+#endif
+#if USE(OS_LOG) && !RELEASE_LOG_DISABLED
     __unsafe_unretained os_log_t osLogChannel;
 #endif
 } WTFLogChannel;
@@ -163,7 +174,13 @@
 #define JOIN_LOG_CHANNEL_WITH_PREFIX(prefix, channel) JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel)
 #define JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel) prefix ## channel
 
+#if PLATFORM(GTK)
+#define LOG_CHANNEL_WEBKIT_SUBSYSTEM "WebKitGTK"
+#elif PLATFORM(WPE)
+#define LOG_CHANNEL_WEBKIT_SUBSYSTEM "WPEWebKit"
+#else
 #define LOG_CHANNEL_WEBKIT_SUBSYSTEM "com.apple.WebKit"
+#endif
 
 #define DECLARE_LOG_CHANNEL(name) \
     extern WTFLogChannel LOG_CHANNEL(name);
@@ -172,11 +189,16 @@
 #if RELEASE_LOG_DISABLED
 #define DEFINE_LOG_CHANNEL(name, subsystem) \
     WTFLogChannel LOG_CHANNEL(name) = { (WTFLogChannelState)0, #name, (WTFLogLevel)1 };
-#else
+#endif
+#if USE(OS_LOG) && !RELEASE_LOG_DISABLED
 #define DEFINE_LOG_CHANNEL(name, subsystem) \
     WTFLogChannel LOG_CHANNEL(name) = { (WTFLogChannelState)0, #name, (WTFLogLevel)1, subsystem, OS_LOG_DEFAULT };
 #endif
+#if USE(JOURNALD) && !RELEASE_LOG_DISABLED
+#define DEFINE_LOG_CHANNEL(name, subsystem)                             \
+    WTFLogChannel LOG_CHANNEL(name) = { (WTFLogChannelState)0, #name, (WTFLogLevel)1, subsystem };
 #endif
+#endif
 
 WTF_EXPORT_PRIVATE void WTFReportNotImplementedYet(const char* file, int line, const char* function);
 WTF_EXPORT_PRIVATE void WTFReportAssertionFailure(const char* file, int line, const char* function, const char* assertion);
@@ -498,17 +520,14 @@
 #define RELEASE_LOG_WITH_LEVEL_IF(isAllowed, channel, level, ...) do { if (isAllowed) RELEASE_LOG_WITH_LEVEL(channel, level, __VA_ARGS__); } while (0)
 
 #define RELEASE_LOG_STACKTRACE(channel) ((void)0)
-#else
+#endif
+
+#if USE(OS_LOG) && !RELEASE_LOG_DISABLED
 #define PUBLIC_LOG_STRING "{public}s"
 #define RELEASE_LOG(channel, ...) os_log(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
 #define RELEASE_LOG_ERROR(channel, ...) os_log_error(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
 #define RELEASE_LOG_FAULT(channel, ...) os_log_fault(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
 #define RELEASE_LOG_INFO(channel, ...) os_log_info(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
-
-#define RELEASE_LOG_IF(isAllowed, channel, ...) do { if (isAllowed) RELEASE_LOG(      channel, __VA_ARGS__); } while (0)
-#define RELEASE_LOG_ERROR_IF(isAllowed, channel, ...) do { if (isAllowed) RELEASE_LOG_ERROR(channel, __VA_ARGS__); } while (0)
-#define RELEASE_LOG_INFO_IF(isAllowed, channel, ...) do { if (isAllowed) RELEASE_LOG_INFO(channel, __VA_ARGS__); } while (0)
-
 #define RELEASE_LOG_WITH_LEVEL(channel, logLevel, ...) do { \
     if (LOG_CHANNEL(channel).level >= (logLevel)) \
         os_log(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__); \
@@ -518,8 +537,37 @@
     if ((isAllowed) && LOG_CHANNEL(channel).level >= (logLevel)) \
         os_log(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__); \
 } while (0)
+#endif
 
+#if USE(JOURNALD) && !RELEASE_LOG_DISABLED
+#define PUBLIC_LOG_STRING "s"
+#define SD_JOURNAL_SEND(channel, priority, file, line, function, ...) sd_journal_send_with_location("CODE_FILE=" file, "CODE_LINE=" line, function, "WEBKIT_SUBSYSTEM=%s", LOG_CHANNEL(channel).subsystem, "WEBKIT_CHANNEL=%s", LOG_CHANNEL(channel).name, "PRIORITY=%i", priority, "MESSAGE=" __VA_ARGS__, nullptr)
+
+#define _XSTRINGIFY(line) #line
+#define _STRINGIFY(line) _XSTRINGIFY(line)
+#define RELEASE_LOG(channel, ...) SD_JOURNAL_SEND(channel, LOG_NOTICE, __FILE__, _STRINGIFY(__LINE__), __func__, __VA_ARGS__)
+#define RELEASE_LOG_ERROR(channel, ...) SD_JOURNAL_SEND(channel, LOG_ERR, __FILE__, _STRINGIFY(__LINE__), __func__, __VA_ARGS__)
+#define RELEASE_LOG_FAULT(channel, ...) SD_JOURNAL_SEND(channel, LOG_CRIT, __FILE__, _STRINGIFY(__LINE__), __func__, __VA_ARGS__)
+#define RELEASE_LOG_INFO(channel, ...) SD_JOURNAL_SEND(channel, LOG_INFO, __FILE__, _STRINGIFY(__LINE__), __func__, __VA_ARGS__)
+
+#define RELEASE_LOG_WITH_LEVEL(channel, logLevel, ...) do { \
+    if (LOG_CHANNEL(channel).level >= (logLevel)) \
+        SD_JOURNAL_SEND(channel, LOG_INFO, __FILE__, _STRINGIFY(__LINE__), __func__, __VA_ARGS__); \
+} while (0)
+
+#define RELEASE_LOG_WITH_LEVEL_IF(isAllowed, channel, logLevel, ...) do { \
+    if ((isAllowed) && LOG_CHANNEL(channel).level >= (logLevel)) \
+        SD_JOURNAL_SEND(channel, LOG_INFO, __FILE__, _STRINGIFY(__LINE__), __func__, __VA_ARGS__); \
+} while (0)
+#endif
+
+#if !RELEASE_LOG_DISABLED
 #define RELEASE_LOG_STACKTRACE(channel) WTFReleaseLogStackTrace(&LOG_CHANNEL(channel))
+#define RELEASE_LOG_IF(isAllowed, channel, ...) do { if (isAllowed) RELEASE_LOG(channel, __VA_ARGS__); } while (0)
+#define RELEASE_LOG_ERROR_IF(isAllowed, channel, ...) do { if (isAllowed) RELEASE_LOG_ERROR(channel, __VA_ARGS__); } while (0)
+#define RELEASE_LOG_INFO_IF(isAllowed, channel, ...) do { if (isAllowed) RELEASE_LOG_INFO(channel, __VA_ARGS__); } while (0)
+
+#define RELEASE_LOG_STACKTRACE(channel) WTFReleaseLogStackTrace(&LOG_CHANNEL(channel))
 #endif
 
 

Modified: trunk/Source/WTF/wtf/Logger.h (258546 => 258547)


--- trunk/Source/WTF/wtf/Logger.h	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WTF/wtf/Logger.h	2020-03-17 14:56:07 UTC (rev 258547)
@@ -29,6 +29,11 @@
 #include <wtf/ThreadSafeRefCounted.h>
 #include <wtf/text/StringBuilder.h>
 
+#if USE(JOURNALD)
+#define SD_JOURNAL_SUPPRESS_LOCATION
+#include <systemd/sd-journal.h>
+#endif
+
 namespace WTF {
 
 template<typename T>
@@ -174,6 +179,57 @@
         log(channel, WTFLogLevel::Debug, arguments...);
     }
 
+    template<typename... Arguments>
+    inline void logAlwaysVerbose(WTFLogChannel& channel, const char* file, const char* function, int line, 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
+        if (!willLog(channel, WTFLogLevel::Always))
+            return;
+
+        logVerbose(channel, WTFLogLevel::Always, file, function, line, arguments...);
+#endif
+    }
+
+    template<typename... Arguments>
+    inline void errorVerbose(WTFLogChannel& channel, const char* file, const char* function, int line, const Arguments&... arguments) const
+    {
+        if (!willLog(channel, WTFLogLevel::Error))
+            return;
+
+        logVerbose(channel, WTFLogLevel::Error, file, function, line, arguments...);
+    }
+
+    template<typename... Arguments>
+    inline void warningVerbose(WTFLogChannel& channel, const char* file, const char* function, int line, const Arguments&... arguments) const
+    {
+        if (!willLog(channel, WTFLogLevel::Warning))
+            return;
+
+        logVerbose(channel, WTFLogLevel::Warning, file, function, line, arguments...);
+    }
+
+    template<typename... Arguments>
+    inline void infoVerbose(WTFLogChannel& channel, const char* file, const char* function, int line, const Arguments&... arguments) const
+    {
+        if (!willLog(channel, WTFLogLevel::Info))
+            return;
+
+        logVerbose(channel, WTFLogLevel::Info, file, function, line, arguments...);
+    }
+
+    template<typename... Arguments>
+    inline void debugVerbose(WTFLogChannel& channel, const char* file, const char* function, int line, const Arguments&... arguments) const
+    {
+        if (!willLog(channel, WTFLogLevel::Debug))
+            return;
+
+        logVerbose(channel, WTFLogLevel::Debug, file, function, line, arguments...);
+    }
+
     inline bool willLog(const WTFLogChannel& channel, WTFLogLevel level) const
     {
         if (!m_enabled)
@@ -245,9 +301,13 @@
 
 #if RELEASE_LOG_DISABLED
         WTFLog(&channel, "%s", logMessage.utf8().data());
-#else
+#endif
+#if USE(OS_LOG) && !RELEASE_LOG_DISABLED
         os_log(channel.osLogChannel, "%{public}s", logMessage.utf8().data());
 #endif
+#if USE(JOURNALD) && !RELEASE_LOG_DISABLED
+        sd_journal_send("WEBKIT_SUBSYSTEM=%s", channel.subsystem, "WEBKIT_CHANNEL=%s", channel.name, "MESSAGE=%s", logMessage.utf8().data(), nullptr);
+#endif
 
         if (channel.state == WTFLogChannelState::Off || level > channel.level)
             return;
@@ -260,6 +320,37 @@
             observer.didLogMessage(channel, level, { ConsoleLogValue<Argument>::toValue(arguments)... });
     }
 
+    template<typename... Argument>
+    static inline void logVerbose(WTFLogChannel& channel, WTFLogLevel level, const char* file, const char* function, int line, const Argument&... arguments)
+    {
+        String logMessage = makeString(LogArgument<Argument>::toString(arguments)...);
+
+#if RELEASE_LOG_DISABLED
+        WTFLogVerbose(file, line, function, &channel, "%s", logMessage.utf8().data());
+#endif
+#if USE(OS_LOG) && !RELEASE_LOG_DISABLED
+        os_log(channel.osLogChannel, "%{public}s", logMessage.utf8().data());
+        UNUSED_PARAM(file);
+        UNUSED_PARAM(line);
+        UNUSED_PARAM(function);
+#endif
+#if USE(JOURNALD) && !RELEASE_LOG_DISABLED
+        auto fileString = makeString("CODE_FILE=", file);
+        auto lineString = makeString("CODE_LINE=", line);
+        sd_journal_send_with_location(fileString.utf8().data(), lineString.utf8().data(), function, "WEBKIT_SUBSYSTEM=%s", channel.subsystem, "WEBKIT_CHANNEL=%s", channel.name, "MESSAGE=%s", logMessage.utf8().data(), nullptr);
+#endif
+
+        if (channel.state == WTFLogChannelState::Off || level > channel.level)
+            return;
+
+        auto lock = tryHoldLock(observerLock());
+        if (!lock)
+            return;
+
+        for (Observer& observer : observers())
+            observer.didLogMessage(channel, level, { ConsoleLogValue<Argument>::toValue(arguments)... });
+    }
+
     static Vector<std::reference_wrapper<Observer>>& observers()
     {
         static NeverDestroyed<Vector<std::reference_wrapper<Observer>>> observers;

Modified: trunk/Source/WTF/wtf/LoggerHelper.h (258546 => 258547)


--- trunk/Source/WTF/wtf/LoggerHelper.h	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WTF/wtf/LoggerHelper.h	2020-03-17 14:56:07 UTC (rev 258547)
@@ -43,18 +43,27 @@
 
 #define LOGIDENTIFIER WTF::Logger::LogSiteIdentifier(logClassName(), __func__, logIdentifier())
 
+#if VERBOSE_RELEASE_LOG
+#define ALWAYS_LOG(...)     logger().logAlwaysVerbose(logChannel(), __FILE__, __func__, __LINE__, __VA_ARGS__)
+#define ERROR_LOG(...)      logger().errorVerbose(logChannel(), __FILE__, __func__, __LINE__, __VA_ARGS__)
+#define WARNING_LOG(...)    logger().warningVerbose(logChannel(), __FILE__, __func__, __LINE__, __VA_ARGS__)
+#define INFO_LOG(...)       logger().infoVerbose(logChannel(), __FILE__, __func__, __LINE__, __VA_ARGS__)
+#define DEBUG_LOG(...)      logger().debugVerbose(logChannel(), __FILE__, __func__, __LINE__, __VA_ARGS__)
+#else
 #define ALWAYS_LOG(...)     logger().logAlways(logChannel(), __VA_ARGS__)
 #define ERROR_LOG(...)      logger().error(logChannel(), __VA_ARGS__)
 #define WARNING_LOG(...)    logger().warning(logChannel(), __VA_ARGS__)
 #define INFO_LOG(...)       logger().info(logChannel(), __VA_ARGS__)
 #define DEBUG_LOG(...)      logger().debug(logChannel(), __VA_ARGS__)
+#endif
+
 #define WILL_LOG(_level_)   logger().willLog(logChannel(), _level_)
 
-#define ALWAYS_LOG_IF(condition, ...)     if (condition) logger().logAlways(logChannel(), __VA_ARGS__)
-#define ERROR_LOG_IF(condition, ...)      if (condition) logger().error(logChannel(), __VA_ARGS__)
-#define WARNING_LOG_IF(condition, ...)    if (condition) logger().warning(logChannel(), __VA_ARGS__)
-#define INFO_LOG_IF(condition, ...)       if (condition) logger().info(logChannel(), __VA_ARGS__)
-#define DEBUG_LOG_IF(condition, ...)      if (condition) logger().debug(logChannel(), __VA_ARGS__)
+#define ALWAYS_LOG_IF(condition, ...)     if (condition) ALWAYS_LOG(__VA_ARGS__)
+#define ERROR_LOG_IF(condition, ...)      if (condition) ERROR_LOG(__VA_ARGS__)
+#define WARNING_LOG_IF(condition, ...)    if (condition) WARNING_LOG(__VA_ARGS__)
+#define INFO_LOG_IF(condition, ...)       if (condition) INFO_LOG(__VA_ARGS__)
+#define DEBUG_LOG_IF(condition, ...)      if (condition) DEBUG_LOG(__VA_ARGS__)
 
 #define ALWAYS_LOG_IF_POSSIBLE(...)     if (loggerPtr()) loggerPtr()->logAlways(logChannel(), __VA_ARGS__)
 #define ERROR_LOG_IF_POSSIBLE(...)      if (loggerPtr()) loggerPtr()->error(logChannel(), __VA_ARGS__)

Modified: trunk/Source/WTF/wtf/MemoryPressureHandler.cpp (258546 => 258547)


--- trunk/Source/WTF/wtf/MemoryPressureHandler.cpp	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WTF/wtf/MemoryPressureHandler.cpp	2020-03-17 14:56:07 UTC (rev 258547)
@@ -36,9 +36,13 @@
 
 #if RELEASE_LOG_DISABLED
 WTFLogChannel LogMemoryPressure = { WTFLogChannelState::On, "MemoryPressure", WTFLogLevel::Error };
-#else
+#endif
+#if USE(OS_LOG) && !RELEASE_LOG_DISABLED
 WTFLogChannel LogMemoryPressure = { WTFLogChannelState::On, "MemoryPressure", WTFLogLevel::Error, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT };
 #endif
+#if USE(JOURNALD) && !RELEASE_LOG_DISABLED
+WTFLogChannel LogMemoryPressure = { WTFLogChannelState::On, "MemoryPressure", WTFLogLevel::Error, LOG_CHANNEL_WEBKIT_SUBSYSTEM };
+#endif
 
 WTF_EXPORT_PRIVATE bool MemoryPressureHandler::ReliefLogger::s_loggingEnabled = false;
 
@@ -83,6 +87,8 @@
     case MemoryUsagePolicy::Conservative: return "Conservative";
     case MemoryUsagePolicy::Strict: return "Strict";
     }
+    ASSERT_NOT_REACHED();
+    return "";
 }
 #endif
 

Modified: trunk/Source/WTF/wtf/PlatformGTK.cmake (258546 => 258547)


--- trunk/Source/WTF/wtf/PlatformGTK.cmake	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WTF/wtf/PlatformGTK.cmake	2020-03-17 14:56:07 UTC (rev 258547)
@@ -62,6 +62,10 @@
     ZLIB::ZLIB
 )
 
+if (Systemd_FOUND)
+    list(APPEND WTF_LIBRARIES Systemd::Systemd)
+endif ()
+
 list(APPEND WTF_SYSTEM_INCLUDE_DIRECTORIES
     ${GIO_UNIX_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}

Modified: trunk/Source/WTF/wtf/PlatformWPE.cmake (258546 => 258547)


--- trunk/Source/WTF/wtf/PlatformWPE.cmake	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WTF/wtf/PlatformWPE.cmake	2020-03-17 14:56:07 UTC (rev 258547)
@@ -47,6 +47,10 @@
     ZLIB::ZLIB
 )
 
+if (Systemd_FOUND)
+    list(APPEND WTF_LIBRARIES Systemd::Systemd)
+endif ()
+
 list(APPEND WTF_SYSTEM_INCLUDE_DIRECTORIES
     ${GIO_UNIX_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}

Modified: trunk/Source/WTF/wtf/RefCountedLeakCounter.cpp (258546 => 258547)


--- trunk/Source/WTF/wtf/RefCountedLeakCounter.cpp	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WTF/wtf/RefCountedLeakCounter.cpp	2020-03-17 14:56:07 UTC (rev 258547)
@@ -41,9 +41,13 @@
 #define LOG_CHANNEL_PREFIX Log
 #if RELEASE_LOG_DISABLED
 static WTFLogChannel LogRefCountedLeaks = { WTFLogChannelState::On, "RefCountedLeaks", WTFLogLevel::Error };
-#else
+#endif
+#if USE(OS_LOG) && !RELEASE_LOG_DISABLED
 static WTFLogChannel LogRefCountedLeaks = { WTFLogChannelState::On, "RefCountedLeaks", WTFLogLevel::Error, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT };
 #endif
+#if USE(JOURNALD) && !RELEASE_LOG_DISABLED
+static WTFLogChannel LogRefCountedLeaks = { WTFLogChannelState::On, "RefCountedLeaks", WTFLogLevel::Error, LOG_CHANNEL_WEBKIT_SUBSYSTEM };
+#endif
 
 typedef HashCountedSet<const char*, PtrHash<const char*>> ReasonSet;
 static ReasonSet* leakMessageSuppressionReasons;

Modified: trunk/Source/WebCore/ChangeLog (258546 => 258547)


--- trunk/Source/WebCore/ChangeLog	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/ChangeLog	2020-03-17 14:56:07 UTC (rev 258547)
@@ -1,3 +1,45 @@
+2020-03-17  Philippe Normand  <pnorm...@igalia.com>
+
+        RELEASE_LOG should not be Cocoa specific
+        https://bugs.webkit.org/show_bug.cgi?id=195182
+
+        Reviewed by Konstantin Tokarev.
+
+        WPE/GTK build fixes related with Release logging support.
+
+        * bridge/npruntime_internal.h:
+        * dom/ScriptedAnimationController.cpp:
+        (WebCore::throttlingReasonToString):
+        * page/PerformanceLogging.cpp:
+        (WebCore::toString):
+        * page/PerformanceMonitor.cpp:
+        (WebCore::stringForCPUSamplingActivityState):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
+        (WebCore::MediaPlayerPrivateGStreamer::logChannel const):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+        (WebCore::MediaPlayerPrivateGStreamer::mediaPlayerLogIdentifier):
+        (WebCore::MediaPlayerPrivateGStreamer::mediaPlayerLogger):
+        * platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp:
+        (WebCore::CDMProxyClearKey::cencDecryptSubsampled):
+        (WebCore::CDMProxyClearKey::initializeGcrypt):
+        * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
+        * platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp:
+        (WebCore::MediaSourceGStreamer::MediaSourceGStreamer):
+        (WebCore::MediaSourceGStreamer::~MediaSourceGStreamer):
+        (WebCore::MediaSourceGStreamer::addSourceBuffer):
+        (WebCore::MediaSourceGStreamer::logChannel const):
+        * platform/graphics/gstreamer/mse/MediaSourceGStreamer.h:
+        * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
+        (WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer):
+        (WebCore::SourceBufferPrivateGStreamer::logChannel const):
+        * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
+        * platform/mediastream/AudioMediaStreamTrackRenderer.cpp:
+        * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
+        (WebCore::computeLogLevel):
+        * platform/network/soup/NetworkStorageSessionSoup.cpp:
+        (WebCore::NetworkStorageSession::getRawCookies const):
+
 2020-03-17  youenn fablet  <you...@apple.com>
 
         Safari doesn't insert mDNS candidates to SDP

Modified: trunk/Source/WebCore/bridge/npruntime_internal.h (258546 => 258547)


--- trunk/Source/WebCore/bridge/npruntime_internal.h	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/bridge/npruntime_internal.h	2020-03-17 14:56:07 UTC (rev 258547)
@@ -35,6 +35,7 @@
 #if defined(MOZ_X11)
     #include <X11/Xresource.h>
 
+    #undef Always
     #undef None
     #undef Above
     #undef Below

Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.cpp (258546 => 258547)


--- trunk/Source/WebCore/dom/ScriptedAnimationController.cpp	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.cpp	2020-03-17 14:56:07 UTC (rev 258547)
@@ -97,6 +97,8 @@
     case ScriptedAnimationController::ThrottlingReason::NonInteractedCrossOriginFrame:
         return "NonInteractiveCrossOriginFrame";
     }
+    RELEASE_ASSERT_NOT_REACHED();
+    return "";
 }
 
 static String throttlingReasonsToString(OptionSet<ScriptedAnimationController::ThrottlingReason> reasons)

Modified: trunk/Source/WebCore/page/PerformanceLogging.cpp (258546 => 258547)


--- trunk/Source/WebCore/page/PerformanceLogging.cpp	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/page/PerformanceLogging.cpp	2020-03-17 14:56:07 UTC (rev 258547)
@@ -48,6 +48,8 @@
     case PerformanceLogging::MainFrameLoadCompleted:
         return "MainFrameLoadCompleted";
     }
+    RELEASE_ASSERT_NOT_REACHED();
+    return "";
 }
 #endif
 

Modified: trunk/Source/WebCore/page/PerformanceMonitor.cpp (258546 => 258547)


--- trunk/Source/WebCore/page/PerformanceMonitor.cpp	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/page/PerformanceMonitor.cpp	2020-03-17 14:56:07 UTC (rev 258547)
@@ -262,6 +262,8 @@
     case ActivityStateForCPUSampling::VisibleAndActive:
         return "VisibleAndActive";
     }
+    RELEASE_ASSERT_NOT_REACHED();
+    return "";
 }
 
 #endif

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (258546 => 258547)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2020-03-17 14:56:07 UTC (rev 258547)
@@ -425,8 +425,7 @@
     , m_preload(player->preload())
     , m_maxTimeLoadedAtLastDidLoadingProgress(MediaTime::zeroTime())
     , m_drawTimer(RunLoop::main(), this, &MediaPlayerPrivateGStreamer::repaint)
-    , m_readyTimerHandler(RunLoop::main(), this, &MediaPlayerPrivateGStreamer::readyTimerFired
-)
+    , m_readyTimerHandler(RunLoop::main(), this, &MediaPlayerPrivateGStreamer::readyTimerFired)
 #if USE(TEXTURE_MAPPER_GL)
 #if USE(NICOSIA)
     , m_nicosiaLayer(Nicosia::ContentLayer::create(Nicosia::ContentLayerTextureMapperImpl::createFactory(*this)))
@@ -433,7 +432,9 @@
 #else
     , m_platformLayerProxy(adoptRef(new TextureMapperPlatformLayerProxy()))
 #endif
-#endif      
+#endif
+    , m_logger(player->mediaPlayerLogger())
+    , m_logIdentifier(player->mediaPlayerLogIdentifier())
 {
 #if USE(GLIB)
     m_readyTimerHandler.setPriority(G_PRIORITY_DEFAULT_IDLE);
@@ -3838,6 +3839,11 @@
     return result;
 }
 
+WTFLogChannel& MediaPlayerPrivateGStreamer::logChannel() const
+{
+    return WebCore::LogMedia;
 }
 
+}
+
 #endif // USE(GSTREAMER)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (258546 => 258547)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2020-03-17 14:56:07 UTC (rev 258547)
@@ -28,6 +28,7 @@
 
 #include "GStreamerCommon.h"
 #include "GStreamerEMEUtilities.h"
+#include "Logging.h"
 #include "MainThreadNotifier.h"
 #include "MediaPlayerPrivate.h"
 #include "PlatformLayer.h"
@@ -37,6 +38,7 @@
 #include <wtf/Atomics.h>
 #include <wtf/Condition.h>
 #include <wtf/Forward.h>
+#include <wtf/LoggerHelper.h>
 #include <wtf/RunLoop.h>
 #include <wtf/WeakPtr.h>
 
@@ -115,7 +117,9 @@
 void registerWebKitGStreamerElements();
 
 // Use eager initialization for the WeakPtrFactory since we call makeWeakPtr() from another thread.
-class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface, public CanMakeWeakPtr<MediaPlayerPrivateGStreamer, WeakPtrFactoryInitialization::Eager>
+class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface
+    , public CanMakeWeakPtr<MediaPlayerPrivateGStreamer, WeakPtrFactoryInitialization::Eager>
+    , private LoggerHelper
 #if USE(TEXTURE_MAPPER_GL)
 #if USE(NICOSIA)
     , public Nicosia::ContentLayerTextureMapperImpl::Client
@@ -226,6 +230,14 @@
     void flushCurrentBuffer();
 #endif
 
+    const Logger& logger() const final { return m_logger; }
+    const char* logClassName() const override { return "MediaPlayerPrivateGStreamer"; }
+    const void* logIdentifier() const final { return reinterpret_cast<const void*>(m_logIdentifier); }
+    WTFLogChannel& logChannel() const override;
+
+    const void* mediaPlayerLogIdentifier() { return logIdentifier(); }
+    const Logger& mediaPlayerLogger() { return logger(); }
+
 protected:
     enum MainThreadNotification {
         VideoChanged = 1 << 0,
@@ -529,6 +541,8 @@
 #if USE(WPE_VIDEO_PLANE_DISPLAY_DMABUF)
     GUniquePtr<struct wpe_video_plane_display_dmabuf_source> m_wpeVideoPlaneDisplayDmaBuf;
 #endif
+    Ref<const Logger> m_logger;
+    const void* m_logIdentifier;
 };
 
 }

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp (258546 => 258547)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp	2020-03-17 14:56:07 UTC (rev 258547)
@@ -171,7 +171,11 @@
             LOG(EME, "EME - subsample index %u - %u bytes encrypted (%lu bytes left to decrypt)", subsampleIndex, subsampleNumEncryptedBytes, input.encryptedBufferSizeInBytes - encryptedBufferByteOffset);
 
             if (gcry_error_t cipherError = gcry_cipher_decrypt(m_gcryHandle, input.encryptedBuffer + encryptedBufferByteOffset, subsampleNumEncryptedBytes, 0, 0)) {
+#if !LOG_DISABLED
                 LOG(EME, "EME - CDMProxyClearKey - ERROR(gcry_cipher_decrypt): %s", gpg_strerror(cipherError));
+#else
+                UNUSED_VARIABLE(cipherError);
+#endif
                 return false;
             }
 
@@ -193,7 +197,11 @@
 void CDMProxyClearKey::initializeGcrypt()
 {
     if (gcry_error_t error = gcry_cipher_open(&m_gcryHandle, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CTR, GCRY_CIPHER_SECURE)) {
+#if !LOG_DISABLED
         LOG(EME, "EME - CDMProxyClearKey - ERROR(gcry_cipher_open): %s", gpg_strerror(error));
+#else
+        UNUSED_VARIABLE(error);
+#endif
         RELEASE_ASSERT(false && "Should not get this far with a functional GCrypt!");
     }
 }

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h (258546 => 258547)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h	2020-03-17 14:56:07 UTC (rev 258547)
@@ -83,6 +83,8 @@
     void blockDurationChanges();
     void unblockDurationChanges();
 
+    WTFLogChannel& logChannel() const final { return WebCore::LogMediaSource; }
+
 private:
     friend class MediaPlayerFactoryGStreamerMSE;
     static void getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>&);

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp (258546 => 258547)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp	2020-03-17 14:56:07 UTC (rev 258547)
@@ -38,6 +38,7 @@
 #if ENABLE(MEDIA_SOURCE) && USE(GSTREAMER)
 
 #include "ContentType.h"
+#include "Logging.h"
 #include "MediaPlayerPrivateGStreamer.h"
 #include "MediaPlayerPrivateGStreamerMSE.h"
 #include "MediaSourceClientGStreamerMSE.h"
@@ -60,11 +61,16 @@
     , m_client(MediaSourceClientGStreamerMSE::create(playerPrivate))
     , m_mediaSource(mediaSource)
     , m_playerPrivate(playerPrivate)
+#if !RELEASE_LOG_DISABLED
+    , m_logger(m_playerPrivate.mediaPlayerLogger())
+    , m_logIdentifier(m_playerPrivate.mediaPlayerLogIdentifier())
+#endif
 {
 }
 
 MediaSourceGStreamer::~MediaSourceGStreamer()
 {
+    ALWAYS_LOG(LOGIDENTIFIER);
     for (auto& sourceBufferPrivate : m_sourceBuffers)
         sourceBufferPrivate->clearMediaSource();
 }
@@ -71,6 +77,7 @@
 
 MediaSourceGStreamer::AddStatus MediaSourceGStreamer::addSourceBuffer(const ContentType& contentType, RefPtr<SourceBufferPrivate>& sourceBufferPrivate)
 {
+    DEBUG_LOG(LOGIDENTIFIER, contentType);
     sourceBufferPrivate = SourceBufferPrivateGStreamer::create(this, m_client.get(), contentType);
     RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivateGStreamer = static_cast<SourceBufferPrivateGStreamer*>(sourceBufferPrivate.get());
     m_sourceBuffers.add(sourceBufferPrivateGStreamer);
@@ -135,5 +142,13 @@
     return m_mediaSource->buffered();
 }
 
+#if !RELEASE_LOG_DISABLED
+WTFLogChannel& MediaSourceGStreamer::logChannel() const
+{
+    return LogMediaSource;
 }
+
 #endif
+
+}
+#endif

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceGStreamer.h (258546 => 258547)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceGStreamer.h	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceGStreamer.h	2020-03-17 14:56:07 UTC (rev 258547)
@@ -39,6 +39,7 @@
 
 #include <wtf/Forward.h>
 #include <wtf/HashSet.h>
+#include <wtf/LoggerHelper.h>
 
 typedef struct _WebKitMediaSrc WebKitMediaSrc;
 
@@ -50,7 +51,11 @@
 class PlatformTimeRanges;
 
 // FIXME: Should this be called MediaSourcePrivateGStreamer?
-class MediaSourceGStreamer final : public MediaSourcePrivate {
+class MediaSourceGStreamer final : public MediaSourcePrivate
+#if !RELEASE_LOG_DISABLED
+    , private LoggerHelper
+#endif
+{
 public:
     static void open(MediaSourcePrivateClient&, MediaPlayerPrivateGStreamerMSE&);
     virtual ~MediaSourceGStreamer();
@@ -73,6 +78,15 @@
 
     std::unique_ptr<PlatformTimeRanges> buffered();
 
+#if !RELEASE_LOG_DISABLED
+    const Logger& logger() const final { return m_logger; }
+    const char* logClassName() const override { return "MediaSourcePrivateGStreamer"; }
+    const void* logIdentifier() const final { return m_logIdentifier; }
+    WTFLogChannel& logChannel() const final;
+
+    const void* nextSourceBufferLogIdentifier() { return childLogIdentifier(m_logIdentifier, ++m_nextSourceBufferID); }
+#endif
+
 private:
     MediaSourceGStreamer(MediaSourcePrivateClient&, MediaPlayerPrivateGStreamerMSE&);
 
@@ -81,6 +95,11 @@
     Ref<MediaSourceClientGStreamerMSE> m_client;
     Ref<MediaSourcePrivateClient> m_mediaSource;
     MediaPlayerPrivateGStreamerMSE& m_playerPrivate;
+#if !RELEASE_LOG_DISABLED
+    Ref<const Logger> m_logger;
+    const void* m_logIdentifier;
+    uint64_t m_nextSourceBufferID { 0 };
+#endif
 };
 
 }

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp (258546 => 258547)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp	2020-03-17 14:56:07 UTC (rev 258547)
@@ -58,6 +58,10 @@
     , m_mediaSource(mediaSource)
     , m_type(contentType)
     , m_client(client.get())
+#if !RELEASE_LOG_DISABLED
+    , m_logger(mediaSource->logger())
+    , m_logIdentifier(mediaSource->nextSourceBufferLogIdentifier())
+#endif
 {
 }
 
@@ -177,5 +181,12 @@
         m_sourceBufferPrivateClient->sourceBufferPrivateAppendComplete(SourceBufferPrivateClient::ParsingFailed);
 }
 
+#if !RELEASE_LOG_DISABLED
+WTFLogChannel& SourceBufferPrivateGStreamer::logChannel() const
+{
+    return LogMediaSource;
 }
 #endif
+
+}
+#endif

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h (258546 => 258547)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h	2020-03-17 14:56:07 UTC (rev 258547)
@@ -41,12 +41,17 @@
 #include "SourceBufferPrivate.h"
 #include "SourceBufferPrivateClient.h"
 #include "WebKitMediaSourceGStreamer.h"
+#include <wtf/LoggerHelper.h>
 
 namespace WebCore {
 
 class MediaSourceGStreamer;
 
-class SourceBufferPrivateGStreamer final : public SourceBufferPrivate {
+class SourceBufferPrivateGStreamer final : public SourceBufferPrivate
+#if !RELEASE_LOG_DISABLED
+    , private LoggerHelper
+#endif
+{
 
 public:
     static Ref<SourceBufferPrivateGStreamer> create(MediaSourceGStreamer*, Ref<MediaSourceClientGStreamerMSE>, const ContentType&);
@@ -79,6 +84,15 @@
 
     ContentType type() const { return m_type; }
 
+#if !RELEASE_LOG_DISABLED
+    const Logger& logger() const final { return m_logger.get(); }
+    const char* logClassName() const override { return "SourceBufferPrivateGStreamer"; }
+    const void* logIdentifier() const final { return m_logIdentifier; }
+    WTFLogChannel& logChannel() const final;
+    const Logger& sourceBufferLogger() const final { return m_logger; }
+    const void* sourceBufferLogIdentifier() final { return logIdentifier(); }
+#endif
+
 private:
     SourceBufferPrivateGStreamer(MediaSourceGStreamer*, Ref<MediaSourceClientGStreamerMSE>, const ContentType&);
     friend class MediaSourceClientGStreamerMSE;
@@ -90,6 +104,11 @@
     bool m_isReadyForMoreSamples = true;
     bool m_notifyWhenReadyForMoreSamples = false;
     AtomString m_trackId;
+
+#if !RELEASE_LOG_DISABLED
+    Ref<const Logger> m_logger;
+    const void* m_logIdentifier;
+#endif
 };
 
 }

Modified: trunk/Source/WebCore/platform/mediastream/AudioMediaStreamTrackRenderer.cpp (258546 => 258547)


--- trunk/Source/WebCore/platform/mediastream/AudioMediaStreamTrackRenderer.cpp	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/platform/mediastream/AudioMediaStreamTrackRenderer.cpp	2020-03-17 14:56:07 UTC (rev 258547)
@@ -28,6 +28,8 @@
 
 #if ENABLE(VIDEO_TRACK) && ENABLE(MEDIA_STREAM)
 
+#include "Logging.h"
+
 #if PLATFORM(COCOA)
 #include "AudioMediaStreamTrackRendererCocoa.h"
 #endif

Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp (258546 => 258547)


--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp	2020-03-17 14:56:07 UTC (rev 258547)
@@ -157,6 +157,8 @@
     case WTFLogLevel::Debug:
         return rtc::LS_VERBOSE;
     }
+    RELEASE_ASSERT_NOT_REACHED();
+    return rtc::LS_NONE;
 #else
     return rtc::LS_NONE;
 #endif

Modified: trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp (258546 => 258547)


--- trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp	2020-03-17 14:56:07 UTC (rev 258547)
@@ -471,6 +471,7 @@
     GUniquePtr<GSList> cookies(soup_cookie_jar_get_cookie_list(cookieStorage(), uri.get(), TRUE));
     UNUSED_PARAM(firstParty);
     UNUSED_PARAM(sameSiteInfo);
+    UNUSED_PARAM(firstParty);
 #endif
     if (!cookies)
         return false;

Added: trunk/Source/cmake/FindSystemd.cmake (0 => 258547)


--- trunk/Source/cmake/FindSystemd.cmake	                        (rev 0)
+++ trunk/Source/cmake/FindSystemd.cmake	2020-03-17 14:56:07 UTC (rev 258547)
@@ -0,0 +1,92 @@
+# Copyright (C) 2020 Igalia S.L.
+#
+# 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 THE COPYRIGHT HOLDER 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 THE COPYRIGHT HOLDER 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.
+
+#[=======================================================================[.rst:
+FindSystemd
+-----------
+
+Find Systemd headers and libraries.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+``Systemd::Systemd``
+  The Systemd library, if found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This will define the following variables in your project:
+
+``Systemd_FOUND``
+  true if (the requested version of) Systemd is available.
+``Systemd_VERSION``
+  the version of Systemd.
+``Systemd_LIBRARIES``
+  the libraries to link against to use Systemd.
+``Systemd_INCLUDE_DIRS``
+  where to find the Systemd headers.
+``Systemd_COMPILE_OPTIONS``
+  this should be passed to target_compile_options(), if the
+  target is not used for linking
+
+#]=======================================================================]
+
+find_package(PkgConfig QUIET)
+
+pkg_check_modules(PC_SYSTEMD QUIET libsystemd)
+set(Systemd_COMPILE_OPTIONS ${PC_SYSTEMD_CFLAGS_OTHER})
+set(Systemd_VERSION ${PC_SYSTEMD_VERSION})
+
+find_path(Systemd_INCLUDE_DIR
+    NAMES systemd/sd-journal.h
+    HINTS ${PC_SYSTEMD_INCLUDEDIR} ${PC_SYSTEMD_INCLUDE_DIRS}
+)
+
+find_library(Systemd_LIBRARY
+    NAMES ${Systemd_NAMES} systemd
+    HINTS ${PC_SYSTEMD_LIBDIR} ${PC_SYSTEMD_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Systemd
+    FOUND_VAR Systemd_FOUND
+    REQUIRED_VARS Systemd_LIBRARY Systemd_INCLUDE_DIR
+    VERSION_VAR Systemd_VERSION
+)
+
+if (Systemd_LIBRARY AND NOT TARGET Systemd::Systemd)
+    add_library(Systemd::Systemd UNKNOWN IMPORTED GLOBAL)
+    set_target_properties(Systemd::Systemd PROPERTIES
+        IMPORTED_LOCATION "${Systemd_LIBRARY}"
+        INTERFACE_COMPILE_OPTIONS "${Systemd_COMPILE_OPTIONS}"
+        INTERFACE_INCLUDE_DIRECTORIES "${Systemd_INCLUDE_DIR}"
+    )
+endif ()
+
+mark_as_advanced(Systemd_INCLUDE_DIR Systemd_LIBRARY)
+
+if (Systemd_FOUND)
+    set(Systemd_LIBRARIES ${Systemd_LIBRARY})
+    set(Systemd_INCLUDE_DIRS ${Systemd_INCLUDE_DIR})
+endif ()

Modified: trunk/Source/cmake/OptionsGTK.cmake (258546 => 258547)


--- trunk/Source/cmake/OptionsGTK.cmake	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/cmake/OptionsGTK.cmake	2020-03-17 14:56:07 UTC (rev 258547)
@@ -87,6 +87,7 @@
 WEBKIT_OPTION_DEFINE(USE_OPENJPEG "Whether to enable support for JPEG2000 images." PUBLIC ON)
 WEBKIT_OPTION_DEFINE(USE_WOFF2 "Whether to enable support for WOFF2 Web Fonts." PUBLIC ON)
 WEBKIT_OPTION_DEFINE(USE_WPE_RENDERER "Whether to enable WPE rendering" PUBLIC ON)
+WEBKIT_OPTION_DEFINE(USE_SYSTEMD "Whether to enable journald logging" PUBLIC ON)
 
 # Private options specific to the GTK port. Changing these options is
 # completely unsupported. They are intended for use only by WebKit developers.
@@ -386,6 +387,16 @@
     endif ()
 endif ()
 
+if (USE_SYSTEMD)
+    find_package(Systemd)
+    if (Systemd_FOUND)
+        message(STATUS "Release logs will be sent to the Systemd journal")
+        SET_AND_EXPOSE_TO_BUILD(USE_JOURNALD TRUE)
+    else ()
+        message(FATAL_ERROR "libsystemd is needed for USE_SYSTEMD")
+    endif ()
+endif ()
+
 # https://bugs.webkit.org/show_bug.cgi?id=182247
 if (ENABLED_COMPILER_SANITIZERS)
     set(ENABLE_INTROSPECTION OFF)

Modified: trunk/Source/cmake/OptionsWPE.cmake (258546 => 258547)


--- trunk/Source/cmake/OptionsWPE.cmake	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Source/cmake/OptionsWPE.cmake	2020-03-17 14:56:07 UTC (rev 258547)
@@ -74,6 +74,7 @@
 WEBKIT_OPTION_DEFINE(USE_OPENJPEG "Whether to enable support for JPEG2000 images." PUBLIC ON)
 WEBKIT_OPTION_DEFINE(USE_WOFF2 "Whether to enable support for WOFF2 Web Fonts." PUBLIC ON)
 WEBKIT_OPTION_DEFINE(ENABLE_WPE_QT_API "Whether to enable support for the Qt5/QML plugin" PUBLIC OFF)
+WEBKIT_OPTION_DEFINE(USE_SYSTEMD "Whether to enable journald logging" PUBLIC ON)
 
 # Private options specific to the WPE port.
 WEBKIT_OPTION_DEFINE(USE_GSTREAMER_HOLEPUNCH "Whether to enable GStreamer holepunch" PRIVATE OFF)
@@ -172,11 +173,22 @@
     find_package(WPEBackend_fdo 1.5.0 REQUIRED)
 endif ()
 
+
 if (ENABLE_WEBXR)
     find_package(OpenXR 1.0)
     SET_AND_EXPOSE_TO_BUILD(USE_OPENXR ${OpenXR_FOUND})
 endif ()
 
+if (USE_SYSTEMD)
+    find_package(Systemd)
+    if (Systemd_FOUND)
+        message(STATUS "Release logs will be sent to the Systemd journal")
+        SET_AND_EXPOSE_TO_BUILD(USE_JOURNALD TRUE)
+    else ()
+        message(FATAL_ERROR "libsystemd is needed for USE_SYSTEMD")
+    endif ()
+endif ()
+
 add_definitions(-DBUILDING_WPE__=1)
 add_definitions(-DGETTEXT_PACKAGE="WPE")
 add_definitions(-DJSC_GLIB_API_ENABLED)

Modified: trunk/Tools/gtk/install-dependencies (258546 => 258547)


--- trunk/Tools/gtk/install-dependencies	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Tools/gtk/install-dependencies	2020-03-17 14:56:07 UTC (rev 258547)
@@ -133,6 +133,7 @@
         libsoup2.4-dev \
         libsqlite3-dev \
         libsrtp2-dev \
+        libsystemd-dev \
         libtasn1-6-dev \
         libtheora-dev \
         libtool \
@@ -307,6 +308,7 @@
         libsecret \
         libsoup \
         libsrtp \
+        libsystemd \
         sqlite \
         libtasn1 \
         libtheora \
@@ -467,6 +469,7 @@
         libsecret-devel \
         libsoup-devel \
         libsrtp-devel \
+        libsystemd-devel \
         libtasn1-devel \
         libtheora-devel \
         libv4l-devel \

Modified: trunk/Tools/wpe/install-dependencies (258546 => 258547)


--- trunk/Tools/wpe/install-dependencies	2020-03-17 11:45:50 UTC (rev 258546)
+++ trunk/Tools/wpe/install-dependencies	2020-03-17 14:56:07 UTC (rev 258547)
@@ -81,6 +81,7 @@
         $(aptIfElse libpng-dev libpng12-dev) \
         libseccomp-dev \
         libsqlite3-dev \
+        libsystemd-dev \
         libtasn1-6-dev \
         libtool \
         libwebp-dev \
@@ -192,6 +193,7 @@
         ruby
         sed \
         sqlite \
+        libsystemd \
         texinfo \
         which \
         zlib \
@@ -291,6 +293,7 @@
         libjpeg-turbo-devel \
         libpng-devel \
         libseccomp-devel \
+        libsystemd-devel \
         libtasn1-devel \
         libtool \
         libwebp-devel \
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to