Changeset 243135 in webkit
- Timestamp:
- Mar 19, 2019 6:25:16 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r243132 r243135 1 2019-03-19 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 Unreviewed, rolling out r243132. 4 5 Broke GTK build 6 7 Reverted changeset: 8 9 "Make WTFLogChannelState and WTFLogLevel enum classes" 10 https://bugs.webkit.org/show_bug.cgi?id=195904 11 https://trac.webkit.org/changeset/243132 12 1 13 2019-03-18 Alex Christensen <achristensen@webkit.org> 2 14 -
trunk/Source/WTF/wtf/AggregateLogger.h
r243132 r243135 58 58 UNUSED_PARAM(channel); 59 59 #else 60 log(channel, WTFLogLevel ::Always, arguments...);60 log(channel, WTFLogLevelAlways, 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, WTFLogLevelError, 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, WTFLogLevelWarning, 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, WTFLogLevelInfo, 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, WTFLogLevelDebug, arguments...); 86 86 } 87 87 -
trunk/Source/WTF/wtf/Assertions.cpp
r243132 r243135 410 410 bool WTFWillLogWithLevel(WTFLogChannel* channel, WTFLogLevel level) 411 411 { 412 return channel->level >= level && channel->state != WTFLogChannel State::Off;412 return channel->level >= level && channel->state != WTFLogChannelOff; 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 != WTFLogLevelAlways && level > channel->level) 418 418 return; 419 419 420 if (channel->level != WTFLogLevel ::Always && channel->state == WTFLogChannelState::Off)420 if (channel->level != WTFLogLevelAlways && channel->state == WTFLogChannelOff) 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 State::Off)435 if (channel->state == WTFLogChannelOff) 436 436 return; 437 437 438 if (channel->state == WTFLogChannel State::On) {438 if (channel->state == WTFLogChannelOn) { 439 439 vprintf_stderr_with_trailing_newline(format, args); 440 440 return; 441 441 } 442 442 443 ASSERT(channel->state == WTFLogChannel State::OnWithAccumulation);443 ASSERT(channel->state == WTFLogChannelOnWithAccumulation); 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 State::On)469 if (channel->state != WTFLogChannelOn) 470 470 return; 471 471 … … 534 534 String component = componentInfo[0].stripWhiteSpace(); 535 535 536 WTFLogChannelState logChannelState = WTFLogChannel State::On;536 WTFLogChannelState logChannelState = WTFLogChannelOn; 537 537 if (component.startsWith('-')) { 538 logChannelState = WTFLogChannel State::Off;538 logChannelState = WTFLogChannelOff; 539 539 component = component.substring(1); 540 540 } … … 545 545 } 546 546 547 WTFLogLevel logChannelLevel = WTFLogLevel ::Error;547 WTFLogLevel logChannelLevel = WTFLogLevelError; 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 = WTFLogLevelError; 552 552 else if (equalLettersIgnoringASCIICase(level, "warning")) 553 logChannelLevel = WTFLogLevel ::Warning;553 logChannelLevel = WTFLogLevelWarning; 554 554 else if (equalLettersIgnoringASCIICase(level, "info")) 555 logChannelLevel = WTFLogLevel ::Info;555 logChannelLevel = WTFLogLevelInfo; 556 556 else if (equalLettersIgnoringASCIICase(level, "debug")) 557 logChannelLevel = WTFLogLevel ::Debug;557 logChannelLevel = WTFLogLevelDebug; 558 558 else 559 559 WTFLogAlways("Unknown logging level: %s", level.utf8().data()); -
trunk/Source/WTF/wtf/Assertions.h
r243132 r243135 149 149 #endif 150 150 151 #ifdef __cplusplus 152 enum class WTFLogChannelState : uint8_t { Off, On, OnWithAccumulation }; 153 enum class WTFLogLevel : uint8_t { Always, Error, Warning, Info, Debug }; 154 #else 155 typedef uint8_t WTFLogChannelState; 156 typedef uint8_t WTFLogLevel; 157 #endif 151 typedef enum { WTFLogChannelOff, WTFLogChannelOn, WTFLogChannelOnWithAccumulation } WTFLogChannelState; 152 typedef enum { WTFLogLevelAlways, WTFLogLevelError, WTFLogLevelWarning, WTFLogLevelInfo, WTFLogLevelDebug } WTFLogLevel; 158 153 159 154 typedef struct { … … 180 175 #if RELEASE_LOG_DISABLED 181 176 #define DEFINE_LOG_CHANNEL(name, subsystem) \ 182 WTFLogChannel LOG_CHANNEL(name) = { (WTFLogChannelState)0, #name, (WTFLogLevel)1};177 WTFLogChannel LOG_CHANNEL(name) = { WTFLogChannelOff, #name, WTFLogLevelError }; 183 178 #else 184 179 #define DEFINE_LOG_CHANNEL(name, subsystem) \ 185 WTFLogChannel LOG_CHANNEL(name) = { (WTFLogChannelState)0, #name, (WTFLogLevel)1, subsystem, OS_LOG_DEFAULT };180 WTFLogChannel LOG_CHANNEL(name) = { WTFLogChannelOff, #name, WTFLogLevelError, subsystem, OS_LOG_DEFAULT }; 186 181 #endif 187 182 #endif -
trunk/Source/WTF/wtf/Logger.h
r243132 r243135 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, WTFLogLevelAlways)) 130 return; 131 132 log(channel, WTFLogLevelAlways, 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, WTFLogLevelError)) 140 return; 141 142 log(channel, WTFLogLevelError, 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, WTFLogLevelWarning)) 149 return; 150 151 log(channel, WTFLogLevelWarning, 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, WTFLogLevelInfo)) 158 return; 159 160 log(channel, WTFLogLevelInfo, 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, WTFLogLevelDebug)) 167 return; 168 169 log(channel, WTFLogLevelDebug, arguments...); 170 170 } 171 171 … … 175 175 return false; 176 176 177 if (level <= WTFLogLevel ::Error)177 if (level <= WTFLogLevelError) 178 178 return true; 179 179 180 if (channel.state == WTFLogChannel State::Off || level > channel.level)180 if (channel.state == WTFLogChannelOff || level > channel.level) 181 181 return false; 182 182 … … 243 243 #endif 244 244 245 if (channel.state == WTFLogChannel State::Off || level > channel.level)245 if (channel.state == WTFLogChannelOff || level > channel.level) 246 246 return; 247 247 -
trunk/Source/WTF/wtf/MemoryPressureHandler.cpp
r243132 r243135 36 36 37 37 #if RELEASE_LOG_DISABLED 38 WTFLogChannel LogMemoryPressure = { WTFLogChannel State::On, "MemoryPressure", WTFLogLevel::Error };38 WTFLogChannel LogMemoryPressure = { WTFLogChannelOn, "MemoryPressure", WTFLogLevelError }; 39 39 #else 40 WTFLogChannel LogMemoryPressure = { WTFLogChannel State::On, "MemoryPressure", WTFLogLevel::Error, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT };40 WTFLogChannel LogMemoryPressure = { WTFLogChannelOn, "MemoryPressure", WTFLogLevelError, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT }; 41 41 #endif 42 42 -
trunk/Source/WTF/wtf/RefCountedLeakCounter.cpp
r243132 r243135 41 41 #define LOG_CHANNEL_PREFIX Log 42 42 #if RELEASE_LOG_DISABLED 43 static WTFLogChannel LogRefCountedLeaks = { WTFLogChannel State::On, "RefCountedLeaks", WTFLogLevel::Error };43 static WTFLogChannel LogRefCountedLeaks = { WTFLogChannelOn, "RefCountedLeaks", WTFLogLevelError }; 44 44 #else 45 static WTFLogChannel LogRefCountedLeaks = { WTFLogChannel State::On, "RefCountedLeaks", WTFLogLevel::Error, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT };45 static WTFLogChannel LogRefCountedLeaks = { WTFLogChannelOn, "RefCountedLeaks", WTFLogLevelError, LOG_CHANNEL_WEBKIT_SUBSYSTEM, OS_LOG_DEFAULT }; 46 46 #endif 47 47 -
trunk/Source/WebCore/ChangeLog
r243134 r243135 1 2019-03-19 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 Unreviewed, rolling out r243132. 4 5 Broke GTK build 6 7 Reverted changeset: 8 9 "Make WTFLogChannelState and WTFLogLevel enum classes" 10 https://bugs.webkit.org/show_bug.cgi?id=195904 11 https://trac.webkit.org/changeset/243132 12 1 13 2019-03-19 Antti Koivisto <antti@apple.com> 2 14 -
trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp
r243132 r243135 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(), WTFLogLevelDebug); 745 745 #else 746 746 UNUSED_PARAM(logPrefix); -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp
r243132 r243135 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(), WTFLogLevelDebug)) { 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(), WTFLogLevelInfo)) 908 908 return 2_s; 909 909 -
trunk/Source/WebCore/dom/Document.cpp
r243132 r243135 8539 8539 { 8540 8540 switch (level) { 8541 case WTFLogLevel ::Always:8541 case WTFLogLevelAlways: 8542 8542 return MessageLevel::Log; 8543 case WTFLogLevel ::Error:8543 case WTFLogLevelError: 8544 8544 return MessageLevel::Error; 8545 8545 break; 8546 case WTFLogLevel ::Warning:8546 case WTFLogLevelWarning: 8547 8547 return MessageLevel::Warning; 8548 8548 break; 8549 case WTFLogLevel ::Info:8549 case WTFLogLevelInfo: 8550 8550 return MessageLevel::Info; 8551 8551 break; 8552 case WTFLogLevel ::Debug:8552 case WTFLogLevelDebug: 8553 8553 return MessageLevel::Debug; 8554 8554 break; -
trunk/Source/WebCore/html/FTPDirectoryDocument.cpp
r243132 r243135 426 426 { 427 427 #if !LOG_DISABLED 428 LogFTP.state = WTFLogChannel State::On;428 LogFTP.state = WTFLogChannelOn; 429 429 #endif 430 430 } -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r243132 r243135 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(WTFLogLevelDebug)) { 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(WTFLogLevelDebug) && 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(WTFLogLevelInfo) && 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(WTFLogLevelInfo) && 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
r243132 r243135 69 69 70 70 auto level = Inspector::Protocol::Console::ChannelLevel::Off; 71 if (logChannel->state != WTFLogChannel State::Off) {71 if (logChannel->state != WTFLogChannelOff) { 72 72 switch (logChannel->level) { 73 case WTFLogLevel ::Always:74 case WTFLogLevel ::Error:75 case WTFLogLevel ::Warning:76 case WTFLogLevel ::Info:73 case WTFLogLevelAlways: 74 case WTFLogLevelError: 75 case WTFLogLevelWarning: 76 case WTFLogLevelInfo: 77 77 level = Inspector::Protocol::Console::ChannelLevel::Basic; 78 78 break; 79 case WTFLogLevel ::Debug:79 case WTFLogLevelDebug: 80 80 level = Inspector::Protocol::Console::ChannelLevel::Verbose; 81 81 break; … … 97 97 98 98 if (equalIgnoringASCIICase(levelString, "off")) { 99 state = WTFLogChannel State::Off;100 level = WTFLogLevel ::Error;99 state = WTFLogChannelOff; 100 level = WTFLogLevelError; 101 101 } else { 102 state = WTFLogChannel State::On;102 state = WTFLogChannelOn; 103 103 if (equalIgnoringASCIICase(levelString, "basic")) 104 level = WTFLogLevel ::Warning;104 level = WTFLogLevelWarning; 105 105 else if (equalIgnoringASCIICase(levelString, "verbose")) 106 level = WTFLogLevel ::Debug;106 level = WTFLogLevelDebug; 107 107 else 108 108 return WTF::nullopt; -
trunk/Source/WebCore/platform/Logging.cpp
r243132 r243135 55 55 if (!channel) 56 56 return false; 57 return channel->state != WTFLogChannel State::Off;57 return channel->state != WTFLogChannelOff; 58 58 } 59 59 … … 66 66 return; 67 67 68 channel->state = WTFLogChannel State::OnWithAccumulation;68 channel->state = WTFLogChannelOnWithAccumulation; 69 69 logChannelsNeedInitialization = true; 70 70 } -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r243132 r243135 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(), WTFLogLevelDebug) && !([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
r243132 r243135 386 386 DEBUG_LOG(LOGIDENTIFIER, "updated sample = ", sample); 387 387 388 if (WILL_LOG(WTFLogLevel ::Debug)) {388 if (WILL_LOG(WTFLogLevelDebug)) { 389 389 MediaTime now = streamTime(); 390 390 double delta = (sample.presentationTime() - now).toDouble(); -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp
r243132 r243135 35 35 { 36 36 #if !LOG_DISABLED 37 return LogCompositing.state == WTFLogChannel State::On;37 return LogCompositing.state == WTFLogChannelOn; 38 38 #else 39 39 return false; -
trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp
r243132 r243135 143 143 #if defined(NDEBUG) 144 144 #if !LOG_DISABLED || !RELEASE_LOG_DISABLED 145 if (LogWebRTC.state != WTFLogChannel State::On)145 if (LogWebRTC.state != WTFLogChannelOn) 146 146 return rtc::LS_ERROR; 147 147 148 148 switch (LogWebRTC.level) { 149 case WTFLogLevel ::Always:150 case WTFLogLevel ::Error:149 case WTFLogLevelAlways: 150 case WTFLogLevelError: 151 151 return rtc::LS_ERROR; 152 case WTFLogLevel ::Warning:152 case WTFLogLevelWarning: 153 153 return rtc::LS_WARNING; 154 case WTFLogLevel ::Info:154 case WTFLogLevelInfo: 155 155 return rtc::LS_INFO; 156 case WTFLogLevel ::Debug:156 case WTFLogLevelDebug: 157 157 return rtc::LS_VERBOSE; 158 158 } … … 161 161 #endif 162 162 #else 163 return (LogWebRTC.state != WTFLogChannel State::On) ? rtc::LS_WARNING : rtc::LS_INFO;163 return (LogWebRTC.state != WTFLogChannelOn) ? rtc::LS_WARNING : rtc::LS_INFO; 164 164 #endif 165 165 } -
trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm
r243132 r243135 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(), WTFLogLevelDebug)) { 749 749 auto identifier = Logger::LogSiteIdentifier("AVVideoCaptureSource", "observeValueForKeyPath", m_callback->logIdentifier()); 750 750 -
trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp
r243132 r243135 157 157 { 158 158 #if !LOG_DISABLED 159 if (LogNetwork.state != WTFLogChannel State::On || soup_session_get_feature(m_soupSession.get(), SOUP_TYPE_LOGGER))159 if (LogNetwork.state != WTFLogChannelOn || soup_session_get_feature(m_soupSession.get(), SOUP_TYPE_LOGGER)) 160 160 return; 161 161 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r243132 r243135 274 274 static inline bool compositingLogEnabled() 275 275 { 276 return LogCompositing.state == WTFLogChannel State::On;276 return LogCompositing.state == WTFLogChannelOn; 277 277 } 278 278 #endif -
trunk/Source/WebKit/ChangeLog
r243134 r243135 1 2019-03-19 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 Unreviewed, rolling out r243132. 4 5 Broke GTK build 6 7 Reverted changeset: 8 9 "Make WTFLogChannelState and WTFLogLevel enum classes" 10 https://bugs.webkit.org/show_bug.cgi?id=195904 11 https://trac.webkit.org/changeset/243132 12 1 13 2019-03-19 Antti Koivisto <antti@apple.com> 2 14 -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp
r243132 r243135 68 68 { 69 69 #if !LOG_DISABLED 70 if (WebKit2LogNetworkCacheSpeculativePreloading.state == WTFLogChannel State::On)70 if (WebKit2LogNetworkCacheSpeculativePreloading.state == WTFLogChannelOn) 71 71 allSpeculativeLoadingDiagnosticMessages().add(message); 72 72 #endif -
trunk/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp
r243132 r243135 66 66 rtc::LogMessage::LogToDebug(rtc::LS_NONE); 67 67 #else 68 if (WebKit2LogWebRTC.state != WTFLogChannel State::On)68 if (WebKit2LogWebRTC.state != WTFLogChannelOn) 69 69 rtc::LogMessage::LogToDebug(rtc::LS_WARNING); 70 70 #endif -
trunk/Tools/ChangeLog
r243133 r243135 1 2019-03-19 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 Unreviewed, rolling out r243132. 4 5 Broke GTK build 6 7 Reverted changeset: 8 9 "Make WTFLogChannelState and WTFLogLevel enum classes" 10 https://bugs.webkit.org/show_bug.cgi?id=195904 11 https://trac.webkit.org/changeset/243132 12 1 13 2019-03-19 Zan Dobersek <zdobersek@igalia.com> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/Logging.cpp
r243132 r243135 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, WTFLogLevelError); 76 WTFSetLogChannelLevel(&TestChannel2, WTFLogLevelError); 77 WTFSetLogChannelLevel(&TestChannel3, WTFLogLevelError); 78 WTFSetLogChannelLevel(&TestChannel4, WTFLogLevelError); 79 79 } 80 80 … … 111 111 TEST_F(LoggingTest, Initialization) 112 112 { 113 EXPECT_EQ(TestChannel1.state, WTFLogChannel State::On);114 EXPECT_EQ(TestChannel2.state, WTFLogChannel State::On);115 EXPECT_EQ(TestChannel3.state, WTFLogChannel State::On);116 EXPECT_EQ(TestChannel4.state, WTFLogChannel State::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 State::Off;113 EXPECT_EQ(TestChannel1.state, WTFLogChannelOn); 114 EXPECT_EQ(TestChannel2.state, WTFLogChannelOn); 115 EXPECT_EQ(TestChannel3.state, WTFLogChannelOn); 116 EXPECT_EQ(TestChannel4.state, WTFLogChannelOn); 117 118 EXPECT_EQ(TestChannel1.level, WTFLogLevelError); 119 EXPECT_EQ(TestChannel2.level, WTFLogLevelError); 120 EXPECT_EQ(TestChannel3.level, WTFLogLevelError); 121 EXPECT_EQ(TestChannel4.level, WTFLogLevelError); 122 123 TestChannel1.state = WTFLogChannelOff; 124 124 WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "Channel1"); 125 EXPECT_EQ(TestChannel1.level, WTFLogLevel ::Error);126 EXPECT_EQ(TestChannel1.state, WTFLogChannel State::On);127 128 TestChannel1.state = WTFLogChannel State::Off;125 EXPECT_EQ(TestChannel1.level, WTFLogLevelError); 126 EXPECT_EQ(TestChannel1.state, WTFLogChannelOn); 127 128 TestChannel1.state = WTFLogChannelOff; 129 129 WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "Channel1=foo"); 130 EXPECT_EQ(TestChannel1.level, WTFLogLevel ::Error);130 EXPECT_EQ(TestChannel1.level, WTFLogLevelError); 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, WTFLogLevelWarning); 137 EXPECT_EQ(TestChannel2.level, WTFLogLevelError); 138 EXPECT_EQ(TestChannel3.level, WTFLogLevelError); 139 EXPECT_EQ(TestChannel4.level, WTFLogLevelError); 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, WTFLogLevelWarning); 143 EXPECT_EQ(TestChannel2.level, WTFLogLevelError); 144 EXPECT_EQ(TestChannel3.level, WTFLogLevelInfo); 145 EXPECT_EQ(TestChannel4.level, WTFLogLevelDebug); 146 146 147 147 WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "-all"); 148 EXPECT_EQ(TestChannel1.state, WTFLogChannel State::Off);149 EXPECT_EQ(TestChannel2.state, WTFLogChannel State::Off);150 EXPECT_EQ(TestChannel3.state, WTFLogChannel State::Off);151 EXPECT_EQ(TestChannel4.state, WTFLogChannel State::Off);148 EXPECT_EQ(TestChannel1.state, WTFLogChannelOff); 149 EXPECT_EQ(TestChannel2.state, WTFLogChannelOff); 150 EXPECT_EQ(TestChannel3.state, WTFLogChannelOff); 151 EXPECT_EQ(TestChannel4.state, WTFLogChannelOff); 152 152 153 153 WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "all"); 154 EXPECT_EQ(TestChannel1.state, WTFLogChannel State::On);155 EXPECT_EQ(TestChannel2.state, WTFLogChannel State::On);156 EXPECT_EQ(TestChannel3.state, WTFLogChannel State::On);157 EXPECT_EQ(TestChannel4.state, WTFLogChannel State::On);154 EXPECT_EQ(TestChannel1.state, WTFLogChannelOn); 155 EXPECT_EQ(TestChannel2.state, WTFLogChannelOn); 156 EXPECT_EQ(TestChannel3.state, WTFLogChannelOn); 157 EXPECT_EQ(TestChannel4.state, WTFLogChannelOn); 158 158 } 159 159 160 160 TEST_F(LoggingTest, WTFWillLogWithLevel) 161 161 { 162 EXPECT_EQ(TestChannel1.state, WTFLogChannel State::On);163 EXPECT_EQ(TestChannel2.state, WTFLogChannel State::On);164 EXPECT_EQ(TestChannel3.state, WTFLogChannel State::On);165 EXPECT_EQ(TestChannel4.state, WTFLogChannel State::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 State::Off;183 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel ::Error));184 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevel ::Info));185 186 TestChannel1.state = WTFLogChannel State::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, WTFLogChannelOn); 163 EXPECT_EQ(TestChannel2.state, WTFLogChannelOn); 164 EXPECT_EQ(TestChannel3.state, WTFLogChannelOn); 165 EXPECT_EQ(TestChannel4.state, WTFLogChannelOn); 166 167 EXPECT_EQ(TestChannel1.level, WTFLogLevelError); 168 EXPECT_EQ(TestChannel2.level, WTFLogLevelError); 169 EXPECT_EQ(TestChannel3.level, WTFLogLevelError); 170 EXPECT_EQ(TestChannel4.level, WTFLogLevelError); 171 172 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelError)); 173 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel2, WTFLogLevelError)); 174 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel3, WTFLogLevelError)); 175 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel4, WTFLogLevelError)); 176 177 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelInfo)); 178 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel2, WTFLogLevelInfo)); 179 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel3, WTFLogLevelInfo)); 180 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel4, WTFLogLevelInfo)); 181 182 TestChannel1.state = WTFLogChannelOff; 183 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelError)); 184 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelInfo)); 185 186 TestChannel1.state = WTFLogChannelOn; 187 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelError)); 188 EXPECT_FALSE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelInfo)); 189 190 TestChannel1.level = WTFLogLevelInfo; 191 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelError)); 192 EXPECT_TRUE(WTFWillLogWithLevel(&TestChannel1, WTFLogLevelInfo)); 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, WTFLogLevelError, "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, WTFLogLevelWarning, "You don't frighten us, English pig dogs."); 208 EXPECT_EQ(0u, output().length()); 209 210 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelInfo); 211 LOG_WITH_LEVEL(Channel1, WTFLogLevelWarning, "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, WTFLogLevelDebug, "You don't frighten us with your silly knees-bent running around advancing behavior!"); 215 EXPECT_EQ(0u, output().length()); 216 217 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelDebug); 218 LOG_WITH_LEVEL(Channel1, WTFLogLevelDebug, "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, WTFLogLevelError, "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, WTFLogLevelWarning, "Go and boil your bottoms, you sons of a silly person."); 245 EXPECT_EQ(0u, output().length()); 246 247 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelInfo); 248 RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevelWarning, "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, WTFLogLevelDebug, "You don't frighten us with your silly knees-bent running around advancing behavior!"); 252 EXPECT_EQ(0u, output().length()); 253 254 WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelDebug); 255 RELEASE_LOG_WITH_LEVEL(Channel1, WTFLogLevelDebug, "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, WTFLogLevelError, "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, WTFLogLevelDebug, "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, WTFLogLevelWarning, "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, WTFLogLevelError); 279 EXPECT_TRUE(logger->willLog(TestChannel1, WTFLogLevelError)); 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, WTFLogLevelError); 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, WTFLogLevelError)); 314 EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevelWarning)); 315 EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevelInfo)); 316 EXPECT_FALSE(logger->willLog(TestChannel1, WTFLogLevelDebug)); 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, WTFLogLevelWarning); 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 { WTFLogLevelError }; 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>(WTFLogLevelAlways), static_cast<int>(observer.level())); 407 407 408 408 logger().removeObserver(observer);
Note: See TracChangeset
for help on using the changeset viewer.