Title: [235867] trunk/Source/WebKit
Revision
235867
Author
[email protected]
Date
2018-09-10 15:17:58 -0700 (Mon, 10 Sep 2018)

Log Message

Regression(PSON): WebView is blank when navigating back cross-process on iOS
https://bugs.webkit.org/show_bug.cgi?id=189481
<rdar://problem/44315010>

Reviewed by Tim Horton.

When process swapping on navigation, the WebPageProxy would detach from the old WebProcess and destroy
its RemoteLayerTreeDrawingAreaProxy. It would then create a new process and a new RemoteLayerTreeDrawingAreaProxy
to listen for IPC from this new process. When navigating back to the original process, we would do the
same in the opposite direction. However, the issue was that the old WebProcess's WebPage would not destroy its
drawing area and some state would persist and cause issues. For example, the DrawingArea would send a
CommitLayerTree IPC to the UIProcess and set m_waitingForBackingStoreSwap to true. It normally resets
m_waitingForBackingStoreSwap to false when getting the DidUpdate IPC from the UIProcess. However, when the
WebPage is detached from its WebPageProxy (i.e. suspended due to PSON), the UIProcess would not respond to
IPC from the old WebProcess and m_waitingForBackingStoreSwap would never get reset.

* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::~SuspendedPageProxy):
Make sure we send the SetIsSuspended IPC to the WebProcess with false value when
the SuspendedPageProxy gets destroyed, so that the WebProcess can update its
m_isSuspended flag. Previous, it was set to true when constructing the
SuspendedPageProxy but never reset to false.

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::invalidateContentsAndRootView):
(WebKit::WebChromeClient::invalidateContentsForSlowScroll):
Add null checks for the drawing area now that it can be null while suspended.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::reinitializeWebPage):
When a WebPage gets reattached to a WebPageProxy, this method is called. Since we now
destroy the drawing area upon suspension (WebPage gets detached from WebPageProxy), we
need to make sure we recreate the drawing area when reattaching.

(WebKit::WebPage::setIsSuspended):
Destroy the drawing area when the WebPage is suspended, meaning that this WebPage
is no longer associated with a WebPageProxy.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (235866 => 235867)


--- trunk/Source/WebKit/ChangeLog	2018-09-10 22:16:35 UTC (rev 235866)
+++ trunk/Source/WebKit/ChangeLog	2018-09-10 22:17:58 UTC (rev 235867)
@@ -1,3 +1,43 @@
+2018-09-10  Chris Dumez  <[email protected]>
+
+        Regression(PSON): WebView is blank when navigating back cross-process on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=189481
+        <rdar://problem/44315010>
+
+        Reviewed by Tim Horton.
+
+        When process swapping on navigation, the WebPageProxy would detach from the old WebProcess and destroy
+        its RemoteLayerTreeDrawingAreaProxy. It would then create a new process and a new RemoteLayerTreeDrawingAreaProxy
+        to listen for IPC from this new process. When navigating back to the original process, we would do the
+        same in the opposite direction. However, the issue was that the old WebProcess's WebPage would not destroy its
+        drawing area and some state would persist and cause issues. For example, the DrawingArea would send a
+        CommitLayerTree IPC to the UIProcess and set m_waitingForBackingStoreSwap to true. It normally resets
+        m_waitingForBackingStoreSwap to false when getting the DidUpdate IPC from the UIProcess. However, when the
+        WebPage is detached from its WebPageProxy (i.e. suspended due to PSON), the UIProcess would not respond to
+        IPC from the old WebProcess and m_waitingForBackingStoreSwap would never get reset.
+
+        * UIProcess/SuspendedPageProxy.cpp:
+        (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
+        Make sure we send the SetIsSuspended IPC to the WebProcess with false value when
+        the SuspendedPageProxy gets destroyed, so that the WebProcess can update its
+        m_isSuspended flag. Previous, it was set to true when constructing the
+        SuspendedPageProxy but never reset to false.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::invalidateContentsAndRootView):
+        (WebKit::WebChromeClient::invalidateContentsForSlowScroll):
+        Add null checks for the drawing area now that it can be null while suspended.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::reinitializeWebPage):
+        When a WebPage gets reattached to a WebPageProxy, this method is called. Since we now
+        destroy the drawing area upon suspension (WebPage gets detached from WebPageProxy), we
+        need to make sure we recreate the drawing area when reattaching.
+
+        (WebKit::WebPage::setIsSuspended):
+        Destroy the drawing area when the WebPage is suspended, meaning that this WebPage
+        is no longer associated with a WebPageProxy.
+
 2018-09-10  Daniel Bates  <[email protected]>
 
         [iOS] Arrow keys do not dispatch DOM events to non-editable elements

Modified: trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp (235866 => 235867)


--- trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp	2018-09-10 22:16:35 UTC (rev 235866)
+++ trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp	2018-09-10 22:17:58 UTC (rev 235867)
@@ -87,6 +87,7 @@
 SuspendedPageProxy::~SuspendedPageProxy()
 {
     if (auto process = makeRefPtr(m_process)) {
+        process->send(Messages::WebPage::SetIsSuspended(false), m_page.pageID());
         process->suspendedPageWasDestroyed(*this);
         process->processPool().unregisterSuspendedPageProxy(*this);
     }

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (235866 => 235867)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2018-09-10 22:16:35 UTC (rev 235866)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp	2018-09-10 22:17:58 UTC (rev 235867)
@@ -523,7 +523,8 @@
             return;
     }
 
-    m_page.drawingArea()->setNeedsDisplayInRect(rect);
+    if (auto* drawingArea = m_page.drawingArea())
+        drawingArea->setNeedsDisplayInRect(rect);
 }
 
 void WebChromeClient::invalidateContentsForSlowScroll(const IntRect& rect)
@@ -541,7 +542,8 @@
         return;
     }
 #endif
-    m_page.drawingArea()->setNeedsDisplayInRect(rect);
+    if (auto* drawingArea = m_page.drawingArea())
+        drawingArea->setNeedsDisplayInRect(rect);
 }
 
 void WebChromeClient::scroll(const IntSize& scrollDelta, const IntRect& scrollRect, const IntRect& clipRect)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (235866 => 235867)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-09-10 22:16:35 UTC (rev 235866)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-09-10 22:17:58 UTC (rev 235867)
@@ -652,7 +652,13 @@
 
 void WebPage::reinitializeWebPage(WebPageCreationParameters&& parameters)
 {
-    ASSERT(m_drawingArea);
+    if (!m_drawingArea) {
+        m_drawingArea = DrawingArea::create(*this, parameters);
+        m_drawingArea->setPaintingEnabled(false);
+        m_drawingArea->setShouldScaleViewToFitDocument(parameters.shouldScaleViewToFitDocument);
+        m_drawingArea->updatePreferences(parameters.store);
+        m_drawingArea->setPaintingEnabled(true);
+    }
     m_drawingArea->attachDrawingArea();
 
     if (m_activityState != parameters.activityState)
@@ -5993,7 +5999,12 @@
 
 void WebPage::setIsSuspended(bool suspended)
 {
+    if (m_isSuspended == suspended)
+        return;
+
     m_isSuspended = suspended;
+    if (m_isSuspended)
+        m_drawingArea = nullptr;
 }
 
 void WebPage::frameBecameRemote(uint64_t frameID, GlobalFrameIdentifier&& remoteFrameIdentifier, GlobalWindowIdentifier&& remoteWindowIdentifier)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to