Title: [230147] trunk/Source/WebCore
Revision
230147
Author
[email protected]
Date
2018-04-01 20:18:50 -0700 (Sun, 01 Apr 2018)

Log Message

Use WTF::Lock instead of GMutex
https://bugs.webkit.org/show_bug.cgi?id=184227

Reviewed by Saam Barati.

Prefer WTF::Lock over GMutex since these locks are just protecting WebKit C++ fields.

No behavior change.

* platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
(WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
(WebCore::AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer):
(WebCore::AudioSourceProviderGStreamer::provideInput):
(WebCore::AudioSourceProviderGStreamer::handleAudioBuffer):
(WebCore::AudioSourceProviderGStreamer::clearAdapters):
* platform/audio/gstreamer/AudioSourceProviderGStreamer.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
(WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
(WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const):
(WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
(WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
(WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
(WebCore::MediaPlayerPrivateGStreamerBase::paint):
(WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
(WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
* platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (230146 => 230147)


--- trunk/Source/WebCore/ChangeLog	2018-04-02 02:04:05 UTC (rev 230146)
+++ trunk/Source/WebCore/ChangeLog	2018-04-02 03:18:50 UTC (rev 230147)
@@ -1,3 +1,35 @@
+2018-04-01  Yusuke Suzuki  <[email protected]>
+
+        Use WTF::Lock instead of GMutex
+        https://bugs.webkit.org/show_bug.cgi?id=184227
+
+        Reviewed by Saam Barati.
+
+        Prefer WTF::Lock over GMutex since these locks are just protecting WebKit C++ fields.
+
+        No behavior change.
+
+        * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
+        (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
+        (WebCore::AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer):
+        (WebCore::AudioSourceProviderGStreamer::provideInput):
+        (WebCore::AudioSourceProviderGStreamer::handleAudioBuffer):
+        (WebCore::AudioSourceProviderGStreamer::clearAdapters):
+        * platform/audio/gstreamer/AudioSourceProviderGStreamer.h:
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
+        (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
+        (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize const):
+        (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
+        (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
+        (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
+        (WebCore::MediaPlayerPrivateGStreamerBase::paint):
+        (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
+        (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+        * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
+        * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
+
 2018-03-31  Brent Fulgham  <[email protected]>
 
         Show punycode if URL contains hyphen character

Modified: trunk/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp (230146 => 230147)


--- trunk/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp	2018-04-02 02:04:05 UTC (rev 230146)
+++ trunk/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp	2018-04-02 03:18:50 UTC (rev 230147)
@@ -26,7 +26,6 @@
 #include <gst/app/gstappsink.h>
 #include <gst/audio/audio-info.h>
 #include <gst/base/gstadapter.h>
-#include <wtf/glib/GMutexLocker.h>
 
 
 namespace WebCore {
@@ -91,7 +90,6 @@
     , m_deinterleaveNoMorePadsHandlerId(0)
     , m_deinterleavePadRemovedHandlerId(0)
 {
-    g_mutex_init(&m_adapterMutex);
     m_frontLeftAdapter = gst_adapter_new();
     m_frontRightAdapter = gst_adapter_new();
 }
@@ -109,7 +107,6 @@
 
     g_object_unref(m_frontLeftAdapter);
     g_object_unref(m_frontRightAdapter);
-    g_mutex_clear(&m_adapterMutex);
 }
 
 void AudioSourceProviderGStreamer::configureAudioBin(GstElement* audioBin, GstElement* teePredecessor)
@@ -154,7 +151,7 @@
 
 void AudioSourceProviderGStreamer::provideInput(AudioBus* bus, size_t framesToProcess)
 {
-    WTF::GMutexLocker<GMutex> lock(m_adapterMutex);
+    auto locker = holdLock(m_adapterMutex);
     copyGStreamerBuffersToAudioChannel(m_frontLeftAdapter, bus, 0, framesToProcess);
     copyGStreamerBuffersToAudioChannel(m_frontRightAdapter, bus, 1, framesToProcess);
 }
@@ -181,7 +178,7 @@
     GstAudioInfo info;
     gst_audio_info_from_caps(&info, caps);
 
-    WTF::GMutexLocker<GMutex> lock(m_adapterMutex);
+    auto locker = holdLock(m_adapterMutex);
 
     // Check the first audio channel. The buffer is supposed to store
     // data of a single channel anyway.
@@ -351,7 +348,7 @@
 
 void AudioSourceProviderGStreamer::clearAdapters()
 {
-    WTF::GMutexLocker<GMutex> lock(m_adapterMutex);
+    auto locker = holdLock(m_adapterMutex);
     gst_adapter_clear(m_frontLeftAdapter);
     gst_adapter_clear(m_frontRightAdapter);
 }

Modified: trunk/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.h (230146 => 230147)


--- trunk/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.h	2018-04-02 02:04:05 UTC (rev 230146)
+++ trunk/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.h	2018-04-02 03:18:50 UTC (rev 230147)
@@ -66,7 +66,7 @@
     unsigned long m_deinterleavePadAddedHandlerId;
     unsigned long m_deinterleaveNoMorePadsHandlerId;
     unsigned long m_deinterleavePadRemovedHandlerId;
-    GMutex m_adapterMutex;
+    Lock m_adapterMutex;
 };
 
 }

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2018-04-02 02:04:05 UTC (rev 230146)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2018-04-02 03:18:50 UTC (rev 230147)
@@ -37,7 +37,6 @@
 #include "NotImplemented.h"
 #include "VideoSinkGStreamer.h"
 #include "WebKitWebSourceGStreamer.h"
-#include <wtf/glib/GMutexLocker.h>
 #include <wtf/glib/GUniquePtr.h>
 #include <wtf/text/AtomicString.h>
 #include <wtf/text/CString.h>
@@ -237,7 +236,6 @@
     , m_platformLayerProxy(adoptRef(new TextureMapperPlatformLayerProxy()))
 #endif
 {
-    g_mutex_init(&m_sampleMutex);
 }
 
 MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase()
@@ -268,8 +266,6 @@
     if (m_pipeline)
         gst_element_set_state(m_pipeline.get(), GST_STATE_NULL);
 
-    g_mutex_clear(&m_sampleMutex);
-
     m_player = nullptr;
 }
 
@@ -520,7 +516,7 @@
     if (!m_videoSize.isEmpty())
         return m_videoSize;
 
-    WTF::GMutexLocker<GMutex> lock(m_sampleMutex);
+    auto sampleLocker = holdLock(m_sampleMutex);
     if (!GST_IS_SAMPLE(m_sample.get()))
         return FloatSize();
 
@@ -739,7 +735,7 @@
     ConditionNotifier notifier(m_drawMutex, m_drawCondition);
 #endif
 
-    WTF::GMutexLocker<GMutex> lock(m_sampleMutex);
+    auto sampleLocker = holdLock(m_sampleMutex);
     if (!GST_IS_SAMPLE(m_sample.get()))
         return;
 
@@ -790,7 +786,7 @@
 {
     bool triggerResize;
     {
-        WTF::GMutexLocker<GMutex> lock(m_sampleMutex);
+        auto sampleLocker = holdLock(m_sampleMutex);
         triggerResize = !m_sample;
         m_sample = sample;
     }
@@ -865,7 +861,7 @@
 void MediaPlayerPrivateGStreamerBase::flushCurrentBuffer()
 {
     GST_DEBUG_OBJECT(pipeline(), "Flushing video sample");
-    WTF::GMutexLocker<GMutex> lock(m_sampleMutex);
+    auto sampleLocker = holdLock(m_sampleMutex);
     m_sample.clear();
 
     {
@@ -890,7 +886,7 @@
     if (!m_player->visible())
         return;
 
-    WTF::GMutexLocker<GMutex> lock(m_sampleMutex);
+    auto sampleLocker = holdLock(m_sampleMutex);
     if (!GST_IS_SAMPLE(m_sample.get()))
         return;
 
@@ -917,7 +913,7 @@
     if (premultiplyAlpha)
         return false;
 
-    WTF::GMutexLocker<GMutex> lock(m_sampleMutex);
+    auto sampleLocker = holdLock(m_sampleMutex);
 
     GstVideoInfo videoInfo;
     if (!getSampleVideoInfo(m_sample.get(), videoInfo))
@@ -949,7 +945,7 @@
     if (m_usingFallbackVideoSink)
         return nullptr;
 
-    WTF::GMutexLocker<GMutex> lock(m_sampleMutex);
+    auto sampleLocker = holdLock(m_sampleMutex);
 
     GstVideoInfo videoInfo;
     if (!getSampleVideoInfo(m_sample.get(), videoInfo))

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (230146 => 230147)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h	2018-04-02 02:04:05 UTC (rev 230146)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h	2018-04-02 03:18:50 UTC (rev 230147)
@@ -226,7 +226,7 @@
     MediaPlayer::ReadyState m_readyState;
     mutable MediaPlayer::NetworkState m_networkState;
     IntSize m_size;
-    mutable GMutex m_sampleMutex;
+    mutable Lock m_sampleMutex;
     GRefPtr<GstSample> m_sample;
 
     mutable FloatSize m_videoSize;

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp (230146 => 230147)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp	2018-04-02 02:04:05 UTC (rev 230146)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/PlaybackPipeline.cpp	2018-04-02 03:18:50 UTC (rev 230147)
@@ -36,7 +36,6 @@
 #include <gst/gst.h>
 #include <wtf/MainThread.h>
 #include <wtf/RefCounted.h>
-#include <wtf/glib/GMutexLocker.h>
 #include <wtf/glib/GRefPtr.h>
 #include <wtf/glib/GUniquePtr.h>
 #include <wtf/text/AtomicString.h>

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp (230146 => 230147)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp	2018-04-02 02:04:05 UTC (rev 230146)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp	2018-04-02 03:18:50 UTC (rev 230147)
@@ -48,7 +48,6 @@
 #include <gst/video/video.h>
 #include <wtf/Condition.h>
 #include <wtf/MainThread.h>
-#include <wtf/glib/GMutexLocker.h>
 #include <wtf/glib/GUniquePtr.h>
 #include <wtf/text/CString.h>
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to