Changeset 243141 in webkit
- Timestamp:
- Mar 19, 2019 9:47:04 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r243135 r243141 1 2019-03-19 Alex Christensen <achristensen@webkit.org> 2 3 Make WTFLogChannelState and WTFLogLevel enum classes 4 https://bugs.webkit.org/show_bug.cgi?id=195904 5 6 Reviewed by Eric Carlson. 7 8 * wtf/Assertions.cpp: 9 * wtf/Assertions.h: 10 * wtf/Logger.h: 11 (WTF::Logger::logAlways const): 12 (WTF::Logger::error const): 13 (WTF::Logger::warning const): 14 (WTF::Logger::info const): 15 (WTF::Logger::debug const): 16 (WTF::Logger::willLog const): 17 (WTF::Logger::log): 18 * wtf/MemoryPressureHandler.cpp: 19 * wtf/RefCountedLeakCounter.cpp: 20 1 21 2019-03-19 Michael Catanzaro <mcatanzaro@igalia.com> 2 22 -
trunk/Source/WTF/wtf/AggregateLogger.h
r243135 r243141 58 58 UNUSED_PARAM(channel); 59 59 #else 60 log(channel, WTFLogLevel Always, arguments...);60 log(channel, WTFLogLevel::Always, arguments...); 61 61 #endif 62 62 } … … 65 65 inline void error(WTFLogChannel& channel, const Arguments&... arguments) const 66 66 { 67 log(channel, WTFLogLevel Error, arguments...);67 log(channel, WTFLogLevel::Error, arguments...); 68 68 } 69 69 … … 71 71 inline void warning(WTFLogChannel& channel, const Arguments&... arguments) const 72 72 { 73 log(channel, WTFLogLevel Warning, arguments...);73 log(channel, WTFLogLevel::Warning, arguments...); 74 74 } 75 75 … … 77 77 inline void info(WTFLogChannel& channel, const Arguments&... arguments) const 78 78 { 79 log(channel, WTFLogLevel Info, arguments...);79 log(channel, WTFLogLevel::Info, arguments...); 80 80 } 81 81 … … 83 83 inline void debug(WTFLogChannel& channel, const Arguments&... arguments) const 84 84 { 85 log(channel, WTFLogLevel Debug, arguments...);85 log(channel, WTFLogLevel::Debug, arguments...); 86 86 } 87 87 -
trunk/Source/WTF/wtf/Assertions.cpp
r243135 r243141 410 410 bool WTFWillLogWithLevel(WTFLogChannel* channel, WTFLogLevel level) 411 411 { 412 return channel->level >= level && channel->state != WTFLogChannel Off;412 return channel->level >= level && channel->state != WTFLogChannelState::Off; 413 413 } 414 414 415 415 void WTFLogWithLevel(WTFLogChannel* channel, WTFLogLevel level, const char* format, ...) 416 416 { 417 if (level != WTFLogLevel Always && level > channel->level)417 if (level != WTFLogLevel::Always && level > channel->level) 418 418 return; 419 419 420 if (channel->level != WTFLogLevel Always && channel->state == WTFLogChannelOff)420 if (channel->level != WTFLogLevel::Always && channel->state == WTFLogChannelState::Off) 421 421 return; 422 422 … … 433 433 static void WTFLogVaList(WTFLogChannel* channel, const char* format, va_list args) 434 434 { 435 if (channel->state == WTFLogChannel Off)435 if (channel->state == WTFLogChannelState::Off) 436 436 return; 437 437 438 if (channel->state == WTFLogChannel On) {438 if (channel->state == WTFLogChannelState::On) { 439 439 vprintf_stderr_with_trailing_newline(format, args); 440 440 return; 441 441 } 442 442 443 ASSERT(channel->state == WTFLogChannel OnWithAccumulation);443 ASSERT(channel->state == WTFLogChannelState::OnWithAccumulation); 444 444 445 445 ALLOW_NONLITERAL_FORMAT_BEGIN … … 467 467 void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel* channel, const char* format, ...) 468 468 { 469 if (channel->state != WTFLogChannel On)469 if (channel->state != WTFLogChannelState::On) 470 470 return; 471 471 … … 534 534 String component = componentInfo[0].stripWhiteSpace(); 535 535 536 WTFLogChannelState logChannelState = WTFLogChannel On;536 WTFLogChannelState logChannelState = WTFLogChannelState::On; 537 537 if (component.startsWith('-')) { 538 logChannelState = WTFLogChannel Off;538 logChannelState = WTFLogChannelState::Off; 539 539 component = component.substring(1); 540 540 } … … 545 545 } 546 546 547 WTFLogLevel logChannelLevel = WTFLogLevel Error;547 WTFLogLevel logChannelLevel = WTFLogLevel::Error; 548 548 if (componentInfo.size() > 1) { 549 549 String level = componentInfo[1].stripWhiteSpace(); 550 550 if (equalLettersIgnoringASCIICase(level, "error")) 551 logChannelLevel = WTFLogLevel Error;551 logChannelLevel = WTFLogLevel::Error; 552 552 else if (equalLettersIgnoringASCIICase(level, "warning")) 553 logChannelLevel = WTFLogLevel Warning;553 logChannelLevel = WTFLogLevel::Warning; 554 554 else if (equalLettersIgnoringASCIICase(level, "info")) 555 logChannelLevel = WTFLogLevel Info;555 logChannelLevel = WTFLogLevel::Info; 556 556 else if (equalLettersIgnoringASCIICase(level, "debug")) 557 logChannelLevel = WTFLogLevel Debug;557 logChannelLevel = WTFLogLevel::Debug; 558 558 else 559 559 WTFLogAlways("Unknown logging level: %s", level.utf8().data()); -
trunk/Source/WTF/wtf/Assertions.h
r243135 r243141 149 149 #endif 150 150 151 typedef enum { WTFLogChannelOff, WTFLogChannelOn, WTFLogChannelOnWithAccumulation } WTFLogChannelState; 152 typedef enum { WTFLogLevelAlways, WTFLogLevelError, WTFLogLevelWarning, WTFLogLevelInfo, WTFLogLevelDebug } WTFLogLevel; 151 #ifdef __cplusplus 152 enum class WTFLogChannelState : uint8_t { Off, On, OnWithAccumulation }; 153 #undef Always 154 enum class WTFLogLevel : uint8_t { Always, Error, Warning, Info, Debug }; 155 #else 156 typedef uint8_t WTFLogChannelState; 157 typedef uint8_t WTFLogLevel; 158 #endif 153 159 154 160 typedef struct { … … 175 181 #if RELEASE_LOG_DISABLED 176 182 #define DEFINE_LOG_CHANNEL(name, subsystem) \ 177 WTFLogChannel LOG_CHANNEL(name) = { WTFLogChannelOff, #name, WTFLogLevelError};183 WTFLogChannel LOG_CHANNEL(name) = { (WTFLogChannelState)0, #name, (WTFLogLevel)1 }; 178 184 #else 179 185 #define DEFINE_LOG_CHANNEL(name, subsystem) \ 180 WTFLogChannel LOG_CHANNEL(name) = { WTFLogChannelOff, #name, WTFLogLevelError, subsystem, OS_LOG_DEFAULT };186 WTFLogChannel LOG_CHANNEL(name) = { (WTFLogChannelState)0, #name, (WTFLogLevel)1, subsystem, OS_LOG_DEFAULT }; 181 187 #endif 182 188 #endif -
trunk/Source/WTF/wtf/Logger.h
r243135 r243141 127 127 UNUSED_PARAM(channel); 128 128 #else 129 if (!willLog(channel, WTFLogLevel Always))130 return; 131 132 log(channel, WTFLogLevel Always, arguments...);129 if (!willLog(channel, WTFLogLevel::Always)) 130 return; 131 132 log(channel, WTFLogLevel::Always, arguments...); 133 133 #endif 134 134 } … … 137 137 inline void error(WTFLogChannel& channel, const Arguments&... arguments) const 138 138 { 139 if (!willLog(channel, WTFLogLevel Error))140 return; 141 142 log(channel, WTFLogLevel Error, arguments...);139 if (!willLog(channel, WTFLogLevel::Error)) 140 return; 141 142 log(channel, WTFLogLevel::Error, arguments...); 143 143 } 144 144 … … 146 146 inline void warning(WTFLogChannel& channel, const Arguments&... arguments) const 147 147 { 148 if (!willLog(channel, WTFLogLevel Warning))149 return; 150 151 log(channel, WTFLogLevel Warning, arguments...);148 if (!willLog(channel, WTFLogLevel::Warning)) 149 return; 150 151 log(channel, WTFLogLevel::Warning, arguments...); 152 152 } 153 153 … … 155 155 inline void info(WTFLogChannel& channel, const Arguments&... arguments) const 156 156 { 157 if (!willLog(channel, WTFLogLevel Info))158 return; 159 160 log(channel, WTFLogLevel Info, arguments...);157 if (!willLog(channel, WTFLogLevel::Info)) 158 return; 159 160 log(channel, WTFLogLevel::Info, arguments...); 161 161 } 162 162 … … 164 164 inline void debug(WTFLogChannel& channel, const Arguments&... arguments) const 165 165 { 166 if (!willLog(channel, WTFLogLevel Debug))167 return; 168 169 log(channel, WTFLogLevel Debug, arguments...);166 if (!willLog(channel, WTFLogLevel::Debug)) 167 return; 168 169 log(channel, WTFLogLevel::Debug, arguments...); 170 170 } 171 171 … … 175 175 return false; 176 176 177 if (level <= WTFLogLevel Error)177 if (level <= WTFLogLevel::Error) 178 178 return true; 179 179 180 if (channel.state == WTFLogChannel Off || level > channel.level)180 if (channel.state == WTFLogChannelState::Off || level > channel.level) 181 181 return false; 182 182 … … 243 243 #endif 244 244 245 if (channel.state == WTFLogChannel Off || level > channel.level)245 if (channel.state == WTFLogChannelState::Off || level > channel.level) 246 246 return; 247 247 -
trunk/Source/WTF/wtf/MemoryPressureHandler.cpp
r243135 r243141 36 36 37 37 #if RELEASE_LOG_DISABLED 38 WTFLogChannel LogMemoryPressure = { WTFLogChannel On, "MemoryPressure", WTFLogLevelError };38 WTFLogChannel LogMemoryPressure = { WTFLogChannelState::On, "MemoryPressure", WTFLogLevel::Error }; 39 39 #else 40 WTFLogChannel LogMemoryPressure = { WTFLogChannel On, "MemoryPressure", WTFLogLevelError, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT };40 WTFLogChannel LogMemoryPressure = { WTFLogChannelState::On, "MemoryPressure", WTFLogLevel::Error, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT }; 41 41 #endif 42 42 -
trunk/Source/WTF/wtf/RefCountedLeakCounter.cpp
r243135 r243141 41 41 #define LOG_CHANNEL_PREFIX Log 42 42 #if RELEASE_LOG_DISABLED 43 static WTFLogChannel LogRefCountedLeaks = { WTFLogChannel On, "RefCountedLeaks", WTFLogLevelError };43 static WTFLogChannel LogRefCountedLeaks = { WTFLogChannelState::On, "RefCountedLeaks", WTFLogLevel::Error }; 44 44 #else 45 static WTFLogChannel LogRefCountedLeaks = { WTFLogChannel On, "RefCountedLeaks", WTFLogLevelError, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT };45 static WTFLogChannel LogRefCountedLeaks = { WTFLogChannelState::On, "RefCountedLeaks", WTFLogLevel::Error, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT }; 46 46 #endif 47 47 -
trunk/Source/WebCore/ChangeLog
r243140 r243141 1 2019-03-19 Alex Christensen <achristensen@webkit.org> 2 3 Make WTFLogChannelState and WTFLogLevel enum classes 4 https://bugs.webkit.org/show_bug.cgi?id=195904 5 6 Reviewed by Eric Carlson. 7 8 * Modules/mediasource/SourceBuffer.cpp: 9 (WebCore::removeSamplesFromTrackBuffer): 10 * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: 11 (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): 12 (WebCore::LibWebRTCMediaEndpoint::statsLogInterval const): 13 * dom/Document.cpp: 14 (WebCore::messageLevelFromWTFLogLevel): 15 * html/FTPDirectoryDocument.cpp: 16 (WebCore::FTPDirectoryDocument::FTPDirectoryDocument): 17 * html/HTMLMediaElement.cpp: 18 (WebCore::HTMLMediaElement::seekTask): 19 (WebCore::HTMLMediaElement::selectNextSourceChild): 20 (WebCore::HTMLMediaElement::sourceWasAdded): 21 (WebCore::HTMLMediaElement::sourceWasRemoved): 22 * inspector/agents/WebConsoleAgent.cpp: 23 (WebCore::WebConsoleAgent::getLoggingChannels): 24 (WebCore::channelConfigurationForString): 25 * platform/Logging.cpp: 26 (WebCore::isLogChannelEnabled): 27 (WebCore::setLogChannelToAccumulate): 28 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 29 (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): 30 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: 31 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): 32 * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: 33 (WebCore::initializePeerConnectionFactoryAndThreads): 34 * rendering/RenderLayerCompositor.cpp: 35 (WebCore::compositingLogEnabled): 36 1 37 2019-03-19 Philippe Normand <pnormand@igalia.com> 2 38 -
trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp
r243138 r243141 742 742 auto logIdentifier = WTF::Logger::LogSiteIdentifier(buffer->logClassName(), logPrefix, buffer->logIdentifier()); 743 743 auto& logger = buffer->logger(); 744 auto willLog = logger.willLog(buffer->logChannel(), WTFLogLevel Debug);744 auto willLog = logger.willLog(buffer->logChannel(), WTFLogLevel::Debug); 745 745 #else 746 746 UNUSED_PARAM(logPrefix); -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp
r243135 r243141 866 866 867 867 for (auto iterator = report->begin(); iterator != report->end(); ++iterator) { 868 if (logger().willLog(logChannel(), WTFLogLevel Debug)) {868 if (logger().willLog(logChannel(), WTFLogLevel::Debug)) { 869 869 // Stats are very verbose, let's only display them in inspector console in verbose mode. 870 870 logger().debug(LogWebRTC, … … 905 905 Seconds LibWebRTCMediaEndpoint::statsLogInterval(int64_t reportTimestamp) const 906 906 { 907 if (logger().willLog(logChannel(), WTFLogLevel Info))907 if (logger().willLog(logChannel(), WTFLogLevel::Info)) 908 908 return 2_s; 909 909 -
trunk/Source/WebCore/dom/Document.cpp
r243135 r243141 8539 8539 { 8540 8540 switch (level) { 8541 case WTFLogLevel Always:8541 case WTFLogLevel::Always: 8542 8542 return MessageLevel::Log; 8543 case WTFLogLevel Error:8543 case WTFLogLevel::Error: 8544 8544 return MessageLevel::Error; 8545 8545 break; 8546 case WTFLogLevel Warning:8546 case WTFLogLevel::Warning: 8547 8547 return MessageLevel::Warning; 8548 8548 break; 8549 case WTFLogLevel Info:8549 case WTFLogLevel::Info: 8550 8550 return MessageLevel::Info; 8551 8551 break; 8552 case WTFLogLevel Debug:8552 case WTFLogLevel::Debug: 8553 8553 return MessageLevel::Debug; 8554 8554 break; -
trunk/Source/WebCore/html/FTPDirectoryDocument.cpp
r243135 r243141 426 426 { 427 427 #if !LOG_DISABLED 428 LogFTP.state = WTFLogChannel On;428 LogFTP.state = WTFLogChannelState::On; 429 429 #endif 430 430 } -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r243135 r243141 3076 3076 // not generate a timechanged callback. This means m_seeking will never be cleared and we will never 3077 3077 // fire a 'seeked' event. 3078 if (willLog(WTFLogLevel Debug)) {3078 if (willLog(WTFLogLevel::Debug)) { 3079 3079 MediaTime mediaTime = m_player->mediaTimeForTimeValue(time); 3080 3080 if (time != mediaTime) … … 4652 4652 4653 4653 // Don't log if this was just called to find out if there are any valid <source> elements. 4654 bool shouldLog = willLog(WTFLogLevel Debug) && actionIfInvalid != DoNothing;4654 bool shouldLog = willLog(WTFLogLevel::Debug) && actionIfInvalid != DoNothing; 4655 4655 if (shouldLog) 4656 4656 INFO_LOG(LOGIDENTIFIER); … … 4751 4751 void HTMLMediaElement::sourceWasAdded(HTMLSourceElement& source) 4752 4752 { 4753 if (willLog(WTFLogLevel Info) && source.hasTagName(sourceTag)) {4753 if (willLog(WTFLogLevel::Info) && source.hasTagName(sourceTag)) { 4754 4754 URL url = source.getNonEmptyURLAttribute(srcAttr); 4755 4755 INFO_LOG(LOGIDENTIFIER, "'src' is ", url); … … 4803 4803 void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement& source) 4804 4804 { 4805 if (willLog(WTFLogLevel Info) && source.hasTagName(sourceTag)) {4805 if (willLog(WTFLogLevel::Info) && source.hasTagName(sourceTag)) { 4806 4806 URL url = source.getNonEmptyURLAttribute(srcAttr); 4807 4807 INFO_LOG(LOGIDENTIFIER, "'src' is ", url); -
trunk/Source/WebCore/inspector/agents/WebConsoleAgent.cpp
r243135 r243141 69 69 70 70 auto level = Inspector::Protocol::Console::ChannelLevel::Off; 71 if (logChannel->state != WTFLogChannel Off) {71 if (logChannel->state != WTFLogChannelState::Off) { 72 72 switch (logChannel->level) { 73 case WTFLogLevel Always:74 case WTFLogLevel Error:75 case WTFLogLevel Warning:76 case WTFLogLevel Info:73 case WTFLogLevel::Always: 74 case WTFLogLevel::Error: 75 case WTFLogLevel::Warning: 76 case WTFLogLevel::Info: 77 77 level = Inspector::Protocol::Console::ChannelLevel::Basic; 78 78 break; 79 case WTFLogLevel Debug:79 case WTFLogLevel::Debug: 80 80 level = Inspector::Protocol::Console::ChannelLevel::Verbose; 81 81 break; … … 97 97 98 98 if (equalIgnoringASCIICase(levelString, "off")) { 99 state = WTFLogChannel Off;100 level = WTFLogLevel Error;99 state = WTFLogChannelState::Off; 100 level = WTFLogLevel::Error; 101 101 } else { 102 state = WTFLogChannel On;102 state = WTFLogChannelState::On; 103 103 if (equalIgnoringASCIICase(levelString, "basic")) 104 level = WTFLogLevel Warning;104 level = WTFLogLevel::Warning; 105 105 else if (equalIgnoringASCIICase(levelString, "verbose")) 106 level = WTFLogLevel Debug;106 level = WTFLogLevel::Debug; 107 107 else 108 108 return WTF::nullopt; -
trunk/Source/WebCore/platform/Logging.cpp
r243135 r243141 55 55 if (!channel) 56 56 return false; 57 return channel->state != WTFLogChannel Off;57 return channel->state != WTFLogChannelState::Off; 58 58 } 59 59 … … 66 66 return; 67 67 68 channel->state = WTFLogChannel OnWithAccumulation;68 channel->state = WTFLogChannelState::OnWithAccumulation; 69 69 logChannelsNeedInitialization = true; 70 70 } -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r243135 r243141 3552 3552 3553 3553 #if !RELEASE_LOG_DISABLED 3554 if (player->logger().willLog(player->logChannel(), WTFLogLevel Debug) && !([keyPath isEqualToString:@"loadedTimeRanges"] || [keyPath isEqualToString:@"seekableTimeRanges"])) {3554 if (player->logger().willLog(player->logChannel(), WTFLogLevel::Debug) && !([keyPath isEqualToString:@"loadedTimeRanges"] || [keyPath isEqualToString:@"seekableTimeRanges"])) { 3555 3555 auto identifier = Logger::LogSiteIdentifier("MediaPlayerPrivateAVFoundation", "observeValueForKeyPath", player->logIdentifier()); 3556 3556 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm
r243135 r243141 386 386 DEBUG_LOG(LOGIDENTIFIER, "updated sample = ", sample); 387 387 388 if (WILL_LOG(WTFLogLevel Debug)) {388 if (WILL_LOG(WTFLogLevel::Debug)) { 389 389 MediaTime now = streamTime(); 390 390 double delta = (sample.presentationTime() - now).toDouble(); -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp
r243135 r243141 35 35 { 36 36 #if !LOG_DISABLED 37 return LogCompositing.state == WTFLogChannel On;37 return LogCompositing.state == WTFLogChannelState::On; 38 38 #else 39 39 return false; -
trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp
r243135 r243141 143 143 #if defined(NDEBUG) 144 144 #if !LOG_DISABLED || !RELEASE_LOG_DISABLED 145 if (LogWebRTC.state != WTFLogChannel On)145 if (LogWebRTC.state != WTFLogChannelState::On) 146 146 return rtc::LS_ERROR; 147 147 148 148 switch (LogWebRTC.level) { 149 case WTFLogLevel Always:150 case WTFLogLevel Error:149 case WTFLogLevel::Always: 150 case WTFLogLevel::Error: 151 151 return rtc::LS_ERROR; 152 case WTFLogLevel Warning:152 case WTFLogLevel::Warning: 153 153 return rtc::LS_WARNING; 154 case WTFLogLevel Info:154 case WTFLogLevel::Info: 155 155 return rtc::LS_INFO; 156 case WTFLogLevel Debug:156 case WTFLogLevel::Debug: 157 157 return rtc::LS_VERBOSE; 158 158 } … … 161 161 #endif 162 162 #else 163 return (LogWebRTC.state != WTFLogChannel On) ? rtc::LS_WARNING : rtc::LS_INFO;163 return (LogWebRTC.state != WTFLogChannelState::On) ? rtc::LS_WARNING : rtc::LS_INFO; 164 164 #endif 165 165 } -
trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm
r243135 r243141 746 746 747 747 #if !RELEASE_LOG_DISABLED 748 if (m_callback->loggerPtr() && m_callback->logger().willLog(m_callback->logChannel(), WTFLogLevel Debug)) {748 if (m_callback->loggerPtr() && m_callback->logger().willLog(m_callback->logChannel(), WTFLogLevel::Debug)) { 749 749 auto identifier = Logger::LogSiteIdentifier("AVVideoCaptureSource", "observeValueForKeyPath", m_callback->logIdentifier()); 750 750 -
trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp
r243135 r243141 157 157 { 158 158 #if !LOG_DISABLED 159 if (LogNetwork.state != WTFLogChannel On || soup_session_get_feature(m_soupSession.get(), SOUP_TYPE_LOGGER))159 if (LogNetwork.state != WTFLogChannelState::On || soup_session_get_feature(m_soupSession.get(), SOUP_TYPE_LOGGER)) 160 160 return; 161 161 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r243135 r243141 274 274 static inline bool compositingLogEnabled() 275 275 { 276 return LogCompositing.state == WTFLogChannel On;276 return LogCompositing.state == WTFLogChannelState::On; 277 277 } 278 278 #endif -
trunk/Source/WebKit/ChangeLog
r243135 r243141 1 2019-03-19 Alex Christensen <achristensen@webkit.org> 2 3 Make WTFLogChannelState and WTFLogLevel enum classes 4 https://bugs.webkit.org/show_bug.cgi?id=195904 5 6 Reviewed by Eric Carlson. 7 8 * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: 9 (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage): 10 * NetworkProcess/webrtc/NetworkRTCProvider.cpp: 11 (WebKit::NetworkRTCProvider::NetworkRTCProvider): 12 1 13 2019-03-19 Michael Catanzaro <mcatanzaro@igalia.com> 2 14 -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp
r243135 r243141 68 68 { 69 69 #if !LOG_DISABLED 70 if (WebKit2LogNetworkCacheSpeculativePreloading.state == WTFLogChannel On)70 if (WebKit2LogNetworkCacheSpeculativePreloading.state == WTFLogChannelState::On) 71 71 allSpeculativeLoadingDiagnosticMessages().add(message); 72 72 #endif -
trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp
r243135 r243141 66 66 rtc::LogMessage::LogToDebug(rtc::LS_NONE); 67 67 #else 68 if (WebKit2LogWebRTC.state != WTFLogChannel On)68 if (WebKit2LogWebRTC.state != WTFLogChannelState::On) 69 69 rtc::LogMessage::LogToDebug(rtc::LS_WARNING); 70 70 #endif -
trunk/Tools/ChangeLog
r243139 r243141 1 2019-03-19 Alex Christensen <achristensen@webkit.org> 2 3 Make WTFLogChannelState and WTFLogLevel enum classes 4 https://bugs.webkit.org/show_bug.cgi?id=195904 5 6 Reviewed by Eric Carlson. 7 8 * TestWebKitAPI/Tests/WebCore/Logging.cpp: 9 (TestWebKitAPI::TEST_F): 10 1 11 2019-03-19 Xabier Rodriguez Calvar <calvaris@igalia.com> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/Logging.cpp
r243135 r243141 73 73 74 74 WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "all"); 75 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel Error);76 WTFSetLogChannelLevel(&TestChannel2, WTFLogLevel Error);77 WTFSetLogChannelLevel(&TestChannel3, WTFLogLevel Error);78 WTFSetLogChannelLevel(&TestChannel4, WTFLogLevel Error);75 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Error); 76 WTFSetLogChannelLevel(&TestChannel2, WTFLogLevel::Error); 77 WTFSetLogChannelLevel(&TestChannel3, WTFLogLevel::Error); 78 WTFSetLogChannelLevel(&TestChannel4, WTFLogLevel::Error); 79 79 } 80 80 … … 111 111 TEST_F(LoggingTest, Initialization) 112 112 { 113 EXPECT_EQ(TestChannel1.state, WTFLogChannel On);114 EXPECT_EQ(TestChannel2.state, WTFLogChannel On);115 EXPECT_EQ(TestChannel3.state, WTFLogChannel On);116 EXPECT_EQ(TestChannel4.state, WTFLogChannel On);117 118 EXPECT_EQ(TestChannel1.level, WTFLogLevel Error);119 EXPECT_EQ(TestChannel2.level, WTFLogLevel Error);120 EXPECT_EQ(TestChannel3.level, WTFLogLevel Error);121 EXPECT_EQ(TestChannel4.level, WTFLogLevel Error);122 123 TestChannel1.state = WTFLogChannel Off;113 EXPECT_EQ(TestChannel1.state, WTFLogChannelState::On); 114 EXPECT_EQ(TestChannel2.state, WTFLogChannelState::On); 115 EXPECT_EQ(TestChannel3.state, WTFLogChannelState::On); 116 EXPECT_EQ(TestChannel4.state, WTFLogChannelState::On); 117 118 EXPECT_EQ(TestChannel1.level, WTFLogLevel::Error); 119 EXPECT_EQ(TestChannel2.level, WTFLogLevel::Error); 120 EXPECT_EQ(TestChannel3.level, WTFLogLevel::Error); 121 EXPECT_EQ(TestChannel4.level, WTFLogLevel::Error); 122 123 TestChannel1.state = WTFLogChannelState::Off; 124 124 WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "Channel1"); 125 EXPECT_EQ(TestChannel1.level, WTFLogLevel Error);126 EXPECT_EQ(TestChannel1.state, WTFLogChannel On);127 128 TestChannel1.state = WTFLogChannel Off;125 EXPECT_EQ(TestChannel1.level, WTFLogLevel::Error); 126 EXPECT_EQ(TestChannel1.state, WTFLogChannelState::On); 127 128 TestChannel1.state = WTFLogChannelState::Off; 129 129 WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "Channel1=foo"); 130 EXPECT_EQ(TestChannel1.level, WTFLogLevel Error);130 EXPECT_EQ(TestChannel1.level, WTFLogLevel::Error); 131 131 #if TEST_OUTPUT 132 132 EXPECT_TRUE(output().contains("Unknown logging level: foo", false)); … … 134 134 135 135 WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "Channel1=warning"); 136 EXPECT_EQ(TestChannel1.level, WTFLogLevel Warning);137 EXPECT_EQ(TestChannel2.level, WTFLogLevel Error);138 EXPECT_EQ(TestChannel3.level, WTFLogLevel Error);139 EXPECT_EQ(TestChannel4.level, WTFLogLevel Error);136 EXPECT_EQ(TestChannel1.level, WTFLogLevel::Warning); 137 EXPECT_EQ(TestChannel2.level, WTFLogLevel::Error); 138 EXPECT_EQ(TestChannel3.level, WTFLogLevel::Error); 139 EXPECT_EQ(TestChannel4.level, WTFLogLevel::Error); 140 140 141 141 WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "Channel4= debug, Channel3 = info,Channel2=error"); 142 EXPECT_EQ(TestChannel1.level, WTFLogLevel Warning);143 EXPECT_EQ(TestChannel2.level, WTFLogLevel Error);144 EXPECT_EQ(TestChannel3.level, WTFLogLevel Info);145 EXPECT_EQ(TestChannel4.level, WTFLogLevel Debug);142 EXPECT_EQ(TestChannel1.level, WTFLogLevel::Warning); 143 EXPECT_EQ(TestChannel2.level, WTFLogLevel::Error); 144 EXPECT_EQ(TestChannel3.level, WTFLogLevel::Info); 145 EXPECT_EQ(TestChannel4.level, WTFLogLevel::Debug); 146 146 147 147 WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "-all"); 148 EXPECT_EQ(TestChannel1.state, WTFLogChannel Off);149 EXPECT_EQ(TestChannel2.state, WTFLogChannel Off);150 EXPECT_EQ(TestChannel3.state, WTFLogChannel Off);151 EXPECT_EQ(TestChannel4.state, WTFLogChannel Off);148 EXPECT_EQ(TestChannel1.state, WTFLogChannelState::Off); 149 EXPECT_EQ(TestChannel2.state, WTFLogChannelState::Off); 150 EXPECT_EQ(TestChannel3.state, WTFLogChannelState::Off); 151 EXPECT_EQ(TestChannel4.state, WTFLogChannelState::Off); 152 152 153 153 WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "all"); 154 EXPECT_EQ(TestChannel1.state, WTFLogChannel On);155 EXPECT_EQ(TestChannel2.state, WTFLogChannel On);156 EXPECT_EQ(TestChannel3.state, WTFLogChannel On);157 EXPECT_EQ(TestChannel4.state, WTFLogChannel On);154 EXPECT_EQ(TestChannel1.state, WTFLogChannelState::On); 155 EXPECT_EQ(TestChannel2.state, WTFLogChannelState::On); 156 EXPECT_EQ(TestChannel3.state, WTFLogChannelState::On); 157 EXPECT_EQ(TestChannel4.state, WTFLogChannelState::On); 158 158 } 159 159 160 160 TEST_F(LoggingTest, WTFWillLogWithLevel) 161 161 { 162 EXPECT_EQ(TestChannel1.state, WTFLogChannel On);163 EXPECT_EQ(TestChannel2.state, WTFLogChannel On);164 EXPECT_EQ(TestChannel3.state, WTFLogChannel On);165 EXPECT_EQ(TestChannel4.state, WTFLogChannel On);166 167 EXPECT_EQ(TestChannel1.level, WTFLogLevel Error);168 EXPECT_EQ(TestChannel2.level, WTFLogLevel Error);169 EXPECT_EQ(TestChannel3.level, WTFLogLevel Error);170 EXPECT_EQ(TestChannel4.level, WTFLogLevel Error);171 172 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel Error));173 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel2, WTFLogLevel Error));174 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel3, WTFLogLevel Error));175 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel4, WTFLogLevel Error));176 177 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel Info));178 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel2, WTFLogLevel Info));179 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel3, WTFLogLevel Info));180 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel4, WTFLogLevel Info));181 182 TestChannel1.state = WTFLogChannel Off;183 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel Error));184 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel Info));185 186 TestChannel1.state = WTFLogChannel On;187 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel Error));188 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel Info));189 190 TestChannel1.level = WTFLogLevel Info;191 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel Error));192 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel Info));162 EXPECT_EQ(TestChannel1.state, WTFLogChannelState::On); 163 EXPECT_EQ(TestChannel2.state, WTFLogChannelState::On); 164 EXPECT_EQ(TestChannel3.state, WTFLogChannelState::On); 165 EXPECT_EQ(TestChannel4.state, WTFLogChannelState::On); 166 167 EXPECT_EQ(TestChannel1.level, WTFLogLevel::Error); 168 EXPECT_EQ(TestChannel2.level, WTFLogLevel::Error); 169 EXPECT_EQ(TestChannel3.level, WTFLogLevel::Error); 170 EXPECT_EQ(TestChannel4.level, WTFLogLevel::Error); 171 172 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Error)); 173 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel2, WTFLogLevel::Error)); 174 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel3, WTFLogLevel::Error)); 175 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel4, WTFLogLevel::Error)); 176 177 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Info)); 178 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel2, WTFLogLevel::Info)); 179 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel3, WTFLogLevel::Info)); 180 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel4, WTFLogLevel::Info)); 181 182 TestChannel1.state = WTFLogChannelState::Off; 183 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Error)); 184 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Info)); 185 186 TestChannel1.state = WTFLogChannelState::On; 187 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Error)); 188 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Info)); 189 190 TestChannel1.level = WTFLogLevel::Info; 191 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Error)); 192 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel::Info)); 193 193 } 194 194 … … 202 202 TEST_F(LoggingTest, LOG_WITH_LEVEL) 203 203 { 204 LOG_WITH_LEVEL(Channel1, WTFLogLevel Error, "Go and boil your bottoms, you sons of a silly person.");204 LOG_WITH_LEVEL(Channel1, WTFLogLevel::Error, "Go and boil your bottoms, you sons of a silly person."); 205 205 EXPECT_TRUE(output().contains("sons of a silly person.", false)); 206 206 207 LOG_WITH_LEVEL(Channel1, WTFLogLevel Warning, "You don't frighten us, English pig dogs.");208 EXPECT_EQ(0u, output().length()); 209 210 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel Info);211 LOG_WITH_LEVEL(Channel1, WTFLogLevel Warning, "I'm French. Why do you think I have this outrageous accent, you silly king?");207 LOG_WITH_LEVEL(Channel1, WTFLogLevel::Warning, "You don't frighten us, English pig dogs."); 208 EXPECT_EQ(0u, output().length()); 209 210 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Info); 211 LOG_WITH_LEVEL(Channel1, WTFLogLevel::Warning, "I'm French. Why do you think I have this outrageous accent, you silly king?"); 212 212 EXPECT_TRUE(output().contains("outrageous accent", false)); 213 213 214 LOG_WITH_LEVEL(Channel1, WTFLogLevel Debug, "You don't frighten us with your silly knees-bent running around advancing behavior!");215 EXPECT_EQ(0u, output().length()); 216 217 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel Debug);218 LOG_WITH_LEVEL(Channel1, WTFLogLevel Debug, "Go and tell your master that we have been charged by God with a sacred quest.");214 LOG_WITH_LEVEL(Channel1, WTFLogLevel::Debug, "You don't frighten us with your silly knees-bent running around advancing behavior!"); 215 EXPECT_EQ(0u, output().length()); 216 217 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Debug); 218 LOG_WITH_LEVEL(Channel1, WTFLogLevel::Debug, "Go and tell your master that we have been charged by God with a sacred quest."); 219 219 EXPECT_TRUE(output().contains("sacred quest", false)); 220 220 } … … 239 239 TEST_F(LoggingTest, RELEASE_LOG_WITH_LEVEL) 240 240 { 241 RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel Error, "You don't frighten us, English pig dogs.");241 RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel::Error, "You don't frighten us, English pig dogs."); 242 242 EXPECT_TRUE(output().contains("pig dogs.", false)); 243 243 244 RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel Warning, "Go and boil your bottoms, you sons of a silly person.");245 EXPECT_EQ(0u, output().length()); 246 247 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel Info);248 RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel Warning, "I'm French. Why do you think I have this outrageous accent, you silly king?");244 RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel::Warning, "Go and boil your bottoms, you sons of a silly person."); 245 EXPECT_EQ(0u, output().length()); 246 247 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Info); 248 RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel::Warning, "I'm French. Why do you think I have this outrageous accent, you silly king?"); 249 249 EXPECT_TRUE(output().contains("outrageous accent", false)); 250 250 251 RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel Debug, "You don't frighten us with your silly knees-bent running around advancing behavior!");252 EXPECT_EQ(0u, output().length()); 253 254 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel Debug);255 RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel Debug, "Go and tell your master that we have been charged by God with a sacred quest.");251 RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel::Debug, "You don't frighten us with your silly knees-bent running around advancing behavior!"); 252 EXPECT_EQ(0u, output().length()); 253 254 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Debug); 255 RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevel::Debug, "Go and tell your master that we have been charged by God with a sacred quest."); 256 256 EXPECT_TRUE(output().contains("sacred quest", false)); 257 257 } … … 260 260 { 261 261 bool enabled = true; 262 RELEASE_LOG_WITH_LEVEL_IF(enabled, Channel1, WTFLogLevel Error, "Is there someone else up there that we can talk to?");262 RELEASE_LOG_WITH_LEVEL_IF(enabled, Channel1, WTFLogLevel::Error, "Is there someone else up there that we can talk to?"); 263 263 EXPECT_TRUE(output().contains("someone else", false)); 264 264 265 RELEASE_LOG_WITH_LEVEL_IF(enabled, Channel1, WTFLogLevel Debug, "No, now go away");265 RELEASE_LOG_WITH_LEVEL_IF(enabled, Channel1, WTFLogLevel::Debug, "No, now go away"); 266 266 EXPECT_EQ(0u, output().length()); 267 267 268 268 enabled = false; 269 RELEASE_LOG_WITH_LEVEL_IF(enabled, Channel1, WTFLogLevel Warning, "or I shall taunt you a second time! %i", 12);269 RELEASE_LOG_WITH_LEVEL_IF(enabled, Channel1, WTFLogLevel::Warning, "or I shall taunt you a second time! %i", 12); 270 270 EXPECT_EQ(0u, output().length()); 271 271 } … … 276 276 EXPECT_TRUE(logger->enabled()); 277 277 278 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel Error);279 EXPECT_TRUE(logger->willLog(TestChannel1, WTFLogLevel Error));278 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Error); 279 EXPECT_TRUE(logger->willLog(TestChannel1, WTFLogLevel::Error)); 280 280 logger->error(TestChannel1, "You're using coconuts!"); 281 281 EXPECT_TRUE(output().contains("You're using coconuts!", false)); … … 306 306 EXPECT_TRUE(output().contains("You've got 2 empty halves of coconuts!", false)); 307 307 308 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel Error);308 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Error); 309 309 logger->logAlways(TestChannel1, "I shall taunt you a second time!"); 310 310 EXPECT_TRUE(output().contains("I shall taunt you a second time!", false)); 311 311 312 312 logger->setEnabled(this, false); 313 EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevel Error));314 EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevel Warning));315 EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevel Info));316 EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevel Debug));313 EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevel::Error)); 314 EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevel::Warning)); 315 EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevel::Info)); 316 EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevel::Debug)); 317 317 EXPECT_FALSE(logger->enabled()); 318 318 logger->logAlways(TestChannel1, "You've got two empty halves of coconuts"); … … 349 349 EXPECT_TRUE(result.contains("to the show that never", false)); 350 350 351 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel Warning);351 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevel::Warning); 352 352 353 353 ERROR_LOG(LOGIDENTIFIER, "We're so glad you could attend"); … … 389 389 StringBuilder m_logBuffer; 390 390 WTFLogChannel m_lastChannel; 391 WTFLogLevel m_lastLevel { WTFLogLevel Error };391 WTFLogLevel m_lastLevel { WTFLogLevel::Error }; 392 392 }; 393 393 … … 404 404 EXPECT_TRUE(observer.log().contains("testing 1, 2, 3", false)); 405 405 EXPECT_STREQ(observer.channel().name, logChannel().name); 406 EXPECT_EQ(static_cast<int>(WTFLogLevel Always), static_cast<int>(observer.level()));406 EXPECT_EQ(static_cast<int>(WTFLogLevel::Always), static_cast<int>(observer.level())); 407 407 408 408 logger().removeObserver(observer);
Note: See TracChangeset
for help on using the changeset viewer.