<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[277438] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/277438">277438</a></dd>
<dt>Author</dt> <dd>aboya@igalia.com</dd>
<dt>Date</dt> <dd>2021-05-13 10:03:39 -0700 (Thu, 13 May 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WTF] Add holdLock() overload for WTF::DataMutex
https://bugs.webkit.org/show_bug.cgi?id=225652

Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

All instantiations of DataMutex::LockedWrapper have been replaced by
holdLock(), for equivalent but more concise code.

This patch introduces no behavior changes.

* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcConstructed):
(webKitWebSrcGetProperty):
(webKitWebSrcSetContext):
(webKitWebSrcCreate):
(webKitWebSrcMakeRequest):
(webKitWebSrcStop):
(webKitWebSrcGetSize):
(webKitWebSrcIsSeekable):
(webKitWebSrcDoSeek):
(webKitWebSrcQuery):
(webKitWebSrcUnLock):
(webKitWebSrcUnLockStop):
(webKitWebSrcSetMediaPlayer):
(webKitSrcPassedCORSAccessCheck):
(CachedResourceStreamingClient::responseReceived):
(CachedResourceStreamingClient::dataReceived):
(CachedResourceStreamingClient::accessControlCheckFailed):
(CachedResourceStreamingClient::loadFailed):
(CachedResourceStreamingClient::loadFinished):
(webKitSrcWouldTaintOrigin):
* platform/graphics/gstreamer/mse/MediaSourceTrackGStreamer.cpp:
(WebCore::MediaSourceTrackGStreamer::isReadyForMoreSamples):
(WebCore::MediaSourceTrackGStreamer::notifyWhenReadyForMoreSamples):
(WebCore::MediaSourceTrackGStreamer::enqueueObject):
(WebCore::MediaSourceTrackGStreamer::clearQueue):
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(webKitMediaSrcActivateMode):
(webKitMediaSrcPadLinked):
(webKitMediaSrcLoop):
(webKitMediaSrcStreamFlush):

Source/WTF:

This patch adds a holdLock() overload for WTF::DataMutex as syntactic
sugar to simplify usage in a similar way to what holdLock() already
does for WTF::Locker.

* wtf/DataMutex.h:
(WTF::holdLock):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfDataMutexh">trunk/Source/WTF/wtf/DataMutex.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerWebKitWebSourceGStreamercpp">trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamermseMediaSourceTrackGStreamercpp">trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceTrackGStreamer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamermseWebKitMediaSourceGStreamercpp">trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (277437 => 277438)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog       2021-05-13 16:18:32 UTC (rev 277437)
+++ trunk/Source/WTF/ChangeLog  2021-05-13 17:03:39 UTC (rev 277438)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2021-05-13  Alicia Boya García  <aboya@igalia.com>
+
+        [WTF] Add holdLock() overload for WTF::DataMutex
+        https://bugs.webkit.org/show_bug.cgi?id=225652
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        This patch adds a holdLock() overload for WTF::DataMutex as syntactic
+        sugar to simplify usage in a similar way to what holdLock() already
+        does for WTF::Locker.
+
+        * wtf/DataMutex.h:
+        (WTF::holdLock):
+
</ins><span class="cx"> 2021-05-13  Darin Adler  <darin@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Remove StringBuilder::appendNumber
</span></span></pre></div>
<a id="trunkSourceWTFwtfDataMutexh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/DataMutex.h (277437 => 277438)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/DataMutex.h 2021-05-13 16:18:32 UTC (rev 277437)
+++ trunk/Source/WTF/wtf/DataMutex.h    2021-05-13 17:03:39 UTC (rev 277438)
</span><span class="lines">@@ -149,4 +149,10 @@
</span><span class="cx">     T m_data;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+template<typename T>
+typename DataMutex<T>::LockedWrapper holdLock(DataMutex<T>& dataMutex)
+{
+    return typename DataMutex<T>::LockedWrapper(dataMutex);
+}
+
</ins><span class="cx"> } // namespace WTF
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (277437 => 277438)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-05-13 16:18:32 UTC (rev 277437)
+++ trunk/Source/WebCore/ChangeLog      2021-05-13 17:03:39 UTC (rev 277438)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2021-05-13  Alicia Boya García  <aboya@igalia.com>
+
+        [WTF] Add holdLock() overload for WTF::DataMutex
+        https://bugs.webkit.org/show_bug.cgi?id=225652
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        All instantiations of DataMutex::LockedWrapper have been replaced by
+        holdLock(), for equivalent but more concise code.
+
+        This patch introduces no behavior changes.
+
+        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+        (webKitWebSrcConstructed):
+        (webKitWebSrcGetProperty):
+        (webKitWebSrcSetContext):
+        (webKitWebSrcCreate):
+        (webKitWebSrcMakeRequest):
+        (webKitWebSrcStop):
+        (webKitWebSrcGetSize):
+        (webKitWebSrcIsSeekable):
+        (webKitWebSrcDoSeek):
+        (webKitWebSrcQuery):
+        (webKitWebSrcUnLock):
+        (webKitWebSrcUnLockStop):
+        (webKitWebSrcSetMediaPlayer):
+        (webKitSrcPassedCORSAccessCheck):
+        (CachedResourceStreamingClient::responseReceived):
+        (CachedResourceStreamingClient::dataReceived):
+        (CachedResourceStreamingClient::accessControlCheckFailed):
+        (CachedResourceStreamingClient::loadFailed):
+        (CachedResourceStreamingClient::loadFinished):
+        (webKitSrcWouldTaintOrigin):
+        * platform/graphics/gstreamer/mse/MediaSourceTrackGStreamer.cpp:
+        (WebCore::MediaSourceTrackGStreamer::isReadyForMoreSamples):
+        (WebCore::MediaSourceTrackGStreamer::notifyWhenReadyForMoreSamples):
+        (WebCore::MediaSourceTrackGStreamer::enqueueObject):
+        (WebCore::MediaSourceTrackGStreamer::clearQueue):
+        * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
+        (webKitMediaSrcActivateMode):
+        (webKitMediaSrcPadLinked):
+        (webKitMediaSrcLoop):
+        (webKitMediaSrcStreamFlush):
+
</ins><span class="cx"> 2021-05-13  Darin Adler  <darin@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Remove StringBuilder::appendNumber
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerWebKitWebSourceGStreamercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp (277437 => 277438)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp    2021-05-13 16:18:32 UTC (rev 277437)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp       2021-05-13 17:03:39 UTC (rev 277438)
</span><span class="lines">@@ -301,7 +301,7 @@
</span><span class="cx"> 
</span><span class="cx">     priv->minimumBlocksize = gst_base_src_get_blocksize(GST_BASE_SRC_CAST(src));
</span><span class="cx"> 
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(priv->dataMutex);
</del><ins>+    auto members = holdLock(priv->dataMutex);
</ins><span class="cx">     members->adapter = adoptGRef(gst_adapter_new());
</span><span class="cx">     webkitWebSrcReset(src, members, ResetType::Hard);
</span><span class="cx"> 
</span><span class="lines">@@ -346,7 +346,7 @@
</span><span class="cx">         g_value_set_string(value, priv->originalURI.data());
</span><span class="cx">         break;
</span><span class="cx">     case PROP_RESOLVED_LOCATION: {
</span><del>-        DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(priv->dataMutex);
</del><ins>+        auto members = holdLock(priv->dataMutex);
</ins><span class="cx">         g_value_set_string(value, members->redirectedURI.isNull() ? priv->originalURI.data() : members->redirectedURI.data());
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -376,7 +376,7 @@
</span><span class="cx">     GST_DEBUG_OBJECT(src, "context type: %s", gst_context_get_context_type(context));
</span><span class="cx">     if (gst_context_has_context_type(context, WEBKIT_WEB_SRC_PLAYER_CONTEXT_TYPE_NAME)) {
</span><span class="cx">         const GValue* value = gst_structure_get_value(gst_context_get_structure(context), "player");
</span><del>-        DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(priv->dataMutex);
</del><ins>+        auto members = holdLock(priv->dataMutex);
</ins><span class="cx">         members->player = reinterpret_cast<MediaPlayer*>(g_value_get_pointer(value));
</span><span class="cx">     }
</span><span class="cx">     GST_ELEMENT_CLASS(parent_class)->set_context(element, context);
</span><span class="lines">@@ -459,7 +459,7 @@
</span><span class="cx">     GstBaseSrc* baseSrc = GST_BASE_SRC_CAST(pushSrc);
</span><span class="cx">     WebKitWebSrc* src = WEBKIT_WEB_SRC(baseSrc);
</span><span class="cx">     WebKitWebSrcPrivate* priv = src->priv;
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(priv->dataMutex);
</del><ins>+    auto members = holdLock(priv->dataMutex);
</ins><span class="cx"> 
</span><span class="cx">     // We need members->player to make requests. There are two mechanisms for this.
</span><span class="cx">     //
</span><span class="lines">@@ -689,7 +689,7 @@
</span><span class="cx">     ASSERT(!isMainThread());
</span><span class="cx">     RunLoop::main().dispatch([protector = WTF::ensureGRef(src), request = WTFMove(request), requestNumber = members->requestNumber] {
</span><span class="cx">         WebKitWebSrcPrivate* priv = protector->priv;
</span><del>-        DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(priv->dataMutex);
</del><ins>+        auto members = holdLock(priv->dataMutex);
</ins><span class="cx">         // Ignore this task (not making any HTTP request) if by now WebKitWebSrc streaming thread is already waiting
</span><span class="cx">         // for a different request. There is no point anymore in sending this one.
</span><span class="cx">         if (members->requestNumber != requestNumber) {
</span><span class="lines">@@ -716,7 +716,7 @@
</span><span class="cx"> {
</span><span class="cx">     WebKitWebSrc* src = WEBKIT_WEB_SRC(baseSrc);
</span><span class="cx">     // basesrc will always call unLock() and unLockStop() before calling this. See gst_base_src_stop().
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(src->priv->dataMutex);
</del><ins>+    auto members = holdLock(src->priv->dataMutex);
</ins><span class="cx">     webkitWebSrcReset(src, members, ResetType::Hard);
</span><span class="cx">     GST_DEBUG_OBJECT(src, "Stopped WebKitWebSrc");
</span><span class="cx">     return TRUE;
</span><span class="lines">@@ -725,7 +725,7 @@
</span><span class="cx"> static gboolean webKitWebSrcGetSize(GstBaseSrc* baseSrc, guint64* size)
</span><span class="cx"> {
</span><span class="cx">     WebKitWebSrc* src = WEBKIT_WEB_SRC(baseSrc);
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(src->priv->dataMutex);
</del><ins>+    auto members = holdLock(src->priv->dataMutex);
</ins><span class="cx"> 
</span><span class="cx">     GST_DEBUG_OBJECT(src, "haveSize: %s, size: %" G_GUINT64_FORMAT, boolForPrinting(members->haveSize), members->size);
</span><span class="cx">     if (members->haveSize) {
</span><span class="lines">@@ -739,7 +739,7 @@
</span><span class="cx"> static gboolean webKitWebSrcIsSeekable(GstBaseSrc* baseSrc)
</span><span class="cx"> {
</span><span class="cx">     WebKitWebSrc* src = WEBKIT_WEB_SRC(baseSrc);
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(src->priv->dataMutex);
</del><ins>+    auto members = holdLock(src->priv->dataMutex);
</ins><span class="cx">     GST_DEBUG_OBJECT(src, "isSeekable: %s", boolForPrinting(members->isSeekable));
</span><span class="cx">     return members->isSeekable;
</span><span class="cx"> }
</span><span class="lines">@@ -756,7 +756,7 @@
</span><span class="cx">     ASSERT(GST_ELEMENT(baseSrc)->current_state < GST_STATE_PAUSED || webKitWebSrcIsSeekable(baseSrc));
</span><span class="cx"> 
</span><span class="cx">     WebKitWebSrc* src = WEBKIT_WEB_SRC(baseSrc);
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(src->priv->dataMutex);
</del><ins>+    auto members = holdLock(src->priv->dataMutex);
</ins><span class="cx"> 
</span><span class="cx">     GST_DEBUG_OBJECT(src, "Seek segment: (%" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT ") Position previous to seek: %" G_GUINT64_FORMAT, segment->start, segment->stop, members->readPosition);
</span><span class="cx"> 
</span><span class="lines">@@ -786,7 +786,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (GST_QUERY_TYPE(query) == GST_QUERY_URI) {
</span><span class="cx">         gst_query_set_uri(query, priv->originalURI.data());
</span><del>-        DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(src->priv->dataMutex);
</del><ins>+        auto members = holdLock(src->priv->dataMutex);
</ins><span class="cx">         if (!members->redirectedURI.isNull())
</span><span class="cx">             gst_query_set_uri_redirection(query, members->redirectedURI.data());
</span><span class="cx">         result = TRUE;
</span><span class="lines">@@ -809,7 +809,7 @@
</span><span class="cx"> static gboolean webKitWebSrcUnLock(GstBaseSrc* baseSrc)
</span><span class="cx"> {
</span><span class="cx">     WebKitWebSrc* src = WEBKIT_WEB_SRC(baseSrc);
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(src->priv->dataMutex);
</del><ins>+    auto members = holdLock(src->priv->dataMutex);
</ins><span class="cx"> 
</span><span class="cx">     GST_DEBUG_OBJECT(src, "Unlock");
</span><span class="cx">     members->isFlushing = true;
</span><span class="lines">@@ -840,7 +840,7 @@
</span><span class="cx"> static gboolean webKitWebSrcUnLockStop(GstBaseSrc* baseSrc)
</span><span class="cx"> {
</span><span class="cx">     WebKitWebSrc* src = WEBKIT_WEB_SRC(baseSrc);
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(src->priv->dataMutex);
</del><ins>+    auto members = holdLock(src->priv->dataMutex);
</ins><span class="cx">     GST_DEBUG_OBJECT(src, "Unlock stop");
</span><span class="cx">     members->isFlushing = false;
</span><span class="cx">     webkitWebSrcReset(src, members, ResetType::Soft);
</span><span class="lines">@@ -926,7 +926,7 @@
</span><span class="cx"> void webKitWebSrcSetMediaPlayer(WebKitWebSrc* src, WebCore::MediaPlayer* player, const String& referrer)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(player);
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(src->priv->dataMutex);
</del><ins>+    auto members = holdLock(src->priv->dataMutex);
</ins><span class="cx">     members->player = player;
</span><span class="cx">     members->referrer = referrer;
</span><span class="cx"> }
</span><span class="lines">@@ -933,7 +933,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool webKitSrcPassedCORSAccessCheck(WebKitWebSrc* src)
</span><span class="cx"> {
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(src->priv->dataMutex);
</del><ins>+    auto members = holdLock(src->priv->dataMutex);
</ins><span class="cx">     return members->didPassAccessControlCheck;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -988,7 +988,7 @@
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     WebKitWebSrc* src = WEBKIT_WEB_SRC(m_src.get());
</span><span class="cx">     WebKitWebSrcPrivate* priv = src->priv;
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(priv->dataMutex);
</del><ins>+    auto members = holdLock(priv->dataMutex);
</ins><span class="cx">     if (members->requestNumber != m_requestNumber) {
</span><span class="cx">         completionHandler(ShouldContinuePolicyCheck::No);
</span><span class="cx">         return;
</span><span class="lines">@@ -1094,7 +1094,7 @@
</span><span class="cx">     WebKitWebSrc* src = WEBKIT_WEB_SRC(m_src.get());
</span><span class="cx">     WebKitWebSrcPrivate* priv = src->priv;
</span><span class="cx"> 
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(priv->dataMutex);
</del><ins>+    auto members = holdLock(priv->dataMutex);
</ins><span class="cx">     if (members->requestNumber != m_requestNumber)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -1130,7 +1130,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     WebKitWebSrc* src = WEBKIT_WEB_SRC(m_src.get());
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(src->priv->dataMutex);
</del><ins>+    auto members = holdLock(src->priv->dataMutex);
</ins><span class="cx">     if (members->requestNumber != m_requestNumber)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -1143,7 +1143,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     WebKitWebSrc* src = WEBKIT_WEB_SRC(m_src.get());
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(src->priv->dataMutex);
</del><ins>+    auto members = holdLock(src->priv->dataMutex);
</ins><span class="cx">     if (members->requestNumber != m_requestNumber)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -1160,7 +1160,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     WebKitWebSrc* src = WEBKIT_WEB_SRC(m_src.get());
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(src->priv->dataMutex);
</del><ins>+    auto members = holdLock(src->priv->dataMutex);
</ins><span class="cx">     if (members->requestNumber != m_requestNumber)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -1170,7 +1170,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool webKitSrcWouldTaintOrigin(WebKitWebSrc* src, const SecurityOrigin& origin)
</span><span class="cx"> {
</span><del>-    DataMutex<WebKitWebSrcPrivate::StreamingMembers>::LockedWrapper members(src->priv->dataMutex);
</del><ins>+    auto members = holdLock(src->priv->dataMutex);
</ins><span class="cx"> 
</span><span class="cx">     auto* cachedResourceStreamingClient = reinterpret_cast<CachedResourceStreamingClient*>(members->resource->client());
</span><span class="cx">     for (auto& responseOrigin : cachedResourceStreamingClient->securityOrigins()) {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamermseMediaSourceTrackGStreamercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceTrackGStreamer.cpp (277437 => 277438)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceTrackGStreamer.cpp       2021-05-13 16:18:32 UTC (rev 277437)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceTrackGStreamer.cpp  2021-05-13 17:03:39 UTC (rev 277438)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx"> bool MediaSourceTrackGStreamer::isReadyForMoreSamples()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><del>-    WTF::DataMutex<TrackQueue>::LockedWrapper queue(m_queueDataMutex);
</del><ins>+    auto queue = holdLock(m_queueDataMutex);
</ins><span class="cx">     return !queue->isFull();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx"> void MediaSourceTrackGStreamer::notifyWhenReadyForMoreSamples(TrackQueue::LowLevelHandler&& handler)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><del>-    WTF::DataMutex<TrackQueue>::LockedWrapper queue(m_queueDataMutex);
</del><ins>+    auto queue = holdLock(m_queueDataMutex);
</ins><span class="cx">     queue->notifyWhenLowLevel(WTFMove(handler));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> void MediaSourceTrackGStreamer::enqueueObject(GRefPtr<GstMiniObject>&& object)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><del>-    WTF::DataMutex<TrackQueue>::LockedWrapper queue(m_queueDataMutex);
</del><ins>+    auto queue = holdLock(m_queueDataMutex);
</ins><span class="cx">     queue->enqueueObject(WTFMove(object));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx"> void MediaSourceTrackGStreamer::clearQueue()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><del>-    WTF::DataMutex<TrackQueue>::LockedWrapper queue(m_queueDataMutex);
</del><ins>+    auto queue = holdLock(m_queueDataMutex);
</ins><span class="cx">     queue->clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamermseWebKitMediaSourceGStreamercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp (277437 => 277438)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp      2021-05-13 16:18:32 UTC (rev 277437)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp 2021-05-13 17:03:39 UTC (rev 277438)
</span><span class="lines">@@ -344,7 +344,7 @@
</span><span class="cx">         // Unblock the streaming thread.
</span><span class="cx">         RefPtr<Stream>& stream = WEBKIT_MEDIA_SRC_PAD(pad)->priv->stream;
</span><span class="cx">         {
</span><del>-            DataMutex<Stream::StreamingMembers>::LockedWrapper streamingMembers(stream->streamingMembersDataMutex);
</del><ins>+            auto streamingMembers = holdLock(stream->streamingMembersDataMutex);
</ins><span class="cx">             streamingMembers->isFlushing = true;
</span><span class="cx">             streamingMembers->padLinkedOrFlushedCondition.notifyOne();
</span><span class="cx">             streamingMembers->queueChangedOrFlushedCondition.notifyOne();
</span><span class="lines">@@ -354,7 +354,7 @@
</span><span class="cx">         // Otherwise a deadlock would occur as the next function tries to join the thread.
</span><span class="cx">         gst_pad_stop_task(pad);
</span><span class="cx">         {
</span><del>-            DataMutex<Stream::StreamingMembers>::LockedWrapper streamingMembers(stream->streamingMembersDataMutex);
</del><ins>+            auto streamingMembers = holdLock(stream->streamingMembersDataMutex);
</ins><span class="cx">             streamingMembers->isFlushing = false;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -364,7 +364,7 @@
</span><span class="cx"> static void webKitMediaSrcPadLinked(GstPad* pad, GstPad*, void*)
</span><span class="cx"> {
</span><span class="cx">     RefPtr<Stream>& stream = WEBKIT_MEDIA_SRC_PAD(pad)->priv->stream;
</span><del>-    DataMutex<Stream::StreamingMembers>::LockedWrapper streamingMembers(stream->streamingMembersDataMutex);
</del><ins>+    auto streamingMembers = holdLock(stream->streamingMembersDataMutex);
</ins><span class="cx">     streamingMembers->padLinkedOrFlushedCondition.notifyOne();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -374,7 +374,7 @@
</span><span class="cx">     GstPad* pad = GST_PAD(userData);
</span><span class="cx">     RefPtr<Stream>& stream = WEBKIT_MEDIA_SRC_PAD(pad)->priv->stream;
</span><span class="cx"> 
</span><del>-    DataMutex<Stream::StreamingMembers>::LockedWrapper streamingMembers(stream->streamingMembersDataMutex);
</del><ins>+    auto streamingMembers = holdLock(stream->streamingMembersDataMutex);
</ins><span class="cx">     if (streamingMembers->isFlushing) {
</span><span class="cx">         gst_pad_pause_task(pad);
</span><span class="cx">         return;
</span><span class="lines">@@ -440,7 +440,7 @@
</span><span class="cx"> 
</span><span class="cx">     GRefPtr<GstMiniObject> object;
</span><span class="cx">     {
</span><del>-        DataMutex<TrackQueue>::LockedWrapper queue(stream->track->queueDataMutex());
</del><ins>+        auto queue = holdLock(stream->track->queueDataMutex());
</ins><span class="cx">         if (!queue->isEmpty()) {
</span><span class="cx">             object = queue->pop();
</span><span class="cx">             streamingMembers->hasPoppedFirstObject = true;
</span><span class="lines">@@ -448,7 +448,7 @@
</span><span class="cx">         } else {
</span><span class="cx">             queue->notifyWhenNotEmpty([&object, stream](GRefPtr<GstMiniObject>&& receivedObject) {
</span><span class="cx">                 ASSERT(isMainThread());
</span><del>-                DataMutex<Stream::StreamingMembers>::LockedWrapper streamingMembers(stream->streamingMembersDataMutex);
</del><ins>+                auto streamingMembers = holdLock(stream->streamingMembersDataMutex);
</ins><span class="cx">                 ASSERT(!streamingMembers->isFlushing);
</span><span class="cx"> 
</span><span class="cx">                 object = WTFMove(receivedObject);
</span><span class="lines">@@ -465,7 +465,7 @@
</span><span class="cx">     });
</span><span class="cx">     {
</span><span class="cx">         // Ensure that notifyWhenNotEmpty()'s callback (if any) is cleared after this point.
</span><del>-        DataMutex<TrackQueue>::LockedWrapper queue(stream->track->queueDataMutex());
</del><ins>+        auto queue = holdLock(stream->track->queueDataMutex());
</ins><span class="cx">         queue->resetNotEmptyHandler();
</span><span class="cx">     }
</span><span class="cx">     if (streamingMembers->isFlushing) {
</span><span class="lines">@@ -540,11 +540,11 @@
</span><span class="cx">     bool skipFlush = false;
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        DataMutex<Stream::StreamingMembers>::LockedWrapper streamingMembers(stream->streamingMembersDataMutex);
</del><ins>+        auto streamingMembers = holdLock(stream->streamingMembersDataMutex);
</ins><span class="cx"> 
</span><span class="cx">         if (!streamingMembers->hasPoppedFirstObject) {
</span><span class="cx">             GST_DEBUG_OBJECT(stream->source, "Flush request for stream '%s' occurred before hasPoppedFirstObject, just clearing the queue and readjusting the segment.", stream->track->trackId().string().utf8().data());
</span><del>-            DataMutex<TrackQueue>::LockedWrapper queue(stream->track->queueDataMutex());
</del><ins>+            auto queue = holdLock(stream->track->queueDataMutex());
</ins><span class="cx">             // We use clear() instead of flush() because the WebKitMediaSrc streaming thread could be waiting
</span><span class="cx">             // for the queue. flush() would cancel the notEmptyCallback therefore leaving the streaming thread
</span><span class="cx">             // stuck waiting forever.
</span><span class="lines">@@ -558,8 +558,8 @@
</span><span class="cx">         // which will keeping the streaming thread idle.
</span><span class="cx">         GST_DEBUG_OBJECT(stream->pad.get(), "Taking the StreamingMembers mutex and setting isFlushing = true.");
</span><span class="cx">         {
</span><del>-            DataMutex<Stream::StreamingMembers>::LockedWrapper streamingMembers(stream->streamingMembersDataMutex);
-            DataMutex<TrackQueue>::LockedWrapper queue(stream->track->queueDataMutex());
</del><ins>+            auto streamingMembers = holdLock(stream->streamingMembersDataMutex);
+            auto queue = holdLock(stream->track->queueDataMutex());
</ins><span class="cx"> 
</span><span class="cx">             streamingMembers->isFlushing = true;
</span><span class="cx">             queue->flush(); // Clear the queue and cancel any waiting callback.
</span><span class="lines">@@ -581,7 +581,7 @@
</span><span class="cx">         // In the case of seeking flush we are resetting the timeline (see the flush stop later).
</span><span class="cx">         // The resulting segment is brand new, but with a different start time.
</span><span class="cx">         WebKitMediaSrcPrivate* priv = stream->source->priv;
</span><del>-        DataMutex<Stream::StreamingMembers>::LockedWrapper streamingMembers(stream->streamingMembersDataMutex);
</del><ins>+        auto streamingMembers = holdLock(stream->streamingMembersDataMutex);
</ins><span class="cx">         streamingMembers->segment.base = 0;
</span><span class="cx">         streamingMembers->segment.rate = priv->rate;
</span><span class="cx">         streamingMembers->segment.start = streamingMembers->segment.time = priv->startTime;
</span><span class="lines">@@ -595,7 +595,7 @@
</span><span class="cx">         // GST_CLOCK_TIME_NONE is returned when the pipeline is not yet pre-rolled (e.g. just after a seek). In this case
</span><span class="cx">         // we don't need to adjust the segment though, as running time has not advanced.
</span><span class="cx">         if (GST_CLOCK_TIME_IS_VALID(pipelineStreamTime)) {
</span><del>-            DataMutex<Stream::StreamingMembers>::LockedWrapper streamingMembers(stream->streamingMembersDataMutex);
</del><ins>+            auto streamingMembers = holdLock(stream->streamingMembersDataMutex);
</ins><span class="cx">             // We need to increase the base by the running time accumulated during the previous segment.
</span><span class="cx"> 
</span><span class="cx">             GstClockTime pipelineRunningTime = gst_segment_to_running_time(&streamingMembers->segment, GST_FORMAT_TIME, pipelineStreamTime);
</span><span class="lines">@@ -614,7 +614,7 @@
</span><span class="cx">         GST_PAD_STREAM_LOCK(stream->pad.get());
</span><span class="cx">         {
</span><span class="cx">             GST_DEBUG_OBJECT(stream->pad.get(), "Taking the StreamingMembers mutex again.");
</span><del>-            DataMutex<Stream::StreamingMembers>::LockedWrapper streamingMembers(stream->streamingMembersDataMutex);
</del><ins>+            auto streamingMembers = holdLock(stream->streamingMembersDataMutex);
</ins><span class="cx">             GST_DEBUG_OBJECT(stream->pad.get(), "StreamingMembers mutex taken, using it to set isFlushing = false.");
</span><span class="cx">             streamingMembers->isFlushing = false;
</span><span class="cx">             streamingMembers->doesNeedSegmentEvent = true;
</span></span></pre>
</div>
</div>

</body>
</html>