Title: [171191] trunk/Source/WebKit2
Revision
171191
Author
[email protected]
Date
2014-07-17 12:19:37 -0700 (Thu, 17 Jul 2014)

Log Message

Sometimes purgeable (or empty!) tiles are shown on screen when resuming the app
https://bugs.webkit.org/show_bug.cgi?id=135018
<rdar://problem/17615038>

Reviewed by Simon Fraser.

* UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::hideContentUntilNextUpdate):
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilNextUpdate):
* UIProcess/mac/RemoteLayerTreeHost.h:
* UIProcess/mac/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::detachRootLayer):
Add a mechanism to "hide" drawing area content until the next commit,
by detaching the root layer. RemoteLayerTreeHost will automatically reattach
it at the next commit.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::viewStateDidChange):
* UIProcess/WebPageProxy.h:
Add a parameter to viewStateDidChange specifying whether dispatching the change
to the Web process is deferrable or not. We will also automatically use "Immediate" if
the view is coming in-window, like we did before.

* UIProcess/ios/WKContentView.mm:
(-[WKContentView _applicationWillEnterForeground:]):
Make use of the aforementioned new mechanisms to ensure that we immediately dispatch
view state changes when coming into the foreground, and will have removed the root layer
if a commit didn't come in while waitForDidUpdateViewState blocks.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (171190 => 171191)


--- trunk/Source/WebKit2/ChangeLog	2014-07-17 18:17:43 UTC (rev 171190)
+++ trunk/Source/WebKit2/ChangeLog	2014-07-17 19:19:37 UTC (rev 171191)
@@ -1,3 +1,36 @@
+2014-07-17  Tim Horton  <[email protected]>
+
+        Sometimes purgeable (or empty!) tiles are shown on screen when resuming the app
+        https://bugs.webkit.org/show_bug.cgi?id=135018
+        <rdar://problem/17615038>
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/DrawingAreaProxy.h:
+        (WebKit::DrawingAreaProxy::hideContentUntilNextUpdate):
+        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
+        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilNextUpdate):
+        * UIProcess/mac/RemoteLayerTreeHost.h:
+        * UIProcess/mac/RemoteLayerTreeHost.mm:
+        (WebKit::RemoteLayerTreeHost::detachRootLayer):
+        Add a mechanism to "hide" drawing area content until the next commit,
+        by detaching the root layer. RemoteLayerTreeHost will automatically reattach
+        it at the next commit.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::viewStateDidChange):
+        * UIProcess/WebPageProxy.h:
+        Add a parameter to viewStateDidChange specifying whether dispatching the change
+        to the Web process is deferrable or not. We will also automatically use "Immediate" if
+        the view is coming in-window, like we did before.
+
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView _applicationWillEnterForeground:]):
+        Make use of the aforementioned new mechanisms to ensure that we immediately dispatch
+        view state changes when coming into the foreground, and will have removed the root layer
+        if a commit didn't come in while waitForDidUpdateViewState blocks.
+        
 2014-07-17  Sanghyup Lee  <[email protected]>
 
         [EFL][WK2] Add a "focus,notfound" signal.

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h (171190 => 171191)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h	2014-07-17 18:17:43 UTC (rev 171190)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h	2014-07-17 19:19:37 UTC (rev 171191)
@@ -88,6 +88,8 @@
     
     virtual void dispatchAfterEnsuringDrawing(std::function<void (CallbackBase::Error)>) { ASSERT_NOT_REACHED(); }
 
+    virtual void hideContentUntilNextUpdate() { ASSERT_NOT_REACHED(); }
+
 protected:
     explicit DrawingAreaProxy(DrawingAreaType, WebPageProxy*);
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (171190 => 171191)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-07-17 18:17:43 UTC (rev 171190)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-07-17 19:19:37 UTC (rev 171191)
@@ -1130,13 +1130,14 @@
         m_viewState |= ViewState::IsVisuallyIdle;
 }
 
-void WebPageProxy::viewStateDidChange(ViewState::Flags mayHaveChanged, bool wantsReply)
+void WebPageProxy::viewStateDidChange(ViewState::Flags mayHaveChanged, bool wantsReply, ViewStateChangeDispatchMode dispatchMode)
 {
     m_potentiallyChangedViewStateFlags |= mayHaveChanged;
     m_viewStateChangeWantsReply = m_viewStateChangeWantsReply || wantsReply;
 
 #if PLATFORM(COCOA)
-    if (!isInWindow() && (mayHaveChanged & ViewState::IsInWindow) && m_pageClient.isViewInWindow()) {
+    bool isNewlyInWindow = !isInWindow() && (mayHaveChanged & ViewState::IsInWindow) && m_pageClient.isViewInWindow();
+    if (dispatchMode == ViewStateChangeDispatchMode::Immediate || isNewlyInWindow) {
         dispatchViewStateChange();
         return;
     }

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (171190 => 171191)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-07-17 18:17:43 UTC (rev 171190)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-07-17 19:19:37 UTC (rev 171191)
@@ -360,7 +360,8 @@
     void setDelegatesScrolling(bool delegatesScrolling) { m_delegatesScrolling = delegatesScrolling; }
     bool delegatesScrolling() const { return m_delegatesScrolling; }
 
-    void viewStateDidChange(WebCore::ViewState::Flags mayHaveChanged, bool wantsReply = false);
+    enum class ViewStateChangeDispatchMode { Deferrable, Immediate };
+    void viewStateDidChange(WebCore::ViewState::Flags mayHaveChanged, bool wantsReply = false, ViewStateChangeDispatchMode = ViewStateChangeDispatchMode::Deferrable);
     bool isInWindow() const { return m_viewState & WebCore::ViewState::IsInWindow; }
     void waitForDidUpdateViewState();
     void didUpdateViewState() { m_waitingForDidUpdateViewState = false; }

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (171190 => 171191)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm	2014-07-17 18:17:43 UTC (rev 171190)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm	2014-07-17 19:19:37 UTC (rev 171191)
@@ -511,7 +511,8 @@
 - (void)_applicationWillEnterForeground:(NSNotification*)notification
 {
     _page->applicationWillEnterForeground();
-    _page->viewStateDidChange(ViewState::AllFlags & ~ViewState::IsInWindow, true);
+    _page->drawingArea()->hideContentUntilNextUpdate();
+    _page->viewStateDidChange(ViewState::AllFlags & ~ViewState::IsInWindow, true, WebPageProxy::ViewStateChangeDispatchMode::Immediate);
 }
 
 - (void)_applicationDidBecomeActive:(NSNotification*)notification

Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h (171190 => 171191)


--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h	2014-07-17 18:17:43 UTC (rev 171190)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h	2014-07-17 19:19:37 UTC (rev 171191)
@@ -75,6 +75,7 @@
     void initializeDebugIndicator();
 
     virtual void waitForDidUpdateViewState() override;
+    virtual void hideContentUntilNextUpdate() override;
     
     WebCore::FloatPoint indicatorLocation() const;
 

Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm (171190 => 171191)


--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm	2014-07-17 18:17:43 UTC (rev 171190)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm	2014-07-17 19:19:37 UTC (rev 171191)
@@ -398,4 +398,9 @@
     m_webPageProxy->process().send(Messages::DrawingArea::AddTransactionCallbackID(m_callbacks.put(WTF::move(callbackFunction), nullptr)), m_webPageProxy->pageID());
 }
 
+void RemoteLayerTreeDrawingAreaProxy::hideContentUntilNextUpdate()
+{
+    m_remoteLayerTreeHost.detachRootLayer();
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.h (171190 => 171191)


--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.h	2014-07-17 18:17:43 UTC (rev 171190)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.h	2014-07-17 19:19:37 UTC (rev 171191)
@@ -63,6 +63,9 @@
 
     void clearLayers();
 
+    // Detach the root layer; it will be reattached upon the next incoming commit.
+    void detachRootLayer();
+
 private:
     LayerOrView *createLayer(const RemoteLayerTreeTransaction::LayerCreationProperties&, const RemoteLayerTreeTransaction::LayerProperties*);
     static void setLayerID(CALayer *, WebCore::GraphicsLayer::PlatformLayerID);

Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm (171190 => 171191)


--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm	2014-07-17 18:17:43 UTC (rev 171190)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm	2014-07-17 19:19:37 UTC (rev 171191)
@@ -220,4 +220,14 @@
 }
 #endif
 
+void RemoteLayerTreeHost::detachRootLayer()
+{
+#if PLATFORM(IOS)
+    [m_rootLayer removeFromSuperview];
+#else
+    [asLayer(m_rootLayer) removeFromSuperlayer];
+#endif
+    m_rootLayer = nullptr;
+}
+
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to