Images may render partial frames even after loading all the encoded data
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Sep 2017 21:05:52 +0000 (21:05 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Sep 2017 21:05:52 +0000 (21:05 +0000)
commit5112e831beac32d9c21388449307d4602497bf7b
tree4b77b29df2c247e17cda0c2d0ce86503c8b932a1
parentd90d40e3952bc4f7dec0c838f686dd35625b53ac
Images may render partial frames even after loading all the encoded data
https://bugs.webkit.org/show_bug.cgi?id=177406

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-09-23
Reviewed by Simon Fraser.

Source/WebCore:

Because we do not want to block the main thread waiting for the image decoding
thread to terminate, we let the decoding thread finish its work even it will
be thrown away. If a new decoding thread is created and the SynchronizedFixedQueue
is reopened, the terminating decoding thread might have the chance to process
a new frame request. After it finishes decoding it, it realize that it is
terminating so it will drop the decoded frame to the floor. So the new request
was not processed by the new thread and because it was processed by the
terminating thread, nothing will be reported to the BitmapImage object and
the renderer will not be repainted.

The fix is to create a new SynchronizedFixedQueue every time a decoding
thread is created. This will guarantee that the terminating thread won't
have access to the new frame request and will shut down after being notified
by the old SynchronizedFixedQueue that it has been closed.

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

Source/WTF:

Make it possible to create a RefPtr<SynchronizedFixedQueue>.

* wtf/SynchronizedFixedQueue.h:
(WTF::SynchronizedFixedQueue::create):
(WTF::SynchronizedFixedQueue::enqueue):
(WTF::SynchronizedFixedQueue::dequeue):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222427 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/SynchronizedFixedQueue.h
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ImageFrameCache.cpp
Source/WebCore/platform/graphics/ImageFrameCache.h