Refactor checking log channel state in MediaPlayerPrivateGStreamerBase.
authorpmolnar.u-szeged@partner.samsung.com <pmolnar.u-szeged@partner.samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Mar 2014 10:07:01 +0000 (10:07 +0000)
committerpmolnar.u-szeged@partner.samsung.com <pmolnar.u-szeged@partner.samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Mar 2014 10:07:01 +0000 (10:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=130241

Reviewed by Philippe Normand.

The channel was passed around only to check its state. Cleaned this up
by adding a method to check whether a log channel is enabled.

* platform/Logging.cpp:
(WebCore::isLogChannelEnabled):
* platform/Logging.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/Logging.cpp
Source/WebCore/platform/Logging.h
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp

index a1b6f0a123c33d99ecc493c8b5a1297a692ce8f9..44ac8ab434875b519fa9e83ffb1fc01fddfa6f34 100644 (file)
@@ -1,3 +1,19 @@
+2014-03-20  Peter Molnar  <pmolnar.u-szeged@partner.samsung.com>
+
+        Refactor checking log channel state in MediaPlayerPrivateGStreamerBase.
+        https://bugs.webkit.org/show_bug.cgi?id=130241
+
+        Reviewed by Philippe Normand.
+
+        The channel was passed around only to check its state. Cleaned this up
+        by adding a method to check whether a log channel is enabled.
+
+        * platform/Logging.cpp:
+        (WebCore::isLogChannelEnabled):
+        * platform/Logging.h:
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
+
 2014-03-20  Lorenzo Tilve  <ltilve@igalia.com>
 
         Dispatch input event for Range element keyboard event
index 3ce46eef78438dcb51e989c958680bfe0fc4cc1f..849e5c6d7b281ee27e00874a9b83cc0b940c5f80 100644 (file)
@@ -45,9 +45,12 @@ WTFLogChannel* logChannels[] = {
 
 size_t logChannelCount = WTF_ARRAY_LENGTH(logChannels);
 
-WTFLogChannel* logChannelByName(const String& name)
+bool isLogChannelEnabled(const String& name)
 {
-    return WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data());
+    WTFLogChannel* channel = WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data());
+    if (!channel)
+        return false;
+    return channel->state != WTFLogChannelOff;
 }
 
 void initializeLoggingChannelsIfNecessary()
index 3c86f4eb12afe1f4410b64739fabe7f622a0e196..2aea157398b9694afa411505768899facc72e4f4 100644 (file)
@@ -80,7 +80,7 @@ WEBCORE_LOG_CHANNELS(DECLARE_LOG_CHANNEL)
 #undef DECLARE_LOG_CHANNEL
 
     String logLevelString();
-    WTFLogChannel* logChannelByName(const String&);
+    bool isLogChannelEnabled(const String& name);
     void initializeLoggingChannelsIfNecessary();
 }
 
index 85cc3151c7efea0e65e6b8407333de70f6699173..b6ea2028dd3237c739aca8b130cab66c1c4747e9 100644 (file)
@@ -466,8 +466,7 @@ GstElement* MediaPlayerPrivateGStreamerBase::createVideoSink()
 #if LOG_DISABLED
         g_object_set(m_fpsSink.get(), "text-overlay", FALSE , nullptr);
 #else
-        WTFLogChannel* channel = logChannelByName("Media");
-        if (channel->state != WTFLogChannelOn)
+        if (!isLogChannelEnabled("Media"))
             g_object_set(m_fpsSink.get(), "text-overlay", FALSE , nullptr);
 #endif // LOG_DISABLED