Make WTFLogChannelState and WTFLogLevel enum classes
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Mar 2019 16:47:04 +0000 (16:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Mar 2019 16:47:04 +0000 (16:47 +0000)
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243141 268f45cc-cd09-0410-ab3c-d52691b4dbfc

27 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/AggregateLogger.h
Source/WTF/wtf/Assertions.cpp
Source/WTF/wtf/Assertions.h
Source/WTF/wtf/Logger.h
Source/WTF/wtf/MemoryPressureHandler.cpp
Source/WTF/wtf/RefCountedLeakCounter.cpp
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediasource/SourceBuffer.cpp
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/html/FTPDirectoryDocument.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/inspector/agents/WebConsoleAgent.cpp
Source/WebCore/platform/Logging.cpp
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm
Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp
Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm
Source/WebCore/platform/network/soup/SoupNetworkSession.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp
Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/Logging.cpp

index d5e352f..76d31ed 100644 (file)
@@ -1,3 +1,23 @@
+2019-03-19  Alex Christensen  <achristensen@webkit.org>
+
+        Make WTFLogChannelState and WTFLogLevel enum classes
+        https://bugs.webkit.org/show_bug.cgi?id=195904
+
+        Reviewed by Eric Carlson.
+
+        * 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:
+
 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         Unreviewed, rolling out r243132.
index 0c4dac0..dd7a199 100644 (file)
@@ -57,32 +57,32 @@ public:
         //  on some systems, so don't allow it.
         UNUSED_PARAM(channel);
 #else
-        log(channel, WTFLogLevelAlways, arguments...);
+        log(channel, WTFLogLevel::Always, arguments...);
 #endif
     }
 
     template<typename... Arguments>
     inline void error(WTFLogChannel& channel, const Arguments&... arguments) const
     {
-        log(channel, WTFLogLevelError, arguments...);
+        log(channel, WTFLogLevel::Error, arguments...);
     }
 
     template<typename... Arguments>
     inline void warning(WTFLogChannel& channel, const Arguments&... arguments) const
     {
-        log(channel, WTFLogLevelWarning, arguments...);
+        log(channel, WTFLogLevel::Warning, arguments...);
     }
 
     template<typename... Arguments>
     inline void info(WTFLogChannel& channel, const Arguments&... arguments) const
     {
-        log(channel, WTFLogLevelInfo, arguments...);
+        log(channel, WTFLogLevel::Info, arguments...);
     }
 
     template<typename... Arguments>
     inline void debug(WTFLogChannel& channel, const Arguments&... arguments) const
     {
-        log(channel, WTFLogLevelDebug, arguments...);
+        log(channel, WTFLogLevel::Debug, arguments...);
     }
 
     inline bool willLog(const WTFLogChannel& channel, WTFLogLevel level) const
index d78ab97..fb7a36b 100644 (file)
@@ -409,15 +409,15 @@ void WTFSetLogChannelLevel(WTFLogChannel* channel, WTFLogLevel level)
 
 bool WTFWillLogWithLevel(WTFLogChannel* channel, WTFLogLevel level)
 {
-    return channel->level >= level && channel->state != WTFLogChannelOff;
+    return channel->level >= level && channel->state != WTFLogChannelState::Off;
 }
 
 void WTFLogWithLevel(WTFLogChannel* channel, WTFLogLevel level, const char* format, ...)
 {
-    if (level != WTFLogLevelAlways && level > channel->level)
+    if (level != WTFLogLevel::Always && level > channel->level)
         return;
 
-    if (channel->level != WTFLogLevelAlways && channel->state == WTFLogChannelOff)
+    if (channel->level != WTFLogLevel::Always && channel->state == WTFLogChannelState::Off)
         return;
 
     va_list args;
@@ -432,15 +432,15 @@ void WTFLogWithLevel(WTFLogChannel* channel, WTFLogLevel level, const char* form
 
 static void WTFLogVaList(WTFLogChannel* channel, const char* format, va_list args)
 {
-    if (channel->state == WTFLogChannelOff)
+    if (channel->state == WTFLogChannelState::Off)
         return;
 
-    if (channel->state == WTFLogChannelOn) {
+    if (channel->state == WTFLogChannelState::On) {
         vprintf_stderr_with_trailing_newline(format, args);
         return;
     }
 
-    ASSERT(channel->state == WTFLogChannelOnWithAccumulation);
+    ASSERT(channel->state == WTFLogChannelState::OnWithAccumulation);
 
     ALLOW_NONLITERAL_FORMAT_BEGIN
     String loggingString = WTF::createWithFormatAndArguments(format, args);
@@ -466,7 +466,7 @@ void WTFLog(WTFLogChannel* channel, const char* format, ...)
 
 void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel* channel, const char* format, ...)
 {
-    if (channel->state != WTFLogChannelOn)
+    if (channel->state != WTFLogChannelState::On)
         return;
 
     va_list args;
@@ -533,9 +533,9 @@ void WTFInitializeLogChannelStatesFromString(WTFLogChannel* channels[], size_t c
         Vector<String> componentInfo = logLevelComponent.split('=');
         String component = componentInfo[0].stripWhiteSpace();
 
-        WTFLogChannelState logChannelState = WTFLogChannelOn;
+        WTFLogChannelState logChannelState = WTFLogChannelState::On;
         if (component.startsWith('-')) {
-            logChannelState = WTFLogChannelOff;
+            logChannelState = WTFLogChannelState::Off;
             component = component.substring(1);
         }
 
@@ -544,17 +544,17 @@ void WTFInitializeLogChannelStatesFromString(WTFLogChannel* channels[], size_t c
             continue;
         }
 
-        WTFLogLevel logChannelLevel = WTFLogLevelError;
+        WTFLogLevel logChannelLevel = WTFLogLevel::Error;
         if (componentInfo.size() > 1) {
             String level = componentInfo[1].stripWhiteSpace();
             if (equalLettersIgnoringASCIICase(level, "error"))
-                logChannelLevel = WTFLogLevelError;
+                logChannelLevel = WTFLogLevel::Error;
             else if (equalLettersIgnoringASCIICase(level, "warning"))
-                logChannelLevel = WTFLogLevelWarning;
+                logChannelLevel = WTFLogLevel::Warning;
             else if (equalLettersIgnoringASCIICase(level, "info"))
-                logChannelLevel = WTFLogLevelInfo;
+                logChannelLevel = WTFLogLevel::Info;
             else if (equalLettersIgnoringASCIICase(level, "debug"))
-                logChannelLevel = WTFLogLevelDebug;
+                logChannelLevel = WTFLogLevel::Debug;
             else
                 WTFLogAlways("Unknown logging level: %s", level.utf8().data());
         }
index 3f457ba..ac1a077 100644 (file)
@@ -148,8 +148,14 @@ extern "C" {
 #define NO_RETURN_DUE_TO_CRASH
 #endif
 
-typedef enum { WTFLogChannelOff, WTFLogChannelOn, WTFLogChannelOnWithAccumulation } WTFLogChannelState;
-typedef enum { WTFLogLevelAlways, WTFLogLevelError, WTFLogLevelWarning, WTFLogLevelInfo, WTFLogLevelDebug } WTFLogLevel;
+#ifdef __cplusplus
+enum class WTFLogChannelState : uint8_t { Off, On, OnWithAccumulation };
+#undef Always
+enum class WTFLogLevel : uint8_t { Always, Error, Warning, Info, Debug };
+#else
+typedef uint8_t WTFLogChannelState;
+typedef uint8_t WTFLogLevel;
+#endif
 
 typedef struct {
     WTFLogChannelState state;
@@ -174,10 +180,10 @@ typedef struct {
 #if !defined(DEFINE_LOG_CHANNEL)
 #if RELEASE_LOG_DISABLED
 #define DEFINE_LOG_CHANNEL(name, subsystem) \
-    WTFLogChannel LOG_CHANNEL(name) = { WTFLogChannelOff, #name, WTFLogLevelError };
+    WTFLogChannel LOG_CHANNEL(name) = { (WTFLogChannelState)0, #name, (WTFLogLevel)1 };
 #else
 #define DEFINE_LOG_CHANNEL(name, subsystem) \
-    WTFLogChannel LOG_CHANNEL(name) = { WTFLogChannelOff, #name, WTFLogLevelError, subsystem, OS_LOG_DEFAULT };
+    WTFLogChannel LOG_CHANNEL(name) = { (WTFLogChannelState)0, #name, (WTFLogLevel)1, subsystem, OS_LOG_DEFAULT };
 #endif
 #endif
 
index d00cc8c..bb87743 100644 (file)
@@ -126,47 +126,47 @@ public:
         //  on some systems, so don't allow it.
         UNUSED_PARAM(channel);
 #else
-        if (!willLog(channel, WTFLogLevelAlways))
+        if (!willLog(channel, WTFLogLevel::Always))
             return;
 
-        log(channel, WTFLogLevelAlways, arguments...);
+        log(channel, WTFLogLevel::Always, arguments...);
 #endif
     }
 
     template<typename... Arguments>
     inline void error(WTFLogChannel& channel, const Arguments&... arguments) const
     {
-        if (!willLog(channel, WTFLogLevelError))
+        if (!willLog(channel, WTFLogLevel::Error))
             return;
 
-        log(channel, WTFLogLevelError, arguments...);
+        log(channel, WTFLogLevel::Error, arguments...);
     }
 
     template<typename... Arguments>
     inline void warning(WTFLogChannel& channel, const Arguments&... arguments) const
     {
-        if (!willLog(channel, WTFLogLevelWarning))
+        if (!willLog(channel, WTFLogLevel::Warning))
             return;
 
-        log(channel, WTFLogLevelWarning, arguments...);
+        log(channel, WTFLogLevel::Warning, arguments...);
     }
 
     template<typename... Arguments>
     inline void info(WTFLogChannel& channel, const Arguments&... arguments) const
     {
-        if (!willLog(channel, WTFLogLevelInfo))
+        if (!willLog(channel, WTFLogLevel::Info))
             return;
 
-        log(channel, WTFLogLevelInfo, arguments...);
+        log(channel, WTFLogLevel::Info, arguments...);
     }
 
     template<typename... Arguments>
     inline void debug(WTFLogChannel& channel, const Arguments&... arguments) const
     {
-        if (!willLog(channel, WTFLogLevelDebug))
+        if (!willLog(channel, WTFLogLevel::Debug))
             return;
 
-        log(channel, WTFLogLevelDebug, arguments...);
+        log(channel, WTFLogLevel::Debug, arguments...);
     }
 
     inline bool willLog(const WTFLogChannel& channel, WTFLogLevel level) const
@@ -174,10 +174,10 @@ public:
         if (!m_enabled)
             return false;
 
-        if (level <= WTFLogLevelError)
+        if (level <= WTFLogLevel::Error)
             return true;
 
-        if (channel.state == WTFLogChannelOff || level > channel.level)
+        if (channel.state == WTFLogChannelState::Off || level > channel.level)
             return false;
 
         return m_enabled;
@@ -242,7 +242,7 @@ private:
         os_log(channel.osLogChannel, "%{public}s", logMessage.utf8().data());
 #endif
 
-        if (channel.state == WTFLogChannelOff || level > channel.level)
+        if (channel.state == WTFLogChannelState::Off || level > channel.level)
             return;
 
         for (Observer& observer : observers())
index 6d78f9f..9e8720f 100644 (file)
@@ -35,9 +35,9 @@
 namespace WTF {
 
 #if RELEASE_LOG_DISABLED
-WTFLogChannel LogMemoryPressure = { WTFLogChannelOn, "MemoryPressure", WTFLogLevelError };
+WTFLogChannel LogMemoryPressure = { WTFLogChannelState::On, "MemoryPressure", WTFLogLevel::Error };
 #else
-WTFLogChannel LogMemoryPressure = { WTFLogChannelOn, "MemoryPressure", WTFLogLevelError, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT };
+WTFLogChannel LogMemoryPressure = { WTFLogChannelState::On, "MemoryPressure", WTFLogLevel::Error, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT };
 #endif
 
 WTF_EXPORT_PRIVATE bool MemoryPressureHandler::ReliefLogger::s_loggingEnabled = false;
index 6e578af..e33facb 100644 (file)
@@ -40,9 +40,9 @@ void RefCountedLeakCounter::decrement() { }
 
 #define LOG_CHANNEL_PREFIX Log
 #if RELEASE_LOG_DISABLED
-static WTFLogChannel LogRefCountedLeaks = { WTFLogChannelOn, "RefCountedLeaks", WTFLogLevelError };
+static WTFLogChannel LogRefCountedLeaks = { WTFLogChannelState::On, "RefCountedLeaks", WTFLogLevel::Error };
 #else
-static WTFLogChannel LogRefCountedLeaks = { WTFLogChannelOn, "RefCountedLeaks", WTFLogLevelError, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT };
+static WTFLogChannel LogRefCountedLeaks = { WTFLogChannelState::On, "RefCountedLeaks", WTFLogLevel::Error, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT };
 #endif
 
 typedef HashCountedSet<const char*, PtrHash<const char*>> ReasonSet;
index 8fd6a04..b65386d 100644 (file)
@@ -1,3 +1,39 @@
+2019-03-19  Alex Christensen  <achristensen@webkit.org>
+
+        Make WTFLogChannelState and WTFLogLevel enum classes
+        https://bugs.webkit.org/show_bug.cgi?id=195904
+
+        Reviewed by Eric Carlson.
+
+        * 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):
+
 2019-03-19  Philippe Normand  <pnormand@igalia.com>
 
         REGRESSION(r243058): [GStreamer] 3 tests now timing out
index 11cf70d..dd565ac 100644 (file)
@@ -741,7 +741,7 @@ static PlatformTimeRanges removeSamplesFromTrackBuffer(const DecodeOrderSampleMa
     size_t bytesRemoved = 0;
     auto logIdentifier = WTF::Logger::LogSiteIdentifier(buffer->logClassName(), logPrefix, buffer->logIdentifier());
     auto& logger = buffer->logger();
-    auto willLog = logger.willLog(buffer->logChannel(), WTFLogLevelDebug);
+    auto willLog = logger.willLog(buffer->logChannel(), WTFLogLevel::Debug);
 #else
     UNUSED_PARAM(logPrefix);
     UNUSED_PARAM(buffer);
index 90ca1be..5038b4f 100644 (file)
@@ -865,7 +865,7 @@ void LibWebRTCMediaEndpoint::OnStatsDelivered(const rtc::scoped_refptr<const web
         }
 
         for (auto iterator = report->begin(); iterator != report->end(); ++iterator) {
-            if (logger().willLog(logChannel(), WTFLogLevelDebug)) {
+            if (logger().willLog(logChannel(), WTFLogLevel::Debug)) {
                 // Stats are very verbose, let's only display them in inspector console in verbose mode.
                 logger().debug(LogWebRTC,
                     Logger::LogSiteIdentifier("LibWebRTCMediaEndpoint", "OnStatsDelivered", logIdentifier()),
@@ -904,7 +904,7 @@ WTFLogChannel& LibWebRTCMediaEndpoint::logChannel() const
 
 Seconds LibWebRTCMediaEndpoint::statsLogInterval(int64_t reportTimestamp) const
 {
-    if (logger().willLog(logChannel(), WTFLogLevelInfo))
+    if (logger().willLog(logChannel(), WTFLogLevel::Info))
         return 2_s;
 
     if (reportTimestamp - m_statsFirstDeliveredTimestamp > 15000000)
index 601520c..a7b1da1 100644 (file)
@@ -8538,18 +8538,18 @@ static MessageSource messageSourceForWTFLogChannel(const WTFLogChannel& channel)
 static MessageLevel messageLevelFromWTFLogLevel(WTFLogLevel level)
 {
     switch (level) {
-    case WTFLogLevelAlways:
+    case WTFLogLevel::Always:
         return MessageLevel::Log;
-    case WTFLogLevelError:
+    case WTFLogLevel::Error:
         return MessageLevel::Error;
         break;
-    case WTFLogLevelWarning:
+    case WTFLogLevel::Warning:
         return MessageLevel::Warning;
         break;
-    case WTFLogLevelInfo:
+    case WTFLogLevel::Info:
         return MessageLevel::Info;
         break;
-    case WTFLogLevelDebug:
+    case WTFLogLevel::Debug:
         return MessageLevel::Debug;
         break;
     }
index 36166f1..02cc080 100644 (file)
@@ -425,7 +425,7 @@ FTPDirectoryDocument::FTPDirectoryDocument(Frame* frame, const URL& url)
     : HTMLDocument(frame, url)
 {
 #if !LOG_DISABLED
-    LogFTP.state = WTFLogChannelOn;
+    LogFTP.state = WTFLogChannelState::On;
 #endif
 }
 
index fb7db52..3f3d7c5 100644 (file)
@@ -3075,7 +3075,7 @@ void HTMLMediaElement::seekTask()
     // time scale, we will ask the media engine to "seek" to the current movie time, which may be a noop and
     // not generate a timechanged callback. This means m_seeking will never be cleared and we will never
     // fire a 'seeked' event.
-    if (willLog(WTFLogLevelDebug)) {
+    if (willLog(WTFLogLevel::Debug)) {
         MediaTime mediaTime = m_player->mediaTimeForTimeValue(time);
         if (time != mediaTime)
             INFO_LOG(LOGIDENTIFIER, time, " media timeline equivalent is ", mediaTime);
@@ -4651,7 +4651,7 @@ URL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, String* ke
     UNUSED_PARAM(keySystem);
 
     // Don't log if this was just called to find out if there are any valid <source> elements.
-    bool shouldLog = willLog(WTFLogLevelDebug) && actionIfInvalid != DoNothing;
+    bool shouldLog = willLog(WTFLogLevel::Debug) && actionIfInvalid != DoNothing;
     if (shouldLog)
         INFO_LOG(LOGIDENTIFIER);
 
@@ -4750,7 +4750,7 @@ CheckAgain:
 
 void HTMLMediaElement::sourceWasAdded(HTMLSourceElement& source)
 {
-    if (willLog(WTFLogLevelInfo) && source.hasTagName(sourceTag)) {
+    if (willLog(WTFLogLevel::Info) && source.hasTagName(sourceTag)) {
         URL url = source.getNonEmptyURLAttribute(srcAttr);
         INFO_LOG(LOGIDENTIFIER, "'src' is ", url);
     }
@@ -4802,7 +4802,7 @@ void HTMLMediaElement::sourceWasAdded(HTMLSourceElement& source)
 
 void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement& source)
 {
-    if (willLog(WTFLogLevelInfo) && source.hasTagName(sourceTag)) {
+    if (willLog(WTFLogLevel::Info) && source.hasTagName(sourceTag)) {
         URL url = source.getNonEmptyURLAttribute(srcAttr);
         INFO_LOG(LOGIDENTIFIER, "'src' is ", url);
     }
index ac18a67..9d5eb0b 100644 (file)
@@ -68,15 +68,15 @@ void WebConsoleAgent::getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Insp
             return;
 
         auto level = Inspector::Protocol::Console::ChannelLevel::Off;
-        if (logChannel->state != WTFLogChannelOff) {
+        if (logChannel->state != WTFLogChannelState::Off) {
             switch (logChannel->level) {
-            case WTFLogLevelAlways:
-            case WTFLogLevelError:
-            case WTFLogLevelWarning:
-            case WTFLogLevelInfo:
+            case WTFLogLevel::Always:
+            case WTFLogLevel::Error:
+            case WTFLogLevel::Warning:
+            case WTFLogLevel::Info:
                 level = Inspector::Protocol::Console::ChannelLevel::Basic;
                 break;
-            case WTFLogLevelDebug:
+            case WTFLogLevel::Debug:
                 level = Inspector::Protocol::Console::ChannelLevel::Verbose;
                 break;
             }
@@ -96,14 +96,14 @@ static Optional<std::pair<WTFLogChannelState, WTFLogLevel>> channelConfiguration
     WTFLogLevel level;
 
     if (equalIgnoringASCIICase(levelString, "off")) {
-        state = WTFLogChannelOff;
-        level = WTFLogLevelError;
+        state = WTFLogChannelState::Off;
+        level = WTFLogLevel::Error;
     } else {
-        state = WTFLogChannelOn;
+        state = WTFLogChannelState::On;
         if (equalIgnoringASCIICase(levelString, "basic"))
-            level = WTFLogLevelWarning;
+            level = WTFLogLevel::Warning;
         else if (equalIgnoringASCIICase(levelString, "verbose"))
-            level = WTFLogLevelDebug;
+            level = WTFLogLevel::Debug;
         else
             return WTF::nullopt;
     }
index aec5866..899141c 100644 (file)
@@ -54,7 +54,7 @@ bool isLogChannelEnabled(const String& name)
     WTFLogChannel* channel = WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data());
     if (!channel)
         return false;
-    return channel->state != WTFLogChannelOff;
+    return channel->state != WTFLogChannelState::Off;
 }
 
 static bool logChannelsNeedInitialization = true;
@@ -65,7 +65,7 @@ void setLogChannelToAccumulate(const String& name)
     if (!channel)
         return;
 
-    channel->state = WTFLogChannelOnWithAccumulation;
+    channel->state = WTFLogChannelState::OnWithAccumulation;
     logChannelsNeedInitialization = true;
 }
 
index 013daf1..5e293ba 100644 (file)
@@ -3551,7 +3551,7 @@ NSArray* playerKVOProperties()
         }
 
 #if !RELEASE_LOG_DISABLED
-        if (player->logger().willLog(player->logChannel(), WTFLogLevelDebug) && !([keyPath isEqualToString:@"loadedTimeRanges"] || [keyPath isEqualToString:@"seekableTimeRanges"])) {
+        if (player->logger().willLog(player->logChannel(), WTFLogLevel::Debug) && !([keyPath isEqualToString:@"loadedTimeRanges"] || [keyPath isEqualToString:@"seekableTimeRanges"])) {
             auto identifier = Logger::LogSiteIdentifier("MediaPlayerPrivateAVFoundation", "observeValueForKeyPath", player->logIdentifier());
 
             if (shouldLogValue) {
index aee7465..d0e92b2 100644 (file)
@@ -385,7 +385,7 @@ void MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample(MediaStreamTrackPr
     sample.offsetTimestampsBy(timelineOffset);
     DEBUG_LOG(LOGIDENTIFIER, "updated sample = ", sample);
 
-    if (WILL_LOG(WTFLogLevelDebug)) {
+    if (WILL_LOG(WTFLogLevel::Debug)) {
         MediaTime now = streamTime();
         double delta = (sample.presentationTime() - now).toDouble();
         if (delta < 0)
index 2f6f510..e1c97fe 100644 (file)
@@ -34,7 +34,7 @@ namespace WebCore {
 static inline bool compositingLogEnabled()
 {
 #if !LOG_DISABLED
-    return LogCompositing.state == WTFLogChannelOn;
+    return LogCompositing.state == WTFLogChannelState::On;
 #else
     return false;
 #endif
index b3c9854..ffe50e6 100644 (file)
@@ -142,25 +142,25 @@ static rtc::LoggingSeverity computeLogLevel()
 {
 #if defined(NDEBUG)
 #if !LOG_DISABLED || !RELEASE_LOG_DISABLED
-    if (LogWebRTC.state != WTFLogChannelOn)
+    if (LogWebRTC.state != WTFLogChannelState::On)
         return rtc::LS_ERROR;
 
     switch (LogWebRTC.level) {
-    case WTFLogLevelAlways:
-    case WTFLogLevelError:
+    case WTFLogLevel::Always:
+    case WTFLogLevel::Error:
         return rtc::LS_ERROR;
-    case WTFLogLevelWarning:
+    case WTFLogLevel::Warning:
         return rtc::LS_WARNING;
-    case WTFLogLevelInfo:
+    case WTFLogLevel::Info:
         return rtc::LS_INFO;
-    case WTFLogLevelDebug:
+    case WTFLogLevel::Debug:
         return rtc::LS_VERBOSE;
     }
 #else
     return rtc::LS_NONE;
 #endif
 #else
-    return (LogWebRTC.state != WTFLogChannelOn) ? rtc::LS_WARNING : rtc::LS_INFO;
+    return (LogWebRTC.state != WTFLogChannelState::On) ? rtc::LS_WARNING : rtc::LS_INFO;
 #endif
 }
 
index 96ed7f1..7f3ec82 100644 (file)
@@ -745,7 +745,7 @@ void AVVideoCaptureSource::deviceDisconnected(RetainPtr<NSNotification> notifica
     bool willChange = [[change valueForKey:NSKeyValueChangeNotificationIsPriorKey] boolValue];
 
 #if !RELEASE_LOG_DISABLED
-    if (m_callback->loggerPtr() && m_callback->logger().willLog(m_callback->logChannel(), WTFLogLevelDebug)) {
+    if (m_callback->loggerPtr() && m_callback->logger().willLog(m_callback->logChannel(), WTFLogLevel::Debug)) {
         auto identifier = Logger::LogSiteIdentifier("AVVideoCaptureSource", "observeValueForKeyPath", m_callback->logIdentifier());
 
         RetainPtr<NSString> valueString = adoptNS([[NSString alloc] initWithFormat:@"%@", newValue]);
index dcc8d51..0734073 100644 (file)
@@ -156,7 +156,7 @@ SoupNetworkSession::~SoupNetworkSession() = default;
 void SoupNetworkSession::setupLogger()
 {
 #if !LOG_DISABLED
-    if (LogNetwork.state != WTFLogChannelOn || soup_session_get_feature(m_soupSession.get(), SOUP_TYPE_LOGGER))
+    if (LogNetwork.state != WTFLogChannelState::On || soup_session_get_feature(m_soupSession.get(), SOUP_TYPE_LOGGER))
         return;
 
     GRefPtr<SoupLogger> logger = adoptGRef(soup_logger_new(SOUP_LOGGER_LOG_BODY, -1));
index 9011074..8f5ca6b 100644 (file)
@@ -273,7 +273,7 @@ struct RenderLayerCompositor::OverlapExtent {
 #if !LOG_DISABLED
 static inline bool compositingLogEnabled()
 {
-    return LogCompositing.state == WTFLogChannelOn;
+    return LogCompositing.state == WTFLogChannelState::On;
 }
 #endif
 
index 80c0406..726ba75 100644 (file)
@@ -1,3 +1,15 @@
+2019-03-19  Alex Christensen  <achristensen@webkit.org>
+
+        Make WTFLogChannelState and WTFLogLevel enum classes
+        https://bugs.webkit.org/show_bug.cgi?id=195904
+
+        Reviewed by Eric Carlson.
+
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
+        (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
+        * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
+        (WebKit::NetworkRTCProvider::NetworkRTCProvider):
+
 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         Unreviewed, rolling out r243132.
index 8ce6fa9..40ccc5e 100644 (file)
@@ -67,7 +67,7 @@ static void printSpeculativeLoadingDiagnosticMessageCounts()
 static void logSpeculativeLoadingDiagnosticMessage(NetworkProcess& networkProcess, const GlobalFrameID& frameID, const String& message)
 {
 #if !LOG_DISABLED
-    if (WebKit2LogNetworkCacheSpeculativePreloading.state == WTFLogChannelOn)
+    if (WebKit2LogNetworkCacheSpeculativePreloading.state == WTFLogChannelState::On)
         allSpeculativeLoadingDiagnosticMessages().add(message);
 #endif
     networkProcess.logDiagnosticMessage(frameID.first, WebCore::DiagnosticLoggingKeys::networkCacheKey(), message, WebCore::ShouldSample::Yes);
index dd97798..1c1ff02 100644 (file)
@@ -65,7 +65,7 @@ NetworkRTCProvider::NetworkRTCProvider(NetworkConnectionToWebProcess& connection
 #if defined(NDEBUG)
     rtc::LogMessage::LogToDebug(rtc::LS_NONE);
 #else
-    if (WebKit2LogWebRTC.state != WTFLogChannelOn)
+    if (WebKit2LogWebRTC.state != WTFLogChannelState::On)
         rtc::LogMessage::LogToDebug(rtc::LS_WARNING);
 #endif
 }
index ca9f081..832f951 100644 (file)
@@ -1,3 +1,13 @@
+2019-03-19  Alex Christensen  <achristensen@webkit.org>
+
+        Make WTFLogChannelState and WTFLogLevel enum classes
+        https://bugs.webkit.org/show_bug.cgi?id=195904
+
+        Reviewed by Eric Carlson.
+
+        * TestWebKitAPI/Tests/WebCore/Logging.cpp:
+        (TestWebKitAPI::TEST_F):
+
 2019-03-19  Xabier Rodriguez Calvar  <calvaris@igalia.com>
 
         [GStreamer][EME] Backported mssdemux protection data crash fix
index 0c15a6d..2c0af8b 100644 (file)
@@ -72,10 +72,10 @@ public:
         m_stderr = fdopen(m_descriptors[0], "r");
 
         WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "all");
-        WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelError);
-        WTFSetLogChannelLevel(&TestChannel2, WTFLogLevelError);
-        WTFSetLogChannelLevel(&TestChannel3, WTFLogLevelError);
-        WTFSetLogChannelLevel(&TestChannel4, WTFLogLevelError);
+        WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Error);
+        WTFSetLogChannelLevel(&TestChannel2, WTFLogLevel::Error);
+        WTFSetLogChannelLevel(&TestChannel3, WTFLogLevel::Error);
+        WTFSetLogChannelLevel(&TestChannel4, WTFLogLevel::Error);
     }
 
     void TearDown() override
@@ -110,86 +110,86 @@ private:
 
 TEST_F(LoggingTest, Initialization)
 {
-    EXPECT_EQ(TestChannel1.state, WTFLogChannelOn);
-    EXPECT_EQ(TestChannel2.state, WTFLogChannelOn);
-    EXPECT_EQ(TestChannel3.state, WTFLogChannelOn);
-    EXPECT_EQ(TestChannel4.state, WTFLogChannelOn);
+    EXPECT_EQ(TestChannel1.state, WTFLogChannelState::On);
+    EXPECT_EQ(TestChannel2.state, WTFLogChannelState::On);
+    EXPECT_EQ(TestChannel3.state, WTFLogChannelState::On);
+    EXPECT_EQ(TestChannel4.state, WTFLogChannelState::On);
 
-    EXPECT_EQ(TestChannel1.level, WTFLogLevelError);
-    EXPECT_EQ(TestChannel2.level, WTFLogLevelError);
-    EXPECT_EQ(TestChannel3.level, WTFLogLevelError);
-    EXPECT_EQ(TestChannel4.level, WTFLogLevelError);
+    EXPECT_EQ(TestChannel1.level, WTFLogLevel::Error);
+    EXPECT_EQ(TestChannel2.level, WTFLogLevel::Error);
+    EXPECT_EQ(TestChannel3.level, WTFLogLevel::Error);
+    EXPECT_EQ(TestChannel4.level, WTFLogLevel::Error);
 
-    TestChannel1.state = WTFLogChannelOff;
+    TestChannel1.state = WTFLogChannelState::Off;
     WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "Channel1");
-    EXPECT_EQ(TestChannel1.level, WTFLogLevelError);
-    EXPECT_EQ(TestChannel1.state, WTFLogChannelOn);
+    EXPECT_EQ(TestChannel1.level, WTFLogLevel::Error);
+    EXPECT_EQ(TestChannel1.state, WTFLogChannelState::On);
 
-    TestChannel1.state = WTFLogChannelOff;
+    TestChannel1.state = WTFLogChannelState::Off;
     WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "Channel1=foo");
-    EXPECT_EQ(TestChannel1.level, WTFLogLevelError);
+    EXPECT_EQ(TestChannel1.level, WTFLogLevel::Error);
 #if TEST_OUTPUT
     EXPECT_TRUE(output().contains("Unknown logging level: foo", false));
 #endif
 
     WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "Channel1=warning");
-    EXPECT_EQ(TestChannel1.level, WTFLogLevelWarning);
-    EXPECT_EQ(TestChannel2.level, WTFLogLevelError);
-    EXPECT_EQ(TestChannel3.level, WTFLogLevelError);
-    EXPECT_EQ(TestChannel4.level, WTFLogLevelError);
+    EXPECT_EQ(TestChannel1.level, WTFLogLevel::Warning);
+    EXPECT_EQ(TestChannel2.level, WTFLogLevel::Error);
+    EXPECT_EQ(TestChannel3.level, WTFLogLevel::Error);
+    EXPECT_EQ(TestChannel4.level, WTFLogLevel::Error);
 
     WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "Channel4=   debug, Channel3 = info,Channel2=error");
-    EXPECT_EQ(TestChannel1.level, WTFLogLevelWarning);
-    EXPECT_EQ(TestChannel2.level, WTFLogLevelError);
-    EXPECT_EQ(TestChannel3.level, WTFLogLevelInfo);
-    EXPECT_EQ(TestChannel4.level, WTFLogLevelDebug);
+    EXPECT_EQ(TestChannel1.level, WTFLogLevel::Warning);
+    EXPECT_EQ(TestChannel2.level, WTFLogLevel::Error);
+    EXPECT_EQ(TestChannel3.level, WTFLogLevel::Info);
+    EXPECT_EQ(TestChannel4.level, WTFLogLevel::Debug);
 
     WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "-all");
-    EXPECT_EQ(TestChannel1.state, WTFLogChannelOff);
-    EXPECT_EQ(TestChannel2.state, WTFLogChannelOff);
-    EXPECT_EQ(TestChannel3.state, WTFLogChannelOff);
-    EXPECT_EQ(TestChannel4.state, WTFLogChannelOff);
+    EXPECT_EQ(TestChannel1.state, WTFLogChannelState::Off);
+    EXPECT_EQ(TestChannel2.state, WTFLogChannelState::Off);
+    EXPECT_EQ(TestChannel3.state, WTFLogChannelState::Off);
+    EXPECT_EQ(TestChannel4.state, WTFLogChannelState::Off);
 
     WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "all");
-    EXPECT_EQ(TestChannel1.state, WTFLogChannelOn);
-    EXPECT_EQ(TestChannel2.state, WTFLogChannelOn);
-    EXPECT_EQ(TestChannel3.state, WTFLogChannelOn);
-    EXPECT_EQ(TestChannel4.state, WTFLogChannelOn);
+    EXPECT_EQ(TestChannel1.state, WTFLogChannelState::On);
+    EXPECT_EQ(TestChannel2.state, WTFLogChannelState::On);
+    EXPECT_EQ(TestChannel3.state, WTFLogChannelState::On);
+    EXPECT_EQ(TestChannel4.state, WTFLogChannelState::On);
 }
 
 TEST_F(LoggingTest, WTFWillLogWithLevel)
 {
-    EXPECT_EQ(TestChannel1.state, WTFLogChannelOn);
-    EXPECT_EQ(TestChannel2.state, WTFLogChannelOn);
-    EXPECT_EQ(TestChannel3.state, WTFLogChannelOn);
-    EXPECT_EQ(TestChannel4.state, WTFLogChannelOn);
-
-    EXPECT_EQ(TestChannel1.level, WTFLogLevelError);
-    EXPECT_EQ(TestChannel2.level, WTFLogLevelError);
-    EXPECT_EQ(TestChannel3.level, WTFLogLevelError);
-    EXPECT_EQ(TestChannel4.level, WTFLogLevelError);
-
-    EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelError));
-    EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel2, WTFLogLevelError));
-    EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel3, WTFLogLevelError));
-    EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel4, WTFLogLevelError));
-
-    EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelInfo));
-    EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel2, WTFLogLevelInfo));
-    EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel3, WTFLogLevelInfo));
-    EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel4, WTFLogLevelInfo));
-
-    TestChannel1.state = WTFLogChannelOff;
-    EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelError));
-    EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelInfo));
-
-    TestChannel1.state = WTFLogChannelOn;
-    EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelError));
-    EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelInfo));
-
-    TestChannel1.level = WTFLogLevelInfo;
-    EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelError));
-    EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelInfo));
+    EXPECT_EQ(TestChannel1.state, WTFLogChannelState::On);
+    EXPECT_EQ(TestChannel2.state, WTFLogChannelState::On);
+    EXPECT_EQ(TestChannel3.state, WTFLogChannelState::On);
+    EXPECT_EQ(TestChannel4.state, WTFLogChannelState::On);
+
+    EXPECT_EQ(TestChannel1.level, WTFLogLevel::Error);
+    EXPECT_EQ(TestChannel2.level, WTFLogLevel::Error);
+    EXPECT_EQ(TestChannel3.level, WTFLogLevel::Error);
+    EXPECT_EQ(TestChannel4.level, WTFLogLevel::Error);
+
+    EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Error));
+    EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel2, WTFLogLevel::Error));
+    EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel3, WTFLogLevel::Error));
+    EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel4, WTFLogLevel::Error));
+
+    EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Info));
+    EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel2, WTFLogLevel::Info));
+    EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel3, WTFLogLevel::Info));
+    EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel4, WTFLogLevel::Info));
+
+    TestChannel1.state = WTFLogChannelState::Off;
+    EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Error));
+    EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Info));
+
+    TestChannel1.state = WTFLogChannelState::On;
+    EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Error));
+    EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Info));
+
+    TestChannel1.level = WTFLogLevel::Info;
+    EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Error));
+    EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Info));
 }
 
 #if TEST_OUTPUT
@@ -201,21 +201,21 @@ TEST_F(LoggingTest, LOG)
 
 TEST_F(LoggingTest, LOG_WITH_LEVEL)
 {
-    LOG_WITH_LEVEL(Channel1, WTFLogLevelError, "Go and boil your bottoms, you sons of a silly person.");
+    LOG_WITH_LEVEL(Channel1, WTFLogLevel::Error, "Go and boil your bottoms, you sons of a silly person.");
     EXPECT_TRUE(output().contains("sons of a silly person.", false));
 
-    LOG_WITH_LEVEL(Channel1, WTFLogLevelWarning, "You don't frighten us, English pig dogs.");
+    LOG_WITH_LEVEL(Channel1, WTFLogLevel::Warning, "You don't frighten us, English pig dogs.");
     EXPECT_EQ(0u, output().length());
 
-    WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelInfo);
-    LOG_WITH_LEVEL(Channel1, WTFLogLevelWarning, "I'm French. Why do you think I have this outrageous accent, you silly king?");
+    WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Info);
+    LOG_WITH_LEVEL(Channel1, WTFLogLevel::Warning, "I'm French. Why do you think I have this outrageous accent, you silly king?");
     EXPECT_TRUE(output().contains("outrageous accent", false));
 
-    LOG_WITH_LEVEL(Channel1, WTFLogLevelDebug, "You don't frighten us with your silly knees-bent running around advancing behavior!");
+    LOG_WITH_LEVEL(Channel1, WTFLogLevel::Debug, "You don't frighten us with your silly knees-bent running around advancing behavior!");
     EXPECT_EQ(0u, output().length());
 
-    WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelDebug);
-    LOG_WITH_LEVEL(Channel1, WTFLogLevelDebug, "Go and tell your master that we have been charged by God with a sacred quest.");
+    WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Debug);
+    LOG_WITH_LEVEL(Channel1, WTFLogLevel::Debug, "Go and tell your master that we have been charged by God with a sacred quest.");
     EXPECT_TRUE(output().contains("sacred quest", false));
 }
 
@@ -238,35 +238,35 @@ TEST_F(LoggingTest, RELEASE_LOG_IF)
 
 TEST_F(LoggingTest, RELEASE_LOG_WITH_LEVEL)
 {
-    RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevelError, "You don't frighten us, English pig dogs.");
+    RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel::Error, "You don't frighten us, English pig dogs.");
     EXPECT_TRUE(output().contains("pig dogs.", false));
 
-    RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevelWarning, "Go and boil your bottoms, you sons of a silly person.");
+    RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel::Warning, "Go and boil your bottoms, you sons of a silly person.");
     EXPECT_EQ(0u, output().length());
 
-    WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelInfo);
-    RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevelWarning, "I'm French. Why do you think I have this outrageous accent, you silly king?");
+    WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Info);
+    RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel::Warning, "I'm French. Why do you think I have this outrageous accent, you silly king?");
     EXPECT_TRUE(output().contains("outrageous accent", false));
 
-    RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevelDebug, "You don't frighten us with your silly knees-bent running around advancing behavior!");
+    RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel::Debug, "You don't frighten us with your silly knees-bent running around advancing behavior!");
     EXPECT_EQ(0u, output().length());
 
-    WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelDebug);
-    RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevelDebug, "Go and tell your master that we have been charged by God with a sacred quest.");
+    WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Debug);
+    RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel::Debug, "Go and tell your master that we have been charged by God with a sacred quest.");
     EXPECT_TRUE(output().contains("sacred quest", false));
 }
 
 TEST_F(LoggingTest, RELEASE_LOG_WITH_LEVEL_IF)
 {
     bool enabled = true;
-    RELEASE_LOG_WITH_LEVEL_IF(enabled, Channel1, WTFLogLevelError, "Is there someone else up there that we can talk to?");
+    RELEASE_LOG_WITH_LEVEL_IF(enabled, Channel1, WTFLogLevel::Error, "Is there someone else up there that we can talk to?");
     EXPECT_TRUE(output().contains("someone else", false));
 
-    RELEASE_LOG_WITH_LEVEL_IF(enabled, Channel1, WTFLogLevelDebug, "No, now go away");
+    RELEASE_LOG_WITH_LEVEL_IF(enabled, Channel1, WTFLogLevel::Debug, "No, now go away");
     EXPECT_EQ(0u, output().length());
 
     enabled = false;
-    RELEASE_LOG_WITH_LEVEL_IF(enabled, Channel1, WTFLogLevelWarning, "or I shall taunt you a second time! %i", 12);
+    RELEASE_LOG_WITH_LEVEL_IF(enabled, Channel1, WTFLogLevel::Warning, "or I shall taunt you a second time! %i", 12);
     EXPECT_EQ(0u, output().length());
 }
 
@@ -275,8 +275,8 @@ TEST_F(LoggingTest, Logger)
     Ref<Logger> logger = Logger::create(this);
     EXPECT_TRUE(logger->enabled());
 
-    WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelError);
-    EXPECT_TRUE(logger->willLog(TestChannel1, WTFLogLevelError));
+    WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Error);
+    EXPECT_TRUE(logger->willLog(TestChannel1, WTFLogLevel::Error));
     logger->error(TestChannel1, "You're using coconuts!");
     EXPECT_TRUE(output().contains("You're using coconuts!", false));
     logger->warning(TestChannel1, "You're using coconuts!");
@@ -305,15 +305,15 @@ TEST_F(LoggingTest, Logger)
     logger->error(TestChannel1, "You've got ", 2, " empty halves of ", "coconuts!");
     EXPECT_TRUE(output().contains("You've got 2 empty halves of coconuts!", false));
 
-    WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelError);
+    WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Error);
     logger->logAlways(TestChannel1, "I shall taunt you a second time!");
     EXPECT_TRUE(output().contains("I shall taunt you a second time!", false));
 
     logger->setEnabled(this, false);
-    EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevelError));
-    EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevelWarning));
-    EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevelInfo));
-    EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevelDebug));
+    EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevel::Error));
+    EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevel::Warning));
+    EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevel::Info));
+    EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevel::Debug));
     EXPECT_FALSE(logger->enabled());
     logger->logAlways(TestChannel1, "You've got two empty halves of coconuts");
     EXPECT_EQ(0u, output().length());
@@ -348,7 +348,7 @@ TEST_F(LoggingTest, LoggerHelper)
     EXPECT_TRUE(result.contains(signature, false));
     EXPECT_TRUE(result.contains("to the show that never", false));
 
-    WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelWarning);
+    WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Warning);
 
     ERROR_LOG(LOGIDENTIFIER, "We're so glad you could attend");
     EXPECT_TRUE(output().contains("We're so glad you could attend", false));
@@ -388,7 +388,7 @@ private:
 
     StringBuilder m_logBuffer;
     WTFLogChannel m_lastChannel;
-    WTFLogLevel m_lastLevel { WTFLogLevelError };
+    WTFLogLevel m_lastLevel { WTFLogLevel::Error };
 };
 
 #if !RELEASE_LOG_DISABLED
@@ -403,7 +403,7 @@ TEST_F(LoggingTest, LogObserver)
     EXPECT_TRUE(this->output().contains("testing 1, 2, 3", false));
     EXPECT_TRUE(observer.log().contains("testing 1, 2, 3", false));
     EXPECT_STREQ(observer.channel().name, logChannel().name);
-    EXPECT_EQ(static_cast<int>(WTFLogLevelAlways), static_cast<int>(observer.level()));
+    EXPECT_EQ(static_cast<int>(WTFLogLevel::Always), static_cast<int>(observer.level()));
 
     logger().removeObserver(observer);
     ALWAYS_LOG("testing ", 1, ", ", 2, ", 3");