Title: [217475] trunk/Source/WebKit2
Revision
217475
Author
[email protected]
Date
2017-05-25 21:41:22 -0700 (Thu, 25 May 2017)

Log Message

[iOS] Disbale async image decoding when synchronously painting a newly parented WebView
https://bugs.webkit.org/show_bug.cgi?id=172626

Patch by Said Abou-Hallawa <[email protected]> on 2017-05-25
Reviewed by Simon Fraser.

Large images have to be synchronously decoded when bringing a WebView to
the foreground because the whole page will be painted when we unblock the
UI process.

* Shared/mac/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::drawInContext): Get nextFlushIsForImmediatePaint
from RemoteLayerTreeContext and pass the correct GraphicsLayerPaintFlags
to drawLayerContents().
* WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
(WebKit::RemoteLayerTreeContext::setNextFlushIsForImmediatePaint):
(WebKit::RemoteLayerTreeContext::nextFlushIsForImmediatePaint):
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::flushLayers): Pass
m_nextFlushIsForImmediatePaint to RemoteLayerTreeContext and then reset it.
(WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange):
Set m_nextFlushIsForImmediatePaint to true to say that in the next flush,
large images have to be synchronously decoded.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (217474 => 217475)


--- trunk/Source/WebKit2/ChangeLog	2017-05-26 04:24:10 UTC (rev 217474)
+++ trunk/Source/WebKit2/ChangeLog	2017-05-26 04:41:22 UTC (rev 217475)
@@ -1,3 +1,29 @@
+2017-05-25  Said Abou-Hallawa  <[email protected]>
+
+        [iOS] Disbale async image decoding when synchronously painting a newly parented WebView
+        https://bugs.webkit.org/show_bug.cgi?id=172626
+
+        Reviewed by Simon Fraser.
+
+        Large images have to be synchronously decoded when bringing a WebView to 
+        the foreground because the whole page will be painted when we unblock the
+        UI process.
+
+        * Shared/mac/RemoteLayerBackingStore.mm:
+        (WebKit::RemoteLayerBackingStore::drawInContext): Get nextFlushIsForImmediatePaint
+        from RemoteLayerTreeContext and pass the correct GraphicsLayerPaintFlags
+        to drawLayerContents().
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
+        (WebKit::RemoteLayerTreeContext::setNextFlushIsForImmediatePaint):
+        (WebKit::RemoteLayerTreeContext::nextFlushIsForImmediatePaint):
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::flushLayers): Pass
+        m_nextFlushIsForImmediatePaint to RemoteLayerTreeContext and then reset it.
+        (WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange):
+        Set m_nextFlushIsForImmediatePaint to true to say that in the next flush,
+        large images have to be synchronously decoded.
+
 2017-05-25  Joseph Pecoraro  <[email protected]>
 
         _WKUserStyleSheet and WKUserScript leak string data

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (217474 => 217475)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm	2017-05-26 04:24:10 UTC (rev 217474)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm	2017-05-26 04:41:22 UTC (rev 217475)
@@ -335,22 +335,24 @@
 #endif
 
     context.scale(m_scale);
-
+    
+    auto flags = m_layer->context() && m_layer->context()->nextFlushIsForImmediatePaint() ? WebCore::GraphicsLayerPaintFlags::Snapshotting : WebCore::GraphicsLayerPaintFlags::None;
+    
     // FIXME: This should be moved to PlatformCALayerRemote for better layering.
     switch (m_layer->layerType()) {
     case PlatformCALayer::LayerTypeSimpleLayer:
     case PlatformCALayer::LayerTypeTiledBackingTileLayer:
-        m_layer->owner()->platformCALayerPaintContents(m_layer, context, dirtyBounds, GraphicsLayerPaintFlags::None);
+        m_layer->owner()->platformCALayerPaintContents(m_layer, context, dirtyBounds, flags);
         break;
     case PlatformCALayer::LayerTypeWebLayer:
     case PlatformCALayer::LayerTypeBackdropLayer:
-        PlatformCALayer::drawLayerContents(cgContext, m_layer, m_paintingRects, GraphicsLayerPaintFlags::None);
+        PlatformCALayer::drawLayerContents(cgContext, m_layer, m_paintingRects, flags);
         break;
     case PlatformCALayer::LayerTypeDarkSystemBackdropLayer:
     case PlatformCALayer::LayerTypeLightSystemBackdropLayer:
         // FIXME: These have a more complicated layer hierarchy. We need to paint into
         // a child layer in order to see the rendered results.
-        PlatformCALayer::drawLayerContents(cgContext, m_layer, m_paintingRects, GraphicsLayerPaintFlags::None);
+        PlatformCALayer::drawLayerContents(cgContext, m_layer, m_paintingRects, flags);
         break;
     case PlatformCALayer::LayerTypeLayer:
     case PlatformCALayer::LayerTypeTransformLayer:

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h (217474 => 217475)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h	2017-05-26 04:24:10 UTC (rev 217474)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h	2017-05-26 04:41:22 UTC (rev 217475)
@@ -69,6 +69,9 @@
     void willStartAnimationOnLayer(PlatformCALayerRemote&);
 
     RemoteLayerBackingStoreCollection& backingStoreCollection() { return m_backingStoreCollection; }
+    
+    void setNextFlushIsForImmediatePaint(bool nextFlushIsForImmediatePaint) { m_nextFlushIsForImmediatePaint = nextFlushIsForImmediatePaint; }
+    bool nextFlushIsForImmediatePaint() const { return m_nextFlushIsForImmediatePaint; }
 
 private:
     // WebCore::GraphicsLayerFactory
@@ -87,6 +90,8 @@
     RemoteLayerTreeTransaction* m_currentTransaction;
 
     WebCore::LayerPool m_layerPool;
+    
+    bool m_nextFlushIsForImmediatePaint { false };
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h (217474 => 217475)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h	2017-05-26 04:24:10 UTC (rev 217474)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h	2017-05-26 04:41:22 UTC (rev 217475)
@@ -153,6 +153,7 @@
 
     bool m_waitingForBackingStoreSwap;
     bool m_hadFlushDeferredWhileWaitingForBackingStoreSwap;
+    bool m_nextFlushIsForImmediatePaint { false };
 
     dispatch_queue_t m_commitQueue;
     RefPtr<BackingStoreFlusher> m_pendingBackingStoreFlusher;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm (217474 => 217475)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm	2017-05-26 04:24:10 UTC (rev 217474)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm	2017-05-26 04:41:22 UTC (rev 217475)
@@ -379,7 +379,9 @@
     RemoteLayerTreeTransaction layerTransaction;
     layerTransaction.setTransactionID(takeNextTransactionID());
     layerTransaction.setCallbackIDs(WTFMove(m_pendingCallbackIDs));
+    m_remoteLayerTreeContext->setNextFlushIsForImmediatePaint(m_nextFlushIsForImmediatePaint);
     m_remoteLayerTreeContext->buildTransaction(layerTransaction, *downcast<GraphicsLayerCARemote>(*m_rootLayer).platformCALayer());
+    m_remoteLayerTreeContext->setNextFlushIsForImmediatePaint(false);
     backingStoreCollection.willCommitLayerTree(layerTransaction);
     m_webPage.willCommitLayerTree(layerTransaction);
 
@@ -392,6 +394,7 @@
         downcast<RemoteScrollingCoordinator>(*m_webPage.scrollingCoordinator()).buildTransaction(scrollingTransaction);
 #endif
 
+    m_nextFlushIsForImmediatePaint = false;
     m_waitingForBackingStoreSwap = true;
 
     m_webPage.send(Messages::RemoteLayerTreeDrawingAreaProxy::WillCommitLayerTree(layerTransaction.transactionID()));
@@ -499,8 +502,10 @@
 {
     // FIXME: Should we suspend painting while not visible, like TiledCoreAnimationDrawingArea? Probably.
 
-    if (wantsDidUpdateActivityState)
+    if (wantsDidUpdateActivityState) {
+        m_nextFlushIsForImmediatePaint = true;
         scheduleCompositingLayerFlushImmediately();
+    }
 }
 
 void RemoteLayerTreeDrawingArea::addTransactionCallbackID(uint64_t callbackID)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to