Title: [236257] trunk/Source/WebKit
Revision
236257
Author
an...@apple.com
Date
2018-09-20 04:49:55 -0700 (Thu, 20 Sep 2018)

Log Message

REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on Mac
https://bugs.webkit.org/show_bug.cgi?id=189663
<rdar://problem/44184955>

Reviewed by Geoff Garen and Chris Dumez.

We need to keep the layer tree of the previous page alive and visible until we have something
to render on the new page. With PSON on Mac this means that we should keep displaying the
layer tree from the previus process.

This patch moves the management of 'attaching' the drawing area (Mac only concept) from web process
to UI process. This is when we parent the layer tree to the view root layer. It also ensures that
the layer tree is not deleted too early on process swap and that it still eventually gets deleted.

* UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::attachInWebProcess):
* UIProcess/SuspendedPageProxy.cpp:
(WebKit::messageNamesToIgnoreWhileSuspended):
(WebKit::SuspendedPageProxy::tearDownDrawingAreaInWebProcess):

We no longer tear down drawing area (layer tree) for suspended pages automatically. Send an explicit
message for it.

* UIProcess/SuspendedPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCompletePageTransition):

Attach the drawing area if appropriate.

(WebKit::WebPageProxy::resetStateAfterProcessExited):

Call PageClien::processWillSwap instead of processDidExit when appropriate.

(WebKit::WebPageProxy::enterAcceleratedCompositingMode):

This is called when we have switched to the new layer tree.
Tear down the drawing area in the previus process.

* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::processWillSwap):

On iOS this just call processDidExit for now.

* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::processWillSwap):
(WebKit::PageClientImpl::processDidExit):

Add processWillSwap separately from processDidExit. They are currently the same
except processWillSwap doesn't clear the root layer.

* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::attachInWebProcess):

Send a message to the web process to attach the drawing area.

* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::attach):
(WebKit::DrawingArea::attachDrawingArea): Deleted.

Rename to be less redundant.

* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::reinitializeWebPage):

Don't attach drawing area automatically. It will be done by a message from UI process.

(WebKit::WebPage::setLayerTreeStateIsFrozen):

Layer tree is always frozen in a suspended process (if it exists).

(WebKit::WebPage::didReceivePolicyDecision):

Suspend immediately when receiving policy decision to avoid flash on 'about:blank' loading.

(WebKit::WebPage::didStartPageTransition):
(WebKit::WebPage::didCompletePageTransition):

Notify UI process of transition completion.

(WebKit::WebPage::setIsSuspended):
(WebKit::WebPage::tearDownDrawingAreaForSuspend):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):

Don't attach drawing area automatically. It will be done by a message from UI process.

(WebKit::TiledCoreAnimationDrawingArea::attach):
(WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (236256 => 236257)


--- trunk/Source/WebKit/ChangeLog	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/ChangeLog	2018-09-20 11:49:55 UTC (rev 236257)
@@ -1,3 +1,103 @@
+2018-09-20  Antti Koivisto  <an...@apple.com>
+
+        REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=189663
+        <rdar://problem/44184955>
+
+        Reviewed by Geoff Garen and Chris Dumez.
+
+        We need to keep the layer tree of the previous page alive and visible until we have something
+        to render on the new page. With PSON on Mac this means that we should keep displaying the
+        layer tree from the previus process.
+
+        This patch moves the management of 'attaching' the drawing area (Mac only concept) from web process
+        to UI process. This is when we parent the layer tree to the view root layer. It also ensures that
+        the layer tree is not deleted too early on process swap and that it still eventually gets deleted.
+
+        * UIProcess/DrawingAreaProxy.h:
+        (WebKit::DrawingAreaProxy::attachInWebProcess):
+        * UIProcess/SuspendedPageProxy.cpp:
+        (WebKit::messageNamesToIgnoreWhileSuspended):
+        (WebKit::SuspendedPageProxy::tearDownDrawingAreaInWebProcess):
+
+        We no longer tear down drawing area (layer tree) for suspended pages automatically. Send an explicit
+        message for it.
+
+        * UIProcess/SuspendedPageProxy.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didCompletePageTransition):
+
+        Attach the drawing area if appropriate.
+
+        (WebKit::WebPageProxy::resetStateAfterProcessExited):
+
+        Call PageClien::processWillSwap instead of processDidExit when appropriate.
+
+        (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
+
+        This is called when we have switched to the new layer tree.
+        Tear down the drawing area in the previus process.
+
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::processWillSwap):
+
+        On iOS this just call processDidExit for now.
+
+        * UIProcess/mac/PageClientImplMac.h:
+        * UIProcess/mac/PageClientImplMac.mm:
+        (WebKit::PageClientImpl::processWillSwap):
+        (WebKit::PageClientImpl::processDidExit):
+
+        Add processWillSwap separately from processDidExit. They are currently the same
+        except processWillSwap doesn't clear the root layer.
+
+        * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
+        * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
+        (WebKit::TiledCoreAnimationDrawingAreaProxy::attachInWebProcess):
+
+        Send a message to the web process to attach the drawing area.
+
+        * WebProcess/WebPage/DrawingArea.h:
+        (WebKit::DrawingArea::attach):
+        (WebKit::DrawingArea::attachDrawingArea): Deleted.
+
+        Rename to be less redundant.
+
+        * WebProcess/WebPage/DrawingArea.messages.in:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::reinitializeWebPage):
+
+        Don't attach drawing area automatically. It will be done by a message from UI process.
+
+        (WebKit::WebPage::setLayerTreeStateIsFrozen):
+
+        Layer tree is always frozen in a suspended process (if it exists).
+
+        (WebKit::WebPage::didReceivePolicyDecision):
+
+        Suspend immediately when receiving policy decision to avoid flash on 'about:blank' loading.
+
+        (WebKit::WebPage::didStartPageTransition):
+        (WebKit::WebPage::didCompletePageTransition):
+
+        Notify UI process of transition completion.
+
+        (WebKit::WebPage::setIsSuspended):
+        (WebKit::WebPage::tearDownDrawingAreaForSuspend):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
+
+        Don't attach drawing area automatically. It will be done by a message from UI process.
+
+        (WebKit::TiledCoreAnimationDrawingArea::attach):
+        (WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Deleted.
+
 2018-09-20  Tomas Popela  <tpop...@redhat.com>
 
         [GTK] Always prints in portrait when landscape is requested

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (236256 => 236257)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2018-09-20 11:49:55 UTC (rev 236257)
@@ -1460,9 +1460,6 @@
 
     notifyInputContextAboutDiscardedComposition();
 
-    if (m_layerHostingView)
-        setAcceleratedCompositingRootLayer(nil);
-
     updateRemoteAccessibilityRegistration(false);
     flushPendingMouseEventCallbacks();
 

Modified: trunk/Source/WebKit/UIProcess/DrawingAreaProxy.h (236256 => 236257)


--- trunk/Source/WebKit/UIProcess/DrawingAreaProxy.h	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/UIProcess/DrawingAreaProxy.h	2018-09-20 11:49:55 UTC (rev 236257)
@@ -82,6 +82,8 @@
     void viewExposedRectChangedTimerFired();
 #endif
 
+    virtual void attachInWebProcess() { }
+
     virtual void updateDebugIndicator() { }
 
     virtual void waitForDidUpdateActivityState(ActivityStateChangeID) { }

Modified: trunk/Source/WebKit/UIProcess/PageClient.h (236256 => 236257)


--- trunk/Source/WebKit/UIProcess/PageClient.h	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/UIProcess/PageClient.h	2018-09-20 11:49:55 UTC (rev 236257)
@@ -184,6 +184,7 @@
     virtual LayerHostingMode viewLayerHostingMode() { return LayerHostingMode::InProcess; }
 
     virtual void processDidExit() = 0;
+    virtual void processWillSwap() { processDidExit(); }
     virtual void didRelaunchProcess() = 0;
     virtual void pageClosed() = 0;
 

Modified: trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp (236256 => 236257)


--- trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp	2018-09-20 11:49:55 UTC (rev 236257)
@@ -54,6 +54,7 @@
         messageNames.get().add("DidDestroyNavigation");
         messageNames.get().add("DidFinishDocumentLoadForFrame");
         messageNames.get().add("DidFinishProgress");
+        messageNames.get().add("DidCompletePageTransition");
         messageNames.get().add("DidFirstLayoutForFrame");
         messageNames.get().add("DidFirstVisuallyNonEmptyLayoutForFrame");
         messageNames.get().add("DidNavigateWithNavigationData");
@@ -109,6 +110,11 @@
     m_page.suspendedPageClosed(*this);
 }
 
+void SuspendedPageProxy::tearDownDrawingAreaInWebProcess()
+{
+    m_process->send(Messages::WebPage::TearDownDrawingAreaForSuspend(), m_page.pageID());
+}
+
 void SuspendedPageProxy::didFinishLoad()
 {
     ASSERT(m_process);

Modified: trunk/Source/WebKit/UIProcess/SuspendedPageProxy.h (236256 => 236257)


--- trunk/Source/WebKit/UIProcess/SuspendedPageProxy.h	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/UIProcess/SuspendedPageProxy.h	2018-09-20 11:49:55 UTC (rev 236257)
@@ -49,6 +49,7 @@
 
     void webProcessDidClose(WebProcessProxy&);
     void destroyWebPageInWebProcess();
+    void tearDownDrawingAreaInWebProcess();
 
 #if !LOG_DISABLED
     const char* loggingString() const;

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (236256 => 236257)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-09-20 11:49:55 UTC (rev 236257)
@@ -56,8 +56,8 @@
 #include "AuthenticationDecisionListener.h"
 #include "DataReference.h"
 #include "DownloadProxy.h"
+#include "DrawingAreaMessages.h"
 #include "DrawingAreaProxy.h"
-#include "DrawingAreaProxyMessages.h"
 #include "EventDispatcherMessages.h"
 #include "FrameInfoData.h"
 #include "LoadParameters.h"
@@ -3430,6 +3430,24 @@
     m_pageLoadState.commitChanges();
 }
 
+void WebPageProxy::didCompletePageTransition(bool isInitialEmptyDocument)
+{
+    // Attach drawing area for the initial empty document only if this is not a process swap.
+    if (isInitialEmptyDocument && m_suspendedPage)
+        return;
+
+#if PLATFORM(MAC)
+    if (!m_drawingArea)
+        return;
+
+    // Drawing area for the suspended page will be torn down when the attach completes.
+    m_drawingArea->attachInWebProcess();
+#else
+    if (m_suspendedPage)
+        m_suspendedPage->tearDownDrawingAreaInWebProcess();
+#endif
+}
+
 void WebPageProxy::setNetworkRequestsInProgress(bool networkRequestsInProgress)
 {
     auto transaction = m_pageLoadState.transaction();
@@ -6137,7 +6155,11 @@
 
     m_editorState = EditorState();
 
-    pageClient().processDidExit();
+    if (terminationReason == ProcessTerminationReason::NavigationSwap)
+        pageClient().processWillSwap();
+    else
+        pageClient().processDidExit();
+
     pageClient().clearAllEditCommands();
 
     auto resetStateReason = terminationReason == ProcessTerminationReason::NavigationSwap ? ResetStateReason::NavigationSwap : ResetStateReason::WebProcessExited;
@@ -6278,6 +6300,10 @@
 void WebPageProxy::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
 {
     pageClient().enterAcceleratedCompositingMode(layerTreeContext);
+
+    // We have completed the page transition and can tear down the layers in the suspended process.
+    if (m_suspendedPage)
+        m_suspendedPage->tearDownDrawingAreaInWebProcess();
 }
 
 void WebPageProxy::exitAcceleratedCompositingMode()

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (236256 => 236257)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2018-09-20 11:49:55 UTC (rev 236257)
@@ -1427,6 +1427,7 @@
     void didStartProgress();
     void didChangeProgress(double);
     void didFinishProgress();
+    void didCompletePageTransition(bool isInitialEmptyDocument);
     void setNetworkRequestsInProgress(bool);
 
     void hasInsecureContent(WebCore::HasInsecureContent&);

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (236256 => 236257)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2018-09-20 11:49:55 UTC (rev 236257)
@@ -117,6 +117,8 @@
     DidFinishProgress()
     DidStartProgress()
 
+    DidCompletePageTransition(bool isInitialEmptyDocument)
+
     SetNetworkRequestsInProgress(bool networkRequestsInProgress)
 
     # Frame lifetime messages

Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (236256 => 236257)


--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h	2018-09-20 11:49:55 UTC (rev 236257)
@@ -65,6 +65,7 @@
     bool isViewVisibleOrOccluded() override;
     bool isVisuallyIdle() override;
     void processDidExit() override;
+    void processWillSwap() override;
     void didRelaunchProcess() override;
     void pageClosed() override;
     void preferencesDidChange() override;

Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (236256 => 236257)


--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2018-09-20 11:49:55 UTC (rev 236257)
@@ -209,6 +209,12 @@
     [m_webView _processDidExit];
 }
 
+void PageClientImpl::processWillSwap()
+{
+    // FIXME: It didn't really exit.
+    processDidExit();
+}
+
 void PageClientImpl::didRelaunchProcess()
 {
     [m_contentView _didRelaunchProcess];

Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h (236256 => 236257)


--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h	2018-09-20 11:49:55 UTC (rev 236257)
@@ -79,6 +79,7 @@
     LayerOrView *acceleratedCompositingRootLayer() const override;
 
     void processDidExit() override;
+    void processWillSwap() override;
     void pageClosed() override;
     void didRelaunchProcess() override;
     void preferencesDidChange() override;

Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm (236256 => 236257)


--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2018-09-20 11:49:55 UTC (rev 236257)
@@ -253,9 +253,16 @@
     return m_impl->colorSpace();
 }
 
+void PageClientImpl::processWillSwap()
+{
+    // FIXME: It didn't really exit.
+    m_impl->processDidExit();
+}
+
 void PageClientImpl::processDidExit()
 {
     m_impl->processDidExit();
+    m_impl->setAcceleratedCompositingRootLayer(nil);
 }
 
 void PageClientImpl::pageClosed()

Modified: trunk/Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h (236256 => 236257)


--- trunk/Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h	2018-09-20 11:49:55 UTC (rev 236257)
@@ -38,6 +38,8 @@
 
 private:
     // DrawingAreaProxy
+    void attachInWebProcess() override;
+
     void deviceScaleFactorDidChange() override;
     void sizeDidChange() override;
     void colorSpaceDidChange() override;

Modified: trunk/Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm (236256 => 236257)


--- trunk/Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm	2018-09-20 11:49:55 UTC (rev 236257)
@@ -53,6 +53,11 @@
     m_callbacks.invalidate(CallbackBase::Error::OwnerWasInvalidated);
 }
 
+void TiledCoreAnimationDrawingAreaProxy::attachInWebProcess()
+{
+    m_webPageProxy.process().send(Messages::DrawingArea::Attach(), m_webPageProxy.pageID());
+}
+
 void TiledCoreAnimationDrawingAreaProxy::deviceScaleFactorDidChange()
 {
     m_webPageProxy.process().send(Messages::DrawingArea::SetDeviceScaleFactor(m_webPageProxy.deviceScaleFactor()), m_webPageProxy.pageID());

Modified: trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.h (236256 => 236257)


--- trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.h	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.h	2018-09-20 11:49:55 UTC (rev 236257)
@@ -151,7 +151,7 @@
     void displayWasRefreshed();
 #endif
 
-    virtual void attachDrawingArea() { };
+    virtual void attach() { };
 
 protected:
     DrawingArea(DrawingAreaType, WebPage&);

Modified: trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.messages.in (236256 => 236257)


--- trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.messages.in	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.messages.in	2018-09-20 11:49:55 UTC (rev 236257)
@@ -45,7 +45,11 @@
     DestroyNativeSurfaceHandleForCompositing() -> (bool handled)
 #endif
 
-#if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+#if PLATFORM(MAC)
+    Attach()
+
+#if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
     DisplayWasRefreshed()
 #endif
+#endif
 }

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (236256 => 236257)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-09-20 11:49:55 UTC (rev 236257)
@@ -657,7 +657,6 @@
         m_drawingArea->updatePreferences(parameters.store);
         m_drawingArea->setPaintingEnabled(true);
     }
-    m_drawingArea->attachDrawingArea();
 
     if (m_activityState != parameters.activityState)
         setActivityState(parameters.activityState, ActivityStateChangeAsynchronous, Vector<CallbackID>());
@@ -2215,7 +2214,7 @@
     if (!drawingArea)
         return;
 
-    drawingArea->setLayerTreeStateIsFrozen(frozen);
+    drawingArea->setLayerTreeStateIsFrozen(frozen || m_isSuspended);
 }
 
 void WebPage::callVolatilityCompletionHandlers(bool succeeded)
@@ -2833,6 +2832,10 @@
     WebFrame* frame = WebProcess::singleton().webFrame(frameID);
     if (!frame)
         return;
+    if (policyAction == PolicyAction::Suspend) {
+        ASSERT(frame == m_mainFrame);
+        setIsSuspended(true);
+    }
     frame->didReceivePolicyDecision(listenerID, policyAction, navigationID, downloadID, WTFMove(websitePolicies));
 }
 
@@ -2846,7 +2849,7 @@
 
 void WebPage::didStartPageTransition()
 {
-    m_drawingArea->setLayerTreeStateIsFrozen(true);
+    setLayerTreeStateIsFrozen(true);
 
 #if PLATFORM(MAC)
     bool hasPreviouslyFocusedDueToUserInteraction = m_hasEverFocusedElementDueToUserInteractionSincePageTransition;
@@ -2870,8 +2873,11 @@
 
 void WebPage::didCompletePageTransition()
 {
-    if (m_drawingArea)
-        m_drawingArea->setLayerTreeStateIsFrozen(false);
+    // FIXME: Layer tree freezing should be managed entirely in the UI process side.
+    setLayerTreeStateIsFrozen(false);
+
+    bool isInitialEmptyDocument = !m_mainFrame;
+    send(Messages::WebPageProxy::DidCompletePageTransition(isInitialEmptyDocument));
 }
 
 void WebPage::show()
@@ -6000,10 +6006,17 @@
         return;
 
     m_isSuspended = suspended;
-    if (m_isSuspended)
-        m_drawingArea = nullptr;
+
+    setLayerTreeStateIsFrozen(true);
 }
 
+void WebPage::tearDownDrawingAreaForSuspend()
+{
+    if (!m_isSuspended)
+        return;
+    m_drawingArea = nullptr;
+}
+
 void WebPage::frameBecameRemote(uint64_t frameID, GlobalFrameIdentifier&& remoteFrameIdentifier, GlobalWindowIdentifier&& remoteWindowIdentifier)
 {
     RefPtr<WebFrame> frame = WebProcess::singleton().webFrame(frameID);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (236256 => 236257)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2018-09-20 11:49:55 UTC (rev 236257)
@@ -1414,6 +1414,7 @@
     void urlSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceError&);
 
     void setIsSuspended(bool);
+    void tearDownDrawingAreaForSuspend();
 
     RefPtr<WebImage> snapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
     RefPtr<WebImage> snapshotNode(WebCore::Node&, SnapshotOptions, unsigned maximumPixelCount = std::numeric_limits<unsigned>::max());

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (236256 => 236257)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2018-09-20 11:49:55 UTC (rev 236257)
@@ -506,6 +506,7 @@
     URLSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, WebCore::ResourceError error)
 
     SetIsSuspended(bool suspended)
+    TearDownDrawingAreaForSuspend();
 
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     StorageAccessResponse(bool wasGranted, uint64_t contextId)

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (236256 => 236257)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h	2018-09-20 11:49:55 UTC (rev 236257)
@@ -103,7 +103,7 @@
     void addTransactionCallbackID(CallbackID) override;
     void setShouldScaleViewToFitDocument(bool) override;
 
-    void attachDrawingArea() override;
+    void attach() override;
 
     void adjustTransientZoom(double scale, WebCore::FloatPoint origin) override;
     void commitTransientZoom(double scale, WebCore::FloatPoint origin) override;

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (236256 => 236257)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2018-09-20 11:22:00 UTC (rev 236256)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2018-09-20 11:49:55 UTC (rev 236257)
@@ -91,8 +91,6 @@
 
     updateLayerHostingContext();
     setColorSpace(parameters.colorSpace);
-
-    attachDrawingArea();
 }
 
 TiledCoreAnimationDrawingArea::~TiledCoreAnimationDrawingArea()
@@ -101,7 +99,7 @@
 }
 
 
-void TiledCoreAnimationDrawingArea::attachDrawingArea()
+void TiledCoreAnimationDrawingArea::attach()
 {
     LayerTreeContext layerTreeContext;
     layerTreeContext.contextID = m_layerHostingContext->contextID();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to