Title: [220058] trunk/Source
Revision
220058
Author
calva...@igalia.com
Date
2017-07-31 02:14:58 -0700 (Mon, 31 Jul 2017)

Log Message

Created a bool pretty printer at WTF for debugging purposes
https://bugs.webkit.org/show_bug.cgi?id=174893

Reviewed by Darin Adler.

Source/WebCore:

Use WTF::boolPrettyPrinter in debugging messages.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::supportsKeySystem):
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::seek):

Source/WTF:

* wtf/PrintStream.cpp:
(WTF::printInternal): The overload taking bool uses boolForPrinting
* wtf/PrintStream.h:
(WTF::boolForPrinting): Converts a bool in "true" or "false".

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (220057 => 220058)


--- trunk/Source/WTF/ChangeLog	2017-07-31 09:07:41 UTC (rev 220057)
+++ trunk/Source/WTF/ChangeLog	2017-07-31 09:14:58 UTC (rev 220058)
@@ -1,3 +1,15 @@
+2017-07-31  Xabier Rodriguez Calvar  <calva...@igalia.com>
+
+        Created a bool pretty printer at WTF for debugging purposes
+        https://bugs.webkit.org/show_bug.cgi?id=174893
+
+        Reviewed by Darin Adler.
+
+        * wtf/PrintStream.cpp:
+        (WTF::printInternal): The overload taking bool uses boolForPrinting
+        * wtf/PrintStream.h:
+        (WTF::boolForPrinting): Converts a bool in "true" or "false".
+
 2017-07-30  Yusuke Suzuki  <utatane....@gmail.com>
 
         [WTF] Introduce Private Symbols

Modified: trunk/Source/WTF/wtf/PrintStream.cpp (220057 => 220058)


--- trunk/Source/WTF/wtf/PrintStream.cpp	2017-07-31 09:07:41 UTC (rev 220057)
+++ trunk/Source/WTF/wtf/PrintStream.cpp	2017-07-31 09:14:58 UTC (rev 220058)
@@ -108,10 +108,7 @@
 
 void printInternal(PrintStream& out, bool value)
 {
-    if (value)
-        out.print("true");
-    else
-        out.print("false");
+    out.print(boolForPrinting(value));
 }
 
 void printInternal(PrintStream& out, int value)

Modified: trunk/Source/WTF/wtf/PrintStream.h (220057 => 220058)


--- trunk/Source/WTF/wtf/PrintStream.h	2017-07-31 09:07:41 UTC (rev 220057)
+++ trunk/Source/WTF/wtf/PrintStream.h	2017-07-31 09:14:58 UTC (rev 220058)
@@ -44,6 +44,11 @@
 class StringView;
 class UniquedStringImpl;
 
+inline const char* boolForPrinting(bool value)
+{
+    return value ? "true" : "false";
+}
+
 class PrintStream {
     WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(PrintStream);
 public:
@@ -337,6 +342,7 @@
 
 } // namespace WTF
 
+using WTF::boolForPrinting;
 using WTF::CharacterDump;
 using WTF::PointerDump;
 using WTF::PrintStream;

Modified: trunk/Source/WebCore/ChangeLog (220057 => 220058)


--- trunk/Source/WebCore/ChangeLog	2017-07-31 09:07:41 UTC (rev 220057)
+++ trunk/Source/WebCore/ChangeLog	2017-07-31 09:14:58 UTC (rev 220058)
@@ -1,3 +1,17 @@
+2017-07-31  Xabier Rodriguez Calvar  <calva...@igalia.com>
+
+        Created a bool pretty printer at WTF for debugging purposes
+        https://bugs.webkit.org/show_bug.cgi?id=174893
+
+        Reviewed by Darin Adler.
+
+        Use WTF::boolPrettyPrinter in debugging messages.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::supportsKeySystem):
+        * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerMSE::seek):
+
 2017-07-30  Zan Dobersek  <zdober...@igalia.com>
 
         Unreviewed. Suppress the -Wextra compiler warning when building with GCC 6.3.0,

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (220057 => 220058)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2017-07-31 09:07:41 UTC (rev 220057)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2017-07-31 09:14:58 UTC (rev 220058)
@@ -1040,7 +1040,7 @@
         result = true;
 #endif
 
-    GST_DEBUG("checking for KeySystem support with %s and type %s: %s", keySystem.utf8().data(), mimeType.utf8().data(), result ? "true" : "false");
+    GST_DEBUG("checking for KeySystem support with %s and type %s: %s", keySystem.utf8().data(), mimeType.utf8().data(), boolForPrinting(result));
     return result;
 }
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp (220057 => 220058)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp	2017-07-31 09:07:41 UTC (rev 220057)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp	2017-07-31 09:14:58 UTC (rev 220058)
@@ -197,7 +197,7 @@
     }
 
     m_isEndReached = false;
-    GST_DEBUG("m_seeking=%s, m_seekTime=%f", m_seeking ? "true" : "false", m_seekTime);
+    GST_DEBUG("m_seeking=%s, m_seekTime=%f", boolForPrinting(m_seeking), m_seekTime);
 }
 
 void MediaPlayerPrivateGStreamerMSE::configurePlaySink()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to