[PSON] Avoid tearing down the drawing area when suspending a WebPage due to process...
[WebKit-https.git] / Source / WebKit / UIProcess / WebPageProxy.cpp
index 9dea7980af6077caf6caee7f9b4f4ff845b3af5a..3aec6253622b8dd71a7a83e6306f571046edb037 100644 (file)
@@ -724,10 +724,14 @@ void WebPageProxy::suspendCurrentPageIfPossible(API::Navigation& navigation, std
     }
 
     auto suspendedPage = std::make_unique<SuspendedPageProxy>(*this, m_process.copyRef(), *currentItem, *mainFrameID);
     }
 
     auto suspendedPage = std::make_unique<SuspendedPageProxy>(*this, m_process.copyRef(), *currentItem, *mainFrameID);
+
+#if PLATFORM(MAC)
     m_pageSuspendedDueToCurrentNavigation = makeWeakPtr(suspendedPage.get());
     m_pageSuspendedDueToCurrentNavigation = makeWeakPtr(suspendedPage.get());
-    m_process->processPool().addSuspendedPageProxy(WTFMove(suspendedPage));
+#endif
+
+    LOG(ProcessSwapping, "WebPageProxy %" PRIu64 " created suspended page %s for process pid %i, back/forward item %s" PRIu64, pageID(), suspendedPage->loggingString(), m_process->processIdentifier(), currentItem->itemID().logString());
 
 
-    LOG(ProcessSwapping, "WebPageProxy %" PRIu64 " created suspended page %s for process pid %i, back/forward item %s" PRIu64, pageID(), m_pageSuspendedDueToCurrentNavigation->loggingString(), m_process->processIdentifier(), currentItem->itemID().logString());
+    m_process->processPool().addSuspendedPageProxy(WTFMove(suspendedPage));
 }
 
 void WebPageProxy::swapToWebProcess(Ref<WebProcessProxy>&& process, API::Navigation& navigation, std::optional<uint64_t> mainFrameIDInPreviousProcess)
 }
 
 void WebPageProxy::swapToWebProcess(Ref<WebProcessProxy>&& process, API::Navigation& navigation, std::optional<uint64_t> mainFrameIDInPreviousProcess)
@@ -2491,9 +2495,11 @@ void WebPageProxy::receivedNavigationPolicyDecision(PolicyAction policyAction, A
     }
     
     if (policyAction == PolicyAction::Use && frame.isMainFrame()) {
     }
     
     if (policyAction == PolicyAction::Use && frame.isMainFrame()) {
+#if PLATFORM(MAC)
         // We're about to navigate so we need to reset m_pageSuspendedDueToCurrentNavigation. If we decide to process swap,
         // continueNavigationInNewProcess() will take care of updating m_pageSuspendedDueToCurrentNavigation as needed.
         m_pageSuspendedDueToCurrentNavigation = nullptr;
         // We're about to navigate so we need to reset m_pageSuspendedDueToCurrentNavigation. If we decide to process swap,
         // continueNavigationInNewProcess() will take care of updating m_pageSuspendedDueToCurrentNavigation as needed.
         m_pageSuspendedDueToCurrentNavigation = nullptr;
+#endif
 
         String reason;
         auto proposedProcess = process().processPool().processForNavigation(*this, *navigation, processSwapRequestedByClient, policyAction, reason);
 
         String reason;
         auto proposedProcess = process().processPool().processForNavigation(*this, *navigation, processSwapRequestedByClient, policyAction, reason);
@@ -3516,19 +3522,18 @@ void WebPageProxy::didFinishProgress()
 
 void WebPageProxy::didCompletePageTransition(bool isInitialEmptyDocument)
 {
 
 void WebPageProxy::didCompletePageTransition(bool isInitialEmptyDocument)
 {
+#if PLATFORM(MAC)
     // Attach drawing area for the initial empty document only if this is not a process swap.
     if (isInitialEmptyDocument && m_pageSuspendedDueToCurrentNavigation)
         return;
 
     // Attach drawing area for the initial empty document only if this is not a process swap.
     if (isInitialEmptyDocument && m_pageSuspendedDueToCurrentNavigation)
         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_drawingArea)
         return;
 
     // Drawing area for the suspended page will be torn down when the attach completes.
     m_drawingArea->attachInWebProcess();
 #else
-    if (m_pageSuspendedDueToCurrentNavigation)
-        m_pageSuspendedDueToCurrentNavigation->tearDownDrawingAreaInWebProcess();
+    UNUSED_PARAM(isInitialEmptyDocument);
 #endif
 }
 
 #endif
 }
 
@@ -6425,10 +6430,6 @@ WebPageCreationParameters WebPageProxy::creationParameters()
 void WebPageProxy::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
 {
     pageClient().enterAcceleratedCompositingMode(layerTreeContext);
 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_pageSuspendedDueToCurrentNavigation)
-        m_pageSuspendedDueToCurrentNavigation->tearDownDrawingAreaInWebProcess();
 }
 
 void WebPageProxy::exitAcceleratedCompositingMode()
 }
 
 void WebPageProxy::exitAcceleratedCompositingMode()