[iOS] REGRESSION(r238490?): Safari sometimes shows blank page until a cross site...
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2019 20:24:43 +0000 (20:24 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2019 20:24:43 +0000 (20:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195037
<rdar://problem/48154508>

Reviewed by Antti Koivisto.

Restore the pre-r238490 behavior of WebPage::didCompletePageTransition clearing LayerTreeFreezeReason::ProcessSuspended
as this has been an issue when I was able to reproduce the issue locally.

Also added release logging to help diagnose the issue in the future.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::freezeLayerTree):
(WebKit::WebPage::unfreezeLayerTree):
(WebKit::WebPage::didCompletePageTransition):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::freezeAllLayerTrees):
(WebKit::WebProcess::unfreezeAllLayerTrees):

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

Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebProcess.cpp

index 5cd1aaa..8560909 100644 (file)
@@ -1,3 +1,24 @@
+2019-02-26  Ryosuke Niwa  <rniwa@webkit.org>
+
+        [iOS] REGRESSION(r238490?): Safari sometimes shows blank page until a cross site navigation or re-opening the tab
+        https://bugs.webkit.org/show_bug.cgi?id=195037
+        <rdar://problem/48154508>
+
+        Reviewed by Antti Koivisto.
+
+        Restore the pre-r238490 behavior of WebPage::didCompletePageTransition clearing LayerTreeFreezeReason::ProcessSuspended
+        as this has been an issue when I was able to reproduce the issue locally.
+
+        Also added release logging to help diagnose the issue in the future.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::freezeLayerTree):
+        (WebKit::WebPage::unfreezeLayerTree):
+        (WebKit::WebPage::didCompletePageTransition):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::freezeAllLayerTrees):
+        (WebKit::WebProcess::unfreezeAllLayerTrees):
+
 2019-02-26  Youenn Fablet  <youenn@apple.com>
 
         Create WebPageProxy::m_userMediaPermissionRequestManager only when needed
index 6ab3a30..47875e9 100644 (file)
@@ -2401,12 +2401,16 @@ const WebEvent* WebPage::currentEvent()
 
 void WebPage::freezeLayerTree(LayerTreeFreezeReason reason)
 {
+    RELEASE_LOG(ProcessSuspension, "%p - WebPage (PageID=%llu) - Adding a reason %d to freeze layer tree; current reasons are %d",
+        this, m_pageID, static_cast<unsigned>(reason), m_LayerTreeFreezeReasons.toRaw());
     m_LayerTreeFreezeReasons.add(reason);
     updateDrawingAreaLayerTreeFreezeState();
 }
 
 void WebPage::unfreezeLayerTree(LayerTreeFreezeReason reason)
 {
+    RELEASE_LOG(ProcessSuspension, "%p - WebPage (PageID=%llu) - Removing a reason %d to freeze layer tree; current reasons are %d",
+        this, m_pageID, static_cast<unsigned>(reason), m_LayerTreeFreezeReasons.toRaw());
     m_LayerTreeFreezeReasons.remove(reason);
     updateDrawingAreaLayerTreeFreezeState();
 }
@@ -3133,6 +3137,15 @@ void WebPage::didCompletePageTransition()
 {
     unfreezeLayerTree(LayerTreeFreezeReason::PageTransition);
 
+    if (m_LayerTreeFreezeReasons.contains(LayerTreeFreezeReason::ProcessSuspended)) {
+        RELEASE_LOG_ERROR(ProcessSuspension, "%p - WebPage (PageID=%llu) - LayerTreeFreezeReason::ProcessSuspended was set when removing LayerTreeFreezeReason::PageTransition; current reasons are %d",
+            this, m_pageID, m_LayerTreeFreezeReasons.toRaw());
+    }
+
+    // FIXME: In iOS, we sometimes never unset ProcessSuspended. See <rdar://problem/48154508>.
+    unfreezeLayerTree(LayerTreeFreezeReason::ProcessSuspended);
+    RELEASE_LOG_IF_ALLOWED("%p - WebPage - Did complete page transition", this);
+
     bool isInitialEmptyDocument = !m_mainFrame;
     if (!isInitialEmptyDocument)
         unfreezeLayerTree(LayerTreeFreezeReason::ProcessSwap);
index 042ec45..f62969e 100644 (file)
@@ -1521,12 +1521,14 @@ void WebProcess::cancelMarkAllLayersVolatile()
 
 void WebProcess::freezeAllLayerTrees()
 {
+    RELEASE_LOG(ProcessSuspension, "WebProcess %i is freezing all layer trees", getpid());
     for (auto& page : m_pageMap.values())
         page->freezeLayerTree(WebPage::LayerTreeFreezeReason::ProcessSuspended);
 }
 
 void WebProcess::unfreezeAllLayerTrees()
 {
+    RELEASE_LOG(ProcessSuspension, "WebProcess %i is unfreezing all layer trees", getpid());
     for (auto& page : m_pageMap.values())
         page->unfreezeLayerTree(WebPage::LayerTreeFreezeReason::ProcessSuspended);
 }