REGRESSION (PSON): White or Black flash occurs when process swapping on navigation...
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2018 12:06:11 +0000 (12:06 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2018 12:06:11 +0000 (12:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189695
<rdar://problem/44551146>

Reviewed by Simon Fraser.

Freeze the layers on UI process side during process swap.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _processWillChange]):

Shared work of _processWillSwap and _processDidExit.

(-[WKWebView _processWillSwap]):
(-[WKWebView _processDidExit]):

Split into two functions. Don't reset scroll position and similar when doing navigation swap.

* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
(WebKit::RemoteLayerTreeDrawingAreaProxy::detachRemoteLayerTreeHost):

Add to way to detach RemoteLayerTreeHost from the drawing area. Inert RemoteLayerTreeHost will host
the frozen layers.

(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
(WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
(WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilPendingUpdate):
(WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilAnyUpdate):
(WebKit::RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension):
(WebKit::RemoteLayerTreeDrawingAreaProxy::hasVisibleContent const):
(WebKit::RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting const):
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::RemoteLayerTreeHost):
(WebKit::RemoteLayerTreeHost::updateLayerTree):
(WebKit::RemoteLayerTreeHost::animationDidStart):
(WebKit::RemoteLayerTreeHost::animationDidEnd):
(WebKit::RemoteLayerTreeHost::detachFromDrawingArea):

Clear the DrawingArea backpointer.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::resetState):

Detach and save the current RemoteLayerTreeHost on navigation swap.

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

Avoid reseting the scroll position.

* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):

Drop the frozen layers after setting the new root layer.

* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):

For completeness do this also on Mac (where remote layers are currently not used).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236500 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h
Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h
Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit/UIProcess/ios/WKContentView.h
Source/WebKit/UIProcess/ios/WKContentView.mm
Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
Source/WebKit/UIProcess/mac/WebPageProxyMac.mm

index b340e53..621ceed 100644 (file)
@@ -1,3 +1,71 @@
+2018-09-26  Antti Koivisto  <antti@apple.com>
+
+        REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=189695
+        <rdar://problem/44551146>
+
+        Reviewed by Simon Fraser.
+
+        Freeze the layers on UI process side during process swap.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _processWillChange]):
+
+        Shared work of _processWillSwap and _processDidExit.
+
+        (-[WKWebView _processWillSwap]):
+        (-[WKWebView _processDidExit]):
+
+        Split into two functions. Don't reset scroll position and similar when doing navigation swap.
+
+        * UIProcess/API/Cocoa/WKWebViewInternal.h:
+        * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
+        * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::detachRemoteLayerTreeHost):
+
+        Add to way to detach RemoteLayerTreeHost from the drawing area. Inert RemoteLayerTreeHost will host
+        the frozen layers.
+
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilPendingUpdate):
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilAnyUpdate):
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension):
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::hasVisibleContent const):
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting const):
+        * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
+        * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
+        (WebKit::RemoteLayerTreeHost::RemoteLayerTreeHost):
+        (WebKit::RemoteLayerTreeHost::updateLayerTree):
+        (WebKit::RemoteLayerTreeHost::animationDidStart):
+        (WebKit::RemoteLayerTreeHost::animationDidEnd):
+        (WebKit::RemoteLayerTreeHost::detachFromDrawingArea):
+
+        Clear the DrawingArea backpointer.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::continueNavigationInNewProcess):
+        (WebKit::WebPageProxy::resetState):
+
+        Detach and save the current RemoteLayerTreeHost on navigation swap.
+
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::processWillSwap):
+
+        Avoid reseting the scroll position.
+
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
+
+        Drop the frozen layers after setting the new root layer.
+
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
+
+        For completeness do this also on Mac (where remote layers are currently not used).
+
 2018-09-25  Ryosuke Niwa  <rniwa@webkit.org>
 
         Make frame flattening an internal debug feature
index 75315e7..4aa5980 100644 (file)
@@ -1654,15 +1654,11 @@ static WebCore::Color scrollViewBackgroundColor(WKWebView *webView)
     return UIEdgeInsetsZero;
 }
 
-- (void)_processDidExit
+- (void)_processWillSwapOrDidExit
 {
-    RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _processDidExit]", self);
+    // FIXME: Which ones of these need to be done in the process swap case and which ones in the exit case?
     [self _hidePasswordView];
     [self _cancelAnimatedResize];
-    [_contentView setFrame:self.bounds];
-    [_scrollView setBackgroundColor:[UIColor whiteColor]];
-    [_scrollView setContentOffset:[self _initialContentOffsetForScrollView]];
-    [_scrollView setZoomScale:1];
 
     _viewportMetaTagWidth = WebCore::ViewportArguments::ValueAuto;
     _initialScaleFactor = 1;
@@ -1695,6 +1691,25 @@ static WebCore::Color scrollViewBackgroundColor(WKWebView *webView)
     _avoidsUnsafeArea = YES;
 }
 
+- (void)_processWillSwap
+{
+    RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _processWillSwap]", self);
+    [self _processWillSwapOrDidExit];
+}
+
+- (void)_processDidExit
+{
+    RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _processDidExit]", self);
+
+    [self _processWillSwapOrDidExit];
+
+    [_contentView setFrame:self.bounds];
+    [_scrollView setBackgroundColor:[UIColor whiteColor]];
+    [_scrollView setContentOffset:[self _initialContentOffsetForScrollView]];
+    [_scrollView setZoomScale:1];
+    
+}
+
 - (void)_didRelaunchProcess
 {
     RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _didRelaunchProcess]", self);
index 0a36728..a1a0456 100644 (file)
@@ -82,6 +82,7 @@ struct PrintInfo;
 
 #if PLATFORM(IOS)
 - (void)_processDidExit;
+- (void)_processWillSwap;
 - (void)_didRelaunchProcess;
 
 - (void)_didCommitLoadForMainFrame;
index 37a8d77..99afd2b 100644 (file)
@@ -43,7 +43,8 @@ public:
     explicit RemoteLayerTreeDrawingAreaProxy(WebPageProxy&);
     virtual ~RemoteLayerTreeDrawingAreaProxy();
 
-    const RemoteLayerTreeHost& remoteLayerTreeHost() const { return m_remoteLayerTreeHost; }
+    const RemoteLayerTreeHost& remoteLayerTreeHost() const { return *m_remoteLayerTreeHost; }
+    std::unique_ptr<RemoteLayerTreeHost> detachRemoteLayerTreeHost();
 
     void acceleratedAnimationDidStart(uint64_t layerID, const String& key, MonotonicTime startTime);
     void acceleratedAnimationDidEnd(uint64_t layerID, const String& key);
@@ -100,7 +101,7 @@ private:
     
     void sendUpdateGeometry();
 
-    RemoteLayerTreeHost m_remoteLayerTreeHost;
+    std::unique_ptr<RemoteLayerTreeHost> m_remoteLayerTreeHost;
     bool m_isWaitingForDidUpdateGeometry { false };
     enum DidUpdateMessageState { DoesNotNeedDidUpdate, NeedsDidUpdate, MissedCommit };
     DidUpdateMessageState m_didUpdateMessageState { DoesNotNeedDidUpdate };
index 4f09f6f..1663f9b 100644 (file)
@@ -107,7 +107,7 @@ using namespace WebCore;
 
 RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy(WebPageProxy& webPageProxy)
     : DrawingAreaProxy(DrawingAreaTypeRemoteLayerTree, webPageProxy)
-    , m_remoteLayerTreeHost(*this)
+    , m_remoteLayerTreeHost(std::make_unique<RemoteLayerTreeHost>(*this))
 {
 #if HAVE(IOSURFACE)
     // We don't want to pool surfaces in the UI process.
@@ -131,6 +131,14 @@ RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy()
 #endif
 }
 
+
+std::unique_ptr<RemoteLayerTreeHost> RemoteLayerTreeDrawingAreaProxy::detachRemoteLayerTreeHost()
+{
+    m_remoteLayerTreeHost->detachFromDrawingArea();
+    return WTFMove(m_remoteLayerTreeHost);
+}
+
+
 #if PLATFORM(IOS)
 WKOneShotDisplayLinkHandler *RemoteLayerTreeDrawingAreaProxy::displayLinkHandler()
 {
@@ -194,11 +202,11 @@ void RemoteLayerTreeDrawingAreaProxy::commitLayerTree(const RemoteLayerTreeTrans
     if (layerTreeTransaction.hasEditorState())
         m_webPageProxy.editorStateChanged(layerTreeTransaction.editorState());
 
-    if (m_remoteLayerTreeHost.updateLayerTree(layerTreeTransaction)) {
+    if (m_remoteLayerTreeHost->updateLayerTree(layerTreeTransaction)) {
         if (layerTreeTransaction.transactionID() >= m_transactionIDForUnhidingContent)
-            m_webPageProxy.setAcceleratedCompositingRootLayer(m_remoteLayerTreeHost.rootLayer());
+            m_webPageProxy.setAcceleratedCompositingRootLayer(m_remoteLayerTreeHost->rootLayer());
         else
-            m_remoteLayerTreeHost.detachRootLayer();
+            m_remoteLayerTreeHost->detachRootLayer();
     }
 
 #if ENABLE(ASYNC_SCROLLING)
@@ -329,7 +337,7 @@ void RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator()
 void RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator(IntSize contentsSize, bool rootLayerChanged, float scale, const IntPoint& scrollPosition)
 {
     // Make sure we're the last sublayer.
-    CALayer *rootLayer = asLayer(m_remoteLayerTreeHost.rootLayer());
+    CALayer *rootLayer = asLayer(m_remoteLayerTreeHost->rootLayer());
     [m_tileMapHostLayer removeFromSuperlayer];
     [rootLayer addSublayer:m_tileMapHostLayer.get()];
 
@@ -469,22 +477,22 @@ void RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing(WTF::Function
 void RemoteLayerTreeDrawingAreaProxy::hideContentUntilPendingUpdate()
 {
     m_transactionIDForUnhidingContent = nextLayerTreeTransactionID();
-    m_remoteLayerTreeHost.detachRootLayer();
+    m_remoteLayerTreeHost->detachRootLayer();
 }
 
 void RemoteLayerTreeDrawingAreaProxy::hideContentUntilAnyUpdate()
 {
-    m_remoteLayerTreeHost.detachRootLayer();
+    m_remoteLayerTreeHost->detachRootLayer();
 }
 
 void RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension()
 {
-    m_remoteLayerTreeHost.mapAllIOSurfaceBackingStore();
+    m_remoteLayerTreeHost->mapAllIOSurfaceBackingStore();
 }
 
 bool RemoteLayerTreeDrawingAreaProxy::hasVisibleContent() const
 {
-    return m_remoteLayerTreeHost.rootLayer();
+    return m_remoteLayerTreeHost->rootLayer();
 }
 
 bool RemoteLayerTreeDrawingAreaProxy::isAlwaysOnLoggingAllowed() const
@@ -494,7 +502,7 @@ bool RemoteLayerTreeDrawingAreaProxy::isAlwaysOnLoggingAllowed() const
 
 LayerOrView* RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting(uint64_t layerID) const
 {
-    return m_remoteLayerTreeHost.layerWithIDForTesting(layerID);
+    return m_remoteLayerTreeHost->layerWithIDForTesting(layerID);
 }
 
 } // namespace WebKit
index 5a533d7..2388ba4 100644 (file)
@@ -61,6 +61,7 @@ public:
     void animationDidStart(WebCore::GraphicsLayer::PlatformLayerID, CAAnimation *, MonotonicTime startTime);
     void animationDidEnd(WebCore::GraphicsLayer::PlatformLayerID, CAAnimation *);
 
+    void detachFromDrawingArea();
     void clearLayers();
 
     // Detach the root layer; it will be reattached upon the next incoming commit.
@@ -78,11 +79,11 @@ private:
 
     void layerWillBeRemoved(WebCore::GraphicsLayer::PlatformLayerID);
 
-    RemoteLayerTreeDrawingAreaProxy& m_drawingArea;
-    LayerOrView *m_rootLayer;
+    RemoteLayerTreeDrawingAreaProxy* m_drawingArea { nullptr };
+    LayerOrView *m_rootLayer { nullptr };
     HashMap<WebCore::GraphicsLayer::PlatformLayerID, RetainPtr<LayerOrView>> m_layers;
     HashMap<WebCore::GraphicsLayer::PlatformLayerID, RetainPtr<WKAnimationDelegate>> m_animationDelegates;
-    bool m_isDebugLayerTreeHost;
+    bool m_isDebugLayerTreeHost { false };
 };
 
 } // namespace WebKit
index 4efe080..2ec58a0 100644 (file)
 namespace WebKit {
 using namespace WebCore;
 
-#define RELEASE_LOG_IF_ALLOWED(...) RELEASE_LOG_IF(m_drawingArea.isAlwaysOnLoggingAllowed(), ViewState, __VA_ARGS__)
+#define RELEASE_LOG_IF_ALLOWED(...) RELEASE_LOG_IF(m_drawingArea && m_drawingArea->isAlwaysOnLoggingAllowed(), ViewState, __VA_ARGS__)
 
 RemoteLayerTreeHost::RemoteLayerTreeHost(RemoteLayerTreeDrawingAreaProxy& drawingArea)
-    : m_drawingArea(drawingArea)
-    , m_rootLayer(nullptr)
-    , m_isDebugLayerTreeHost(false)
+    : m_drawingArea(&drawingArea)
 {
 }
 
@@ -68,6 +66,9 @@ RemoteLayerTreeHost::~RemoteLayerTreeHost()
 
 bool RemoteLayerTreeHost::updateLayerTree(const RemoteLayerTreeTransaction& transaction, float indicatorScaleFactor)
 {
+    if (!m_drawingArea)
+        return false;
+
     for (const auto& createdLayer : transaction.createdLayers()) {
         const RemoteLayerTreeTransaction::LayerProperties* properties = transaction.changedLayerProperties().get(createdLayer.layerID);
         createLayer(createdLayer, properties);
@@ -91,7 +92,7 @@ bool RemoteLayerTreeHost::updateLayerTree(const RemoteLayerTreeTransaction& tran
     // Can't use the iOS code on macOS yet: rdar://problem/31247730
     auto layerContentsType = RemoteLayerBackingStore::LayerContentsType::IOSurface;
 #else
-    auto layerContentsType = m_drawingArea.hasDebugIndicator() ? RemoteLayerBackingStore::LayerContentsType::IOSurface : RemoteLayerBackingStore::LayerContentsType::CAMachPort;
+    auto layerContentsType = m_drawingArea->hasDebugIndicator() ? RemoteLayerBackingStore::LayerContentsType::IOSurface : RemoteLayerBackingStore::LayerContentsType::CAMachPort;
 #endif
     
     for (auto& changedLayer : transaction.changedLayerProperties()) {
@@ -160,6 +161,9 @@ void RemoteLayerTreeHost::layerWillBeRemoved(WebCore::GraphicsLayer::PlatformLay
 
 void RemoteLayerTreeHost::animationDidStart(WebCore::GraphicsLayer::PlatformLayerID layerID, CAAnimation *animation, MonotonicTime startTime)
 {
+    if (!m_drawingArea)
+        return;
+
     CALayer *layer = asLayer(getLayer(layerID));
     if (!layer)
         return;
@@ -173,11 +177,14 @@ void RemoteLayerTreeHost::animationDidStart(WebCore::GraphicsLayer::PlatformLaye
     }
 
     if (!animationKey.isEmpty())
-        m_drawingArea.acceleratedAnimationDidStart(layerID, animationKey, startTime);
+        m_drawingArea->acceleratedAnimationDidStart(layerID, animationKey, startTime);
 }
 
 void RemoteLayerTreeHost::animationDidEnd(WebCore::GraphicsLayer::PlatformLayerID layerID, CAAnimation *animation)
 {
+    if (!m_drawingArea)
+        return;
+
     CALayer *layer = asLayer(getLayer(layerID));
     if (!layer)
         return;
@@ -191,7 +198,12 @@ void RemoteLayerTreeHost::animationDidEnd(WebCore::GraphicsLayer::PlatformLayerI
     }
 
     if (!animationKey.isEmpty())
-        m_drawingArea.acceleratedAnimationDidEnd(layerID, animationKey);
+        m_drawingArea->acceleratedAnimationDidEnd(layerID, animationKey);
+}
+
+void RemoteLayerTreeHost::detachFromDrawingArea()
+{
+    m_drawingArea = nullptr;
 }
 
 void RemoteLayerTreeHost::clearLayers()
index 6847b4a..db7b109 100644 (file)
@@ -2507,7 +2507,7 @@ void WebPageProxy::continueNavigationInNewProcess(API::Navigation& navigation, R
         auto transaction = m_pageLoadState.transaction();
         m_pageLoadState.setPendingAPIRequestURL(transaction, item->url());
 
-        auto itemStates = m_backForwardList-> filteredItemStates([this, targetItem = item](WebBackForwardListItem& item) {
+        auto itemStates = m_backForwardList->filteredItemStates([this, targetItem = item](WebBackForwardListItem& item) {
             if (auto* page = item.suspendedPage()) {
                 if (page->process() == m_process.ptr())
                     return false;
@@ -6017,7 +6017,16 @@ void WebPageProxy::resetState(ResetStateReason resetStateReason)
 #if PLATFORM(COCOA)
     m_scrollingPerformanceData = nullptr;
 #endif
-    m_drawingArea = nullptr;
+
+    if (m_drawingArea) {
+#if PLATFORM(COCOA)
+        if (resetStateReason == ResetStateReason::NavigationSwap && is<RemoteLayerTreeDrawingAreaProxy>(*m_drawingArea)) {
+            // Keep layers around in frozen state to avoid flashing during process swaps.
+            m_frozenRemoteLayerTreeHost = downcast<RemoteLayerTreeDrawingAreaProxy>(*m_drawingArea).detachRemoteLayerTreeHost();
+        }
+#endif
+        m_drawingArea = nullptr;
+    }
     closeOverlayedViews();
 
     if (m_inspector) {
index 23de8db..0f226fb 100644 (file)
@@ -223,6 +223,7 @@ class NativeWebKeyboardEvent;
 class NativeWebMouseEvent;
 class NativeWebWheelEvent;
 class PageClient;
+class RemoteLayerTreeHost;
 class RemoteLayerTreeScrollingPerformanceData;
 class RemoteLayerTreeTransaction;
 class RemoteScrollingCoordinatorProxy;
@@ -1861,10 +1862,12 @@ private:
     bool m_isLoadingAlternateHTMLStringForFailingProvisionalLoad { false };
 
     std::unique_ptr<DrawingAreaProxy> m_drawingArea;
-#if ENABLE(ASYNC_SCROLLING) && PLATFORM(COCOA)
+#if PLATFORM(COCOA)
+    std::unique_ptr<RemoteLayerTreeHost> m_frozenRemoteLayerTreeHost;
+#if ENABLE(ASYNC_SCROLLING)
     std::unique_ptr<RemoteScrollingCoordinatorProxy> m_scrollingCoordinatorProxy;
 #endif
-
+#endif
     Ref<WebProcessProxy> m_process;
     Ref<WebPageGroup> m_pageGroup;
     Ref<WebPreferences> m_preferences;
index f9acfda..e9c342a 100644 (file)
@@ -211,8 +211,8 @@ void PageClientImpl::processDidExit()
 
 void PageClientImpl::processWillSwap()
 {
-    // FIXME: It didn't really exit.
-    processDidExit();
+    [m_contentView _processWillSwap];
+    [m_webView _processWillSwap];
 }
 
 void PageClientImpl::didRelaunchProcess()
index 4c804cc..00c02d4 100644 (file)
@@ -85,6 +85,7 @@ class WebProcessPool;
 
 - (std::unique_ptr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy;
 - (void)_processDidExit;
+- (void)_processWillSwap;
 - (void)_didRelaunchProcess;
 - (void)_setAcceleratedCompositingRootView:(UIView *)rootView;
 
index 5f616b5..fd528ef 100644 (file)
@@ -521,6 +521,12 @@ static void storeAccessibilityRemoteConnectionInformation(id element, pid_t pid,
     [self _hideInspectorHighlight];
 }
 
+- (void)_processWillSwap
+{
+    // FIXME: Should we do something differently?
+    [self _processDidExit];
+}
+
 - (void)_didRelaunchProcess
 {
     [self _accessibilityRegisterUIProcessTokens];
index d5bf45f..2c89d0c 100644 (file)
@@ -993,6 +993,7 @@ void WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication(const String&
 void WebPageProxy::setAcceleratedCompositingRootLayer(LayerOrView* rootLayer)
 {
     pageClient().setAcceleratedCompositingRootLayer(rootLayer);
+    m_frozenRemoteLayerTreeHost = nullptr;
 }
 
 void WebPageProxy::showPlaybackTargetPicker(bool hasVideo, const IntRect& elementRect, WebCore::RouteSharingPolicy policy, const String& contextUID)
index 5d28cd9..28ecf43 100644 (file)
@@ -40,6 +40,7 @@
 #import "PageClient.h"
 #import "PageClientImplMac.h"
 #import "PluginComplexTextInputState.h"
+#import "RemoteLayerTreeHost.h"
 #import "StringUtilities.h"
 #import "TextChecker.h"
 #import "WKBrowsingContextControllerInternal.h"
@@ -458,6 +459,7 @@ void WebPageProxy::intrinsicContentSizeDidChange(const IntSize& intrinsicContent
 void WebPageProxy::setAcceleratedCompositingRootLayer(LayerOrView* rootLayer)
 {
     pageClient().setAcceleratedCompositingRootLayer(rootLayer);
+    m_frozenRemoteLayerTreeHost = nullptr;
 }
 
 LayerOrView* WebPageProxy::acceleratedCompositingRootLayer() const