Title: [223399] releases/WebKitGTK/webkit-2.18
Revision
223399
Author
carlo...@webkit.org
Date
2017-10-16 06:10:27 -0700 (Mon, 16 Oct 2017)

Log Message

Merge r222530 - Followup (r222427): SynchronizedFixedQueue should not have a public constructor
https://bugs.webkit.org/show_bug.cgi?id=177458

Patch by Said Abou-Hallawa <sabouhall...@apple.com> on 2017-09-26
Reviewed by Tim Horton.

Source/WebCore:

ImageFrameCache::decodingQueue() and frameRequestQueue() should return
raw references instead of Ref objects.

* platform/graphics/ImageFrameCache.cpp:
(WebCore::ImageFrameCache::decodingQueue):
(WebCore::ImageFrameCache::frameRequestQueue):
(WebCore::ImageFrameCache::startAsyncDecodingQueue):
* platform/graphics/ImageFrameCache.h:

Source/WTF:

Since SynchronizedFixedQueue is now derived from ThreadSafeRefCounted<SynchronizedFixedQueue>,
the standard way to have an instance of it is to call SynchronizedFixedQueue::create()
which returns a Ref<SynchronizedFixedQueue>. Now it does not make sense to still
have the constructor public.

* wtf/SynchronizedFixedQueue.h:
(WTF::SynchronizedFixedQueue::SynchronizedFixedQueue):

Tools:

Fix the definition and the creation of SynchronizedFixedQueue.

* TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp:
(TestWebKitAPI::ToUpperConverter::ToUpperConverter):
(TestWebKitAPI::ToUpperConverter::startProducing):
(TestWebKitAPI::ToUpperConverter::startConsuming):
(TestWebKitAPI::ToUpperConverter::stopProducing):
(TestWebKitAPI::ToUpperConverter::stopConsuming):
(TestWebKitAPI::ToUpperConverter::enqueueLower):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.18/Source/WTF/ChangeLog (223398 => 223399)


--- releases/WebKitGTK/webkit-2.18/Source/WTF/ChangeLog	2017-10-16 13:10:16 UTC (rev 223398)
+++ releases/WebKitGTK/webkit-2.18/Source/WTF/ChangeLog	2017-10-16 13:10:27 UTC (rev 223399)
@@ -1,3 +1,18 @@
+2017-09-26  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        Followup (r222427): SynchronizedFixedQueue should not have a public constructor
+        https://bugs.webkit.org/show_bug.cgi?id=177458
+
+        Reviewed by Tim Horton.
+
+        Since SynchronizedFixedQueue is now derived from ThreadSafeRefCounted<SynchronizedFixedQueue>,
+        the standard way to have an instance of it is to call SynchronizedFixedQueue::create()
+        which returns a Ref<SynchronizedFixedQueue>. Now it does not make sense to still
+        have the constructor public.
+
+        * wtf/SynchronizedFixedQueue.h:
+        (WTF::SynchronizedFixedQueue::SynchronizedFixedQueue):
+
 2017-09-23  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         Images may render partial frames even after loading all the encoded data

Modified: releases/WebKitGTK/webkit-2.18/Source/WTF/wtf/SynchronizedFixedQueue.h (223398 => 223399)


--- releases/WebKitGTK/webkit-2.18/Source/WTF/wtf/SynchronizedFixedQueue.h	2017-10-16 13:10:16 UTC (rev 223398)
+++ releases/WebKitGTK/webkit-2.18/Source/WTF/wtf/SynchronizedFixedQueue.h	2017-10-16 13:10:27 UTC (rev 223399)
@@ -40,11 +40,6 @@
         return adoptRef(*new SynchronizedFixedQueue());
     }
 
-    SynchronizedFixedQueue()
-    {
-        static_assert(!((BufferSize - 1) & BufferSize), "BufferSize must be power of 2.");
-    }
-
     void open()
     {
         LockHolder lockHolder(m_mutex);
@@ -113,6 +108,11 @@
     }
 
 private:
+    SynchronizedFixedQueue()
+    {
+        static_assert(!((BufferSize - 1) & BufferSize), "BufferSize must be power of 2.");
+    }
+
     Lock m_mutex;
     Condition m_condition;
 

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog (223398 => 223399)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog	2017-10-16 13:10:16 UTC (rev 223398)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog	2017-10-16 13:10:27 UTC (rev 223399)
@@ -1,3 +1,19 @@
+2017-09-26  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        Followup (r222427): SynchronizedFixedQueue should not have a public constructor
+        https://bugs.webkit.org/show_bug.cgi?id=177458
+
+        Reviewed by Tim Horton.
+
+        ImageFrameCache::decodingQueue() and frameRequestQueue() should return
+        raw references instead of Ref objects.
+
+        * platform/graphics/ImageFrameCache.cpp:
+        (WebCore::ImageFrameCache::decodingQueue):
+        (WebCore::ImageFrameCache::frameRequestQueue):
+        (WebCore::ImageFrameCache::startAsyncDecodingQueue):
+        * platform/graphics/ImageFrameCache.h:
+
 2017-09-23  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         Images may render partial frames even after loading all the encoded data

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/ImageFrameCache.cpp (223398 => 223399)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/ImageFrameCache.cpp	2017-10-16 13:10:16 UTC (rev 223398)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/ImageFrameCache.cpp	2017-10-16 13:10:27 UTC (rev 223399)
@@ -262,7 +262,7 @@
         m_image->imageFrameAvailableAtIndex(index);
 }
 
-Ref<WorkQueue> ImageFrameCache::decodingQueue()
+WorkQueue& ImageFrameCache::decodingQueue()
 {
     if (!m_decodingQueue)
         m_decodingQueue = WorkQueue::create("org.webkit.ImageDecoder", WorkQueue::Type::Serial, WorkQueue::QOS::Default);
@@ -270,7 +270,7 @@
     return *m_decodingQueue;
 }
 
-Ref<ImageFrameCache::FrameRequestQueue> ImageFrameCache::frameRequestQueue()
+ImageFrameCache::FrameRequestQueue& ImageFrameCache::frameRequestQueue()
 {
     if (!m_frameRequestQueue)
         m_frameRequestQueue = FrameRequestQueue::create();
@@ -284,7 +284,7 @@
         return;
 
     // We need to protect this, m_decodingQueue and m_decoder from being deleted while we are in the decoding loop.
-    decodingQueue()->dispatch([protectedThis = makeRef(*this), protectedDecodingQueue = decodingQueue(), protectedFrameRequestQueue = frameRequestQueue(), protectedDecoder = makeRef(*m_decoder), sourceURL = sourceURL().string().isolatedCopy()] {
+    decodingQueue().dispatch([protectedThis = makeRef(*this), protectedDecodingQueue = makeRef(decodingQueue()), protectedFrameRequestQueue = makeRef(frameRequestQueue()), protectedDecoder = makeRef(*m_decoder), sourceURL = sourceURL().string().isolatedCopy()] {
         ImageFrameRequest frameRequest;
 
         while (protectedFrameRequestQueue->dequeue(frameRequest)) {

Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/ImageFrameCache.h (223398 => 223399)


--- releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/ImageFrameCache.h	2017-10-16 13:10:16 UTC (rev 223398)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/platform/graphics/ImageFrameCache.h	2017-10-16 13:10:27 UTC (rev 223399)
@@ -137,8 +137,8 @@
 
     struct ImageFrameRequest;
     static const int BufferSize = 8;
-    Ref<WorkQueue> decodingQueue();
-    Ref<SynchronizedFixedQueue<ImageFrameRequest, BufferSize>> frameRequestQueue();
+    WorkQueue& decodingQueue();
+    SynchronizedFixedQueue<ImageFrameRequest, BufferSize>& frameRequestQueue();
 
     const ImageFrame& frameAtIndexCacheIfNeeded(size_t, ImageFrame::Caching, const std::optional<SubsamplingLevel>& = { });
 

Modified: releases/WebKitGTK/webkit-2.18/Tools/ChangeLog (223398 => 223399)


--- releases/WebKitGTK/webkit-2.18/Tools/ChangeLog	2017-10-16 13:10:16 UTC (rev 223398)
+++ releases/WebKitGTK/webkit-2.18/Tools/ChangeLog	2017-10-16 13:10:27 UTC (rev 223399)
@@ -1,3 +1,20 @@
+2017-09-26  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        Followup (r222427): SynchronizedFixedQueue should not have a public constructor
+        https://bugs.webkit.org/show_bug.cgi?id=177458
+
+        Reviewed by Tim Horton.
+
+        Fix the definition and the creation of SynchronizedFixedQueue.
+
+        * TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp:
+        (TestWebKitAPI::ToUpperConverter::ToUpperConverter):
+        (TestWebKitAPI::ToUpperConverter::startProducing):
+        (TestWebKitAPI::ToUpperConverter::startConsuming):
+        (TestWebKitAPI::ToUpperConverter::stopProducing):
+        (TestWebKitAPI::ToUpperConverter::stopConsuming):
+        (TestWebKitAPI::ToUpperConverter::enqueueLower):
+
 2017-09-19  Wenson Hsieh  <wenson_hs...@apple.com>
 
         REGRESSION (r215613): Incorrect corners clipping with border-radius

Modified: releases/WebKitGTK/webkit-2.18/Tools/TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp (223398 => 223399)


--- releases/WebKitGTK/webkit-2.18/Tools/TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp	2017-10-16 13:10:16 UTC (rev 223398)
+++ releases/WebKitGTK/webkit-2.18/Tools/TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp	2017-10-16 13:10:27 UTC (rev 223399)
@@ -56,6 +56,8 @@
 class ToUpperConverter {
 public:
     ToUpperConverter()
+        : m_lowerQueue(SynchronizedFixedQueue<CString, BufferSize>::create())
+        , m_upperQueue(SynchronizedFixedQueue<CString, BufferSize>::create())
     {
     }
 
@@ -80,8 +82,8 @@
 
         produceQueue()->dispatch([this] {
             CString lower;
-            while (m_lowerQueue.dequeue(lower)) {
-                m_upperQueue.enqueue(toUpper(lower));
+            while (m_lowerQueue->dequeue(lower)) {
+                m_upperQueue->enqueue(toUpper(lower));
                 EXPECT_TRUE(lower == textItem(m_produceCount++));
                 std::this_thread::sleep_for(std::chrono::milliseconds(10));
             }
@@ -96,7 +98,7 @@
 
         consumeQueue()->dispatch([this] {
             CString upper;
-            while (m_upperQueue.dequeue(upper)) {
+            while (m_upperQueue->dequeue(upper)) {
                 EXPECT_TRUE(upper == toUpper(textItem(m_consumeCount++)));
                 std::this_thread::sleep_for(std::chrono::milliseconds(50));
             }
@@ -115,7 +117,7 @@
         if (!isProducing())
             return;
 
-        m_lowerQueue.close();
+        m_lowerQueue->close();
         m_produceCloseSemaphore.wait(WallTime::infinity());
         m_produceQueue = nullptr;
     }
@@ -125,7 +127,7 @@
         if (!isConsuming())
             return;
 
-        m_upperQueue.close();
+        m_upperQueue->close();
         m_consumeCloseSemaphore.wait(WallTime::infinity());
         m_consumeQueue = nullptr;
     }
@@ -138,7 +140,7 @@
 
     void enqueueLower(const CString& lower)
     {
-        m_lowerQueue.enqueue(lower);
+        m_lowerQueue->enqueue(lower);
     }
 
     bool isProducing() { return m_produceQueue; }
@@ -148,8 +150,8 @@
     size_t consumeCount() const { return m_consumeCount; }
 
 private:
-    SynchronizedFixedQueue<CString, BufferSize> m_lowerQueue;
-    SynchronizedFixedQueue<CString, BufferSize> m_upperQueue;
+    Ref<SynchronizedFixedQueue<CString, BufferSize>> m_lowerQueue;
+    Ref<SynchronizedFixedQueue<CString, BufferSize>> m_upperQueue;
     RefPtr<WorkQueue> m_produceQueue;
     RefPtr<WorkQueue> m_consumeQueue;
     BinarySemaphore m_produceCloseSemaphore;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to