Changeset 232802 in webkit
- Timestamp:
- Jun 13, 2018, 12:10:16 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r232797 r232802 1 2018-06-13 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 TileFirstPaint strategy for async image decoding should be disabled for non root RenderLayers 4 https://bugs.webkit.org/show_bug.cgi?id=186336 5 <rdar://problem/40808099> 6 7 Reviewed by Simon Fraser. 8 9 * fast/images/async-image-composited-show-expected.html: Added. 10 * fast/images/async-image-composited-show.html: Added. 11 1 12 2018-06-13 Carlos Alberto Lopez Perez <clopez@igalia.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r232799 r232802 1 2018-06-13 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 TileFirstPaint strategy for async image decoding should be disabled for non root RenderLayers 4 https://bugs.webkit.org/show_bug.cgi?id=186336 5 <rdar://problem/40808099> 6 7 Reviewed by Simon Fraser. 8 9 When showing a composited RenderLayer for the first time, the images in 10 this layer have to be decoded synchronously to avoid unwanted flashing. 11 12 To create a layout test for this patch, FrameDecodingDurationForTesting 13 needs to be generalized for large and animated images. The decoding thread 14 now forces the decoding time to be at least equal to 15 FrameDecodingDurationForTesting. 16 17 Test: fast/images/async-image-composited-show.html 18 19 * platform/graphics/BitmapImage.cpp: 20 (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages const): 21 (WebCore::BitmapImage::internalStartAnimation): 22 (WebCore::BitmapImage::advanceAnimation): 23 * platform/graphics/BitmapImage.h: 24 * platform/graphics/ImageSource.cpp: 25 (WebCore::ImageSource::startAsyncDecodingQueue): 26 * platform/graphics/ImageSource.h: 27 (WebCore::ImageSource::setFrameDecodingDurationForTesting): 28 (WebCore::ImageSource::frameDecodingDurationForTesting const): 29 * rendering/RenderLayer.cpp: 30 (WebCore::RenderLayer::paintLayerContents): 31 1 32 2018-06-13 Wenson Hsieh <wenson_hsieh@apple.com> 2 33 -
trunk/Source/WebCore/platform/graphics/BitmapImage.cpp
r229209 r232802 341 341 bool BitmapImage::shouldUseAsyncDecodingForAnimatedImages() const 342 342 { 343 return canAnimate() && m_allowAnimatedImageAsyncDecoding && (shouldUseAsyncDecodingFor AnimatedImagesForTesting() || m_source->canUseAsyncDecoding());343 return canAnimate() && m_allowAnimatedImageAsyncDecoding && (shouldUseAsyncDecodingForTesting() || m_source->canUseAsyncDecoding()); 344 344 } 345 345 … … 450 450 } 451 451 452 m_desiredFrameDecodeTimeForTesting = time + std::max(m_frameDecodingDurationForTesting, 0_s);453 452 if (m_clearDecoderAfterAsyncFrameRequestForTesting) 454 453 m_source->resetData(data()); … … 463 462 { 464 463 clearTimer(); 465 466 // Pretend as if decoding nextFrame has taken m_frameDecodingDurationForTesting from467 // the time this decoding was requested.468 if (shouldUseAsyncDecodingForAnimatedImagesForTesting()) {469 MonotonicTime time = MonotonicTime::now();470 // Start a timer with the remaining time from now till the m_desiredFrameDecodeTime.471 if (m_desiredFrameDecodeTimeForTesting > std::max(time, m_desiredFrameStartTime)) {472 startTimer(m_desiredFrameDecodeTimeForTesting - time);473 return;474 }475 }476 464 477 465 // Don't advance to nextFrame unless its decoding has finished or was not required. -
trunk/Source/WebCore/platform/graphics/BitmapImage.h
r230334 r232802 103 103 bool canAnimate() const; 104 104 105 bool shouldUseAsyncDecodingFor AnimatedImagesForTesting() const { return m_frameDecodingDurationForTesting> 0_s; }106 void setFrameDecodingDurationForTesting(Seconds duration) { m_ frameDecodingDurationForTesting = duration; }105 bool shouldUseAsyncDecodingForTesting() const { return m_source->frameDecodingDurationForTesting() > 0_s; } 106 void setFrameDecodingDurationForTesting(Seconds duration) { m_source->setFrameDecodingDurationForTesting(duration); } 107 107 bool canUseAsyncDecodingForLargeImages() const; 108 108 bool shouldUseAsyncDecodingForAnimatedImages() const; … … 217 217 218 218 std::unique_ptr<Vector<Function<void()>, 1>> m_decodingCallbacks; 219 Seconds m_frameDecodingDurationForTesting;220 MonotonicTime m_desiredFrameDecodeTimeForTesting;221 219 222 220 bool m_animationFinished { false }; -
trunk/Source/WebCore/platform/graphics/ImageSource.cpp
r230334 r232802 326 326 decodingQueue().dispatch([protectedThis = makeRef(*this), protectedDecodingQueue = makeRef(decodingQueue()), protectedFrameRequestQueue = makeRef(frameRequestQueue()), protectedDecoder = makeRef(*m_decoder), sourceURL = sourceURL().string().isolatedCopy()] { 327 327 ImageFrameRequest frameRequest; 328 Seconds minDecodingDuration = protectedThis->frameDecodingDurationForTesting(); 328 329 329 330 while (protectedFrameRequestQueue->dequeue(frameRequest)) { 330 331 TraceScope tracingScope(AsyncImageDecodeStart, AsyncImageDecodeEnd); 332 333 MonotonicTime startingTime; 334 if (minDecodingDuration > 0_s) 335 startingTime = MonotonicTime::now(); 331 336 332 337 // Get the frame NativeImage on the decoding thread. … … 338 343 continue; 339 344 } 345 346 // Pretend as if the decoding takes minDecodingDuration. 347 if (minDecodingDuration > 0_s) 348 sleep(minDecodingDuration - (MonotonicTime::now() - startingTime)); 340 349 341 350 // Update the cached frames on the main thread to avoid updating the MemoryCache from a different thread. -
trunk/Source/WebCore/platform/graphics/ImageSource.h
r230334 r232802 82 82 bool hasAsyncDecodingQueue() const { return m_decodingQueue; } 83 83 bool isAsyncDecodingQueueIdle() const; 84 void setFrameDecodingDurationForTesting(Seconds duration) { m_frameDecodingDurationForTesting = duration; } 85 Seconds frameDecodingDurationForTesting() const { return m_frameDecodingDurationForTesting; } 84 86 85 87 // Image metadata which is calculated either by the ImageDecoder or directly … … 182 184 FrameCommitQueue m_frameCommitQueue; 183 185 RefPtr<WorkQueue> m_decodingQueue; 186 Seconds m_frameDecodingDurationForTesting; 184 187 185 188 // Image metadata. -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r232246 r232802 4351 4351 paintBehavior |= PaintBehaviorSnapshotting; 4352 4352 4353 if ( paintingInfo.paintBehavior & PaintBehaviorTileFirstPaint)4353 if ((paintingInfo.paintBehavior & PaintBehaviorTileFirstPaint) && isRenderViewLayer()) 4354 4354 paintBehavior |= PaintBehaviorTileFirstPaint; 4355 4355
Note:
See TracChangeset
for help on using the changeset viewer.