Title: [240343] trunk/Source/WebKit
Revision
240343
Author
an...@apple.com
Date
2019-01-23 09:43:02 -0800 (Wed, 23 Jan 2019)

Log Message

[PSON] Flash on back navigation on Mac
https://bugs.webkit.org/show_bug.cgi?id=193716
<rdar://problem/47148458>

Reviewed by Chris Dumez.

We close the page immediately if we fail to suspend. Layers disappear and we get a flash.

* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::didProcessRequestToSuspend):

Remove the suspended page (so closing it on web process side) if the suspension fails.
Skip this if we are using web process side compositing on Mac.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::enterAcceleratedCompositingMode):

On Mac, remove failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive.

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::removeFailedSuspendedPagesForPage):
* UIProcess/WebProcessPool.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::suspendForProcessSwap):

Don't close the page on suspension failure.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (240342 => 240343)


--- trunk/Source/WebKit/ChangeLog	2019-01-23 17:30:05 UTC (rev 240342)
+++ trunk/Source/WebKit/ChangeLog	2019-01-23 17:43:02 UTC (rev 240343)
@@ -1,3 +1,32 @@
+2019-01-23  Antti Koivisto  <an...@apple.com>
+
+        [PSON] Flash on back navigation on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=193716
+        <rdar://problem/47148458>
+
+        Reviewed by Chris Dumez.
+
+        We close the page immediately if we fail to suspend. Layers disappear and we get a flash.
+
+        * UIProcess/SuspendedPageProxy.cpp:
+        (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
+
+        Remove the suspended page (so closing it on web process side) if the suspension fails.
+        Skip this if we are using web process side compositing on Mac.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
+
+        On Mac, remove failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive.
+
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::removeFailedSuspendedPagesForPage):
+        * UIProcess/WebProcessPool.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::suspendForProcessSwap):
+
+        Don't close the page on suspension failure.
+
 2019-01-23  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Introduce UndoStep::label() and adopt it in WebKitLegacy and WebKit

Modified: trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp (240342 => 240343)


--- trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp	2019-01-23 17:30:05 UTC (rev 240342)
+++ trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp	2019-01-23 17:43:02 UTC (rev 240343)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "SuspendedPageProxy.h"
 
+#include "DrawingAreaProxy.h"
 #include "Logging.h"
 #include "WebPageMessages.h"
 #include "WebPageProxy.h"
@@ -154,6 +155,19 @@
 
     m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_page.pageID());
 
+    bool shouldKeepOnFailure = false;
+#if PLATFORM(MAC)
+    // With web process side tiles, we need to keep the suspended page around on failure to avoid flashing.
+    // It is removed by WebPageProxy::enterAcceleratedCompositingMode when the target page is ready.
+    shouldKeepOnFailure = m_page.drawingArea() && m_page.drawingArea()->type() == DrawingAreaTypeTiledCoreAnimation;
+#endif
+    if (newSuspensionState == SuspensionState::FailedToSuspend && !shouldKeepOnFailure) {
+        RunLoop::main().dispatch([weakProcessPool = makeWeakPtr(m_process->processPool()), weakThis = makeWeakPtr(*this)] {
+            if (weakProcessPool && weakThis)
+                weakProcessPool->removeSuspendedPage(*weakThis);
+        });
+    }
+
     if (m_readyToUnsuspendHandler)
         m_readyToUnsuspendHandler(this);
 }

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (240342 => 240343)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-01-23 17:30:05 UTC (rev 240342)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-01-23 17:43:02 UTC (rev 240343)
@@ -6847,7 +6847,12 @@
 
 void WebPageProxy::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
 {
+#if PLATFORM(MAC)
+    ASSERT(m_drawingArea->type() == DrawingAreaTypeTiledCoreAnimation);
+#endif
     pageClient().enterAcceleratedCompositingMode(layerTreeContext);
+    // We needed the failed suspended page to stay alive to avoid flashing. Now we can get rid of it.
+    m_process->processPool().removeFailedSuspendedPagesForPage(*this);
 }
 
 void WebPageProxy::exitAcceleratedCompositingMode()

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (240342 => 240343)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2019-01-23 17:30:05 UTC (rev 240342)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2019-01-23 17:43:02 UTC (rev 240343)
@@ -2270,6 +2270,13 @@
     });
 }
 
+void WebProcessPool::removeFailedSuspendedPagesForPage(WebPageProxy& page)
+{
+    m_suspendedPages.removeAllMatching([&page](auto& suspendedPage) {
+        return &suspendedPage->page() == &page && suspendedPage->failedToSuspend();
+    });
+}
+
 std::unique_ptr<SuspendedPageProxy> WebProcessPool::takeSuspendedPage(SuspendedPageProxy& suspendedPage)
 {
     return m_suspendedPages.takeFirst([&suspendedPage](auto& item) {

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (240342 => 240343)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.h	2019-01-23 17:30:05 UTC (rev 240342)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h	2019-01-23 17:43:02 UTC (rev 240343)
@@ -450,6 +450,7 @@
     // SuspendedPageProxy management.
     void addSuspendedPage(std::unique_ptr<SuspendedPageProxy>&&);
     void removeAllSuspendedPagesForPage(WebPageProxy&);
+    void removeFailedSuspendedPagesForPage(WebPageProxy&);
     std::unique_ptr<SuspendedPageProxy> takeSuspendedPage(SuspendedPageProxy&);
     void removeSuspendedPage(SuspendedPageProxy&);
     bool hasSuspendedPageFor(WebProcessProxy&) const;

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (240342 => 240343)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-01-23 17:30:05 UTC (rev 240342)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-01-23 17:43:02 UTC (rev 240343)
@@ -1340,7 +1340,6 @@
 void WebPage::suspendForProcessSwap()
 {
     auto failedToSuspend = [this, protectedThis = makeRef(*this)] {
-        close();
         send(Messages::WebPageProxy::DidFailToSuspendAfterProcessSwap());
     };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to