Title: [142186] trunk/Source/WebCore
Revision
142186
Author
[email protected]
Date
2013-02-07 15:19:12 -0800 (Thu, 07 Feb 2013)

Log Message

Improve logging of MediaPlayerPrivateAVFoundation Notifications.
https://bugs.webkit.org/show_bug.cgi?id=109223

Reviewed by Eric Carlson.

Convert the existing Notification enum to an expandable macro. Then add a
Logging-only function which stringifies the enums.

* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore):
(WebCore::notificationName):
(WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
(WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (142185 => 142186)


--- trunk/Source/WebCore/ChangeLog	2013-02-07 23:17:19 UTC (rev 142185)
+++ trunk/Source/WebCore/ChangeLog	2013-02-07 23:19:12 UTC (rev 142186)
@@ -1,3 +1,20 @@
+2013-02-07  Jer Noble  <[email protected]>
+
+        Improve logging of MediaPlayerPrivateAVFoundation Notifications.
+        https://bugs.webkit.org/show_bug.cgi?id=109223
+
+        Reviewed by Eric Carlson.
+
+        Convert the existing Notification enum to an expandable macro. Then add a
+        Logging-only function which stringifies the enums.
+
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
+        (WebCore):
+        (WebCore::notificationName):
+        (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
+        (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
+
 2013-02-07  Martin Robinson  <[email protected]>
 
         [GTK] Cleanup command-line defines

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp (142185 => 142186)


--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp	2013-02-07 23:17:19 UTC (rev 142185)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp	2013-02-07 23:19:12 UTC (rev 142186)
@@ -695,9 +695,21 @@
     scheduleMainThreadNotification(Notification(type, finished));
 }
 
+#if !LOG_DISABLED
+static const char* notificationName(MediaPlayerPrivateAVFoundation::Notification& notification)
+{
+#define DEFINE_TYPE_STRING_CASE(type) case MediaPlayerPrivateAVFoundation::Notification::type: return #type;
+    switch (notification.type()) {
+        FOR_EACH_MEDIAPLAYERPRIVATEAVFOUNDATION_NOTIFICATION_TYPE(DEFINE_TYPE_STRING_CASE)
+    }
+#undef DEFINE_TYPE_STRING_CASE
+}
+#endif // !LOG_DISABLED
+    
+
 void MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(Notification notification)
 {
-    LOG(Media, "MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(%p) - notification %d", this, static_cast<int>(notification.type()));
+    LOG(Media, "MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(%p) - notification %s", this, notificationName(notification));
     m_queueMutex.lock();
 
     // It is important to always process the properties in the order that we are notified, 
@@ -744,7 +756,7 @@
             return;
     }
 
-    LOG(Media, "MediaPlayerPrivateAVFoundation::dispatchNotification(%p) - dispatching %d", this, static_cast<int>(notification.type()));
+    LOG(Media, "MediaPlayerPrivateAVFoundation::dispatchNotification(%p) - dispatching %s", this, notificationName(notification));
 
     switch (notification.type()) {
     case Notification::ItemDidPlayToEndTime:

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h (142185 => 142186)


--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h	2013-02-07 23:17:19 UTC (rev 142185)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h	2013-02-07 23:19:12 UTC (rev 142186)
@@ -59,25 +59,30 @@
 
     class Notification {
     public:
+#define FOR_EACH_MEDIAPLAYERPRIVATEAVFOUNDATION_NOTIFICATION_TYPE(macro) \
+    macro(None) \
+    macro(ItemDidPlayToEndTime) \
+    macro(ItemTracksChanged) \
+    macro(ItemStatusChanged) \
+    macro(ItemSeekableTimeRangesChanged) \
+    macro(ItemLoadedTimeRangesChanged) \
+    macro(ItemPresentationSizeChanged) \
+    macro(ItemIsPlaybackLikelyToKeepUpChanged) \
+    macro(ItemIsPlaybackBufferEmptyChanged) \
+    macro(ItemIsPlaybackBufferFullChanged) \
+    macro(AssetMetadataLoaded) \
+    macro(AssetPlayabilityKnown) \
+    macro(PlayerRateChanged) \
+    macro(PlayerTimeChanged) \
+    macro(SeekCompleted) \
+    macro(DurationChanged) \
+    macro(ContentsNeedsDisplay) \
+    macro(InbandTracksNeedConfiguration) \
+
         enum Type {
-            None,
-            ItemDidPlayToEndTime,
-            ItemTracksChanged,
-            ItemStatusChanged,
-            ItemSeekableTimeRangesChanged,
-            ItemLoadedTimeRangesChanged,
-            ItemPresentationSizeChanged,
-            ItemIsPlaybackLikelyToKeepUpChanged,
-            ItemIsPlaybackBufferEmptyChanged,
-            ItemIsPlaybackBufferFullChanged,
-            AssetMetadataLoaded,
-            AssetPlayabilityKnown,
-            PlayerRateChanged,
-            PlayerTimeChanged,
-            SeekCompleted,
-            DurationChanged,
-            ContentsNeedsDisplay,
-            InbandTracksNeedConfiguration
+#define DEFINE_TYPE_ENUM(type) type,
+            FOR_EACH_MEDIAPLAYERPRIVATEAVFOUNDATION_NOTIFICATION_TYPE(DEFINE_TYPE_ENUM)
+#undef DEFINE_TYPE_ENUM
         };
         
         Notification()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to