Title: [239777] trunk/Source/WebKit
Revision
239777
Author
[email protected]
Date
2019-01-09 10:23:22 -0800 (Wed, 09 Jan 2019)

Log Message

[PSON] Flash of blank content while transitioning from page A to page B.
https://bugs.webkit.org/show_bug.cgi?id=193283

Reviewed by Chris Dumez.

Layer tree is not frozen during WebPage construction. If the flush timer (started for the initial
empty document) manages to run before the actual page load starts, we'll get a flash.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:

Rename shouldDelayAttachingDrawingArea bit to isSwapFromSuspended and make it available on all platforms.

* UIProcess/RemoteLayerTree/mac/ScrollerMac.h: Removed.
* UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: Removed.
* UIProcess/RemoteLayerTree/mac/ScrollerPairMac.h: Removed.
* UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: Removed.
* UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: Removed.
* UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: Removed.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::swapToWebProcess):
(WebKit::WebPageProxy::finishAttachingToWebProcess):
(WebKit::WebPageProxy::initializeWebPage):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_shouldAttachDrawingAreaOnPageTransition):

Freeze the layer tree in WebPage constructor if this is a swap from a suspended process.

(WebKit::WebPage::reinitializeWebPage):
(WebKit::WebPage::didCompletePageTransition):

Unfreeze on first non-initial empty document page transition.

* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (239776 => 239777)


--- trunk/Source/WebKit/ChangeLog	2019-01-09 18:09:00 UTC (rev 239776)
+++ trunk/Source/WebKit/ChangeLog	2019-01-09 18:23:22 UTC (rev 239777)
@@ -1,3 +1,46 @@
+2019-01-09  Antti Koivisto  <[email protected]>
+
+        [PSON] Flash of blank content while transitioning from page A to page B.
+        https://bugs.webkit.org/show_bug.cgi?id=193283
+
+        Reviewed by Chris Dumez.
+
+        Layer tree is not frozen during WebPage construction. If the flush timer (started for the initial
+        empty document) manages to run before the actual page load starts, we'll get a flash.
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode const):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+
+        Rename shouldDelayAttachingDrawingArea bit to isSwapFromSuspended and make it available on all platforms.
+
+        * UIProcess/RemoteLayerTree/mac/ScrollerMac.h: Removed.
+        * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm: Removed.
+        * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.h: Removed.
+        * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: Removed.
+        * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp: Removed.
+        * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h: Removed.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::swapToWebProcess):
+        (WebKit::WebPageProxy::finishAttachingToWebProcess):
+        (WebKit::WebPageProxy::initializeWebPage):
+        (WebKit::WebPageProxy::continueNavigationInNewProcess):
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
+
+        Freeze the layer tree in WebPage constructor if this is a swap from a suspended process.
+
+        (WebKit::WebPage::reinitializeWebPage):
+        (WebKit::WebPage::didCompletePageTransition):
+
+        Unfreeze on first non-initial empty document page transition.
+
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
+
 2019-01-09  Chris Dumez  <[email protected]>
 
         WebKit Networking process crashes if the HTTPSUpgradeList is not found in the bundle

Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp (239776 => 239777)


--- trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp	2019-01-09 18:09:00 UTC (rev 239776)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp	2019-01-09 18:23:22 UTC (rev 239777)
@@ -73,12 +73,12 @@
     encoder.encodeEnum(layerHostingMode);
     encoder << mimeTypesWithCustomContentProviders;
     encoder << controlledByAutomation;
+    encoder << isSwapFromSuspended;
 
 #if PLATFORM(MAC)
     encoder << colorSpace;
     encoder << useSystemAppearance;
     encoder << useDarkAppearance;
-    encoder << shouldDelayAttachingDrawingArea;
 #endif
 #if PLATFORM(IOS_FAMILY)
     encoder << screenSize;
@@ -227,6 +227,8 @@
         return WTF::nullopt;
     if (!decoder.decode(parameters.controlledByAutomation))
         return WTF::nullopt;
+    if (!decoder.decode(parameters.isSwapFromSuspended))
+        return WTF::nullopt;
 
 #if PLATFORM(MAC)
     if (!decoder.decode(parameters.colorSpace))
@@ -235,8 +237,6 @@
         return WTF::nullopt;
     if (!decoder.decode(parameters.useDarkAppearance))
         return WTF::nullopt;
-    if (!decoder.decode(parameters.shouldDelayAttachingDrawingArea))
-        return WTF::nullopt;
 #endif
 
 #if PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.h (239776 => 239777)


--- trunk/Source/WebKit/Shared/WebPageCreationParameters.h	2019-01-09 18:09:00 UTC (rev 239776)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.h	2019-01-09 18:23:22 UTC (rev 239777)
@@ -129,12 +129,12 @@
     Vector<String> mimeTypesWithCustomContentProviders;
 
     bool controlledByAutomation;
+    bool isSwapFromSuspended { false };
 
 #if PLATFORM(MAC)
     ColorSpaceData colorSpace;
     bool useSystemAppearance;
     bool useDarkAppearance;
-    bool shouldDelayAttachingDrawingArea { false };
 #endif
 #if PLATFORM(IOS_FAMILY)
     WebCore::FloatSize screenSize;

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (239776 => 239777)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-01-09 18:09:00 UTC (rev 239776)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-01-09 18:23:22 UTC (rev 239777)
@@ -772,7 +772,7 @@
     return true;
 }
 
-void WebPageProxy::swapToWebProcess(Ref<WebProcessProxy>&& process, std::unique_ptr<SuspendedPageProxy>&& destinationSuspendedPage, ShouldDelayAttachingDrawingArea shouldDelayAttachingDrawingArea)
+void WebPageProxy::swapToWebProcess(Ref<WebProcessProxy>&& process, std::unique_ptr<SuspendedPageProxy>&& destinationSuspendedPage, IsSwapFromSuspended isSwapFromSuspended)
 {
     ASSERT(!m_isClosed);
     RELEASE_LOG_IF_ALLOWED(Loading, "swapToWebProcess: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID);
@@ -800,10 +800,10 @@
     m_process->addExistingWebPage(*this, m_pageID, WebProcessProxy::BeginsUsingDataStore::No);
     m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID, *this);
 
-    finishAttachingToWebProcess(shouldDelayAttachingDrawingArea);
+    finishAttachingToWebProcess(isSwapFromSuspended);
 }
 
-void WebPageProxy::finishAttachingToWebProcess(ShouldDelayAttachingDrawingArea shouldDelayAttachingDrawingArea)
+void WebPageProxy::finishAttachingToWebProcess(IsSwapFromSuspended isSwapFromSuspended)
 {
     ASSERT(m_process->state() != ChildProcessProxy::State::Terminated);
 
@@ -839,7 +839,7 @@
     m_editableImageController = std::make_unique<EditableImageController>(*this);
 #endif
 
-    initializeWebPage(shouldDelayAttachingDrawingArea);
+    initializeWebPage(isSwapFromSuspended);
 
     m_inspector->updateForNewPageProcess(this);
 
@@ -904,7 +904,7 @@
     return WTFMove(navigation);
 }
 
-void WebPageProxy::initializeWebPage(ShouldDelayAttachingDrawingArea shouldDelayAttachingDrawingArea)
+void WebPageProxy::initializeWebPage(IsSwapFromSuspended isSwapFromSuspended)
 {
     ASSERT(isValid());
 
@@ -922,11 +922,7 @@
 #endif
 
     auto parameters = creationParameters();
-#if PLATFORM(MAC)
-    parameters.shouldDelayAttachingDrawingArea = shouldDelayAttachingDrawingArea == ShouldDelayAttachingDrawingArea::Yes;
-#else
-    UNUSED_PARAM(shouldDelayAttachingDrawingArea);
-#endif
+    parameters.isSwapFromSuspended = isSwapFromSuspended == IsSwapFromSuspended::Yes;
 
 #if ENABLE(SERVICE_WORKER)
     parameters.hasRegisteredServiceWorkers = process().processPool().mayHaveRegisteredServiceWorkers(m_websiteDataStore);
@@ -2768,7 +2764,7 @@
     bool didSuspendPreviousPage = suspendCurrentPageIfPossible(navigation, mainFrameIDInPreviousProcess, processSwapRequestedByClient);
     m_process->removeWebPage(*this, m_pageID, WebProcessProxy::EndsUsingDataStore::No);
 
-    swapToWebProcess(WTFMove(process), WTFMove(suspendedPageProxy), didSuspendPreviousPage ? ShouldDelayAttachingDrawingArea::Yes : ShouldDelayAttachingDrawingArea::No);
+    swapToWebProcess(WTFMove(process), WTFMove(suspendedPageProxy), didSuspendPreviousPage ? IsSwapFromSuspended::Yes : IsSwapFromSuspended::No);
 
     if (auto* item = navigation.targetItem()) {
         LOG(Loading, "WebPageProxy %p continueNavigationInNewProcess to back item URL %s", this, item->url().utf8().data());

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (239776 => 239777)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-01-09 18:09:00 UTC (rev 239776)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-01-09 18:23:22 UTC (rev 239777)
@@ -458,8 +458,8 @@
     API::IconLoadingClient& iconLoadingClient() { return *m_iconLoadingClient; }
     void setIconLoadingClient(std::unique_ptr<API::IconLoadingClient>&&);
 
-    enum class ShouldDelayAttachingDrawingArea { No, Yes };
-    void initializeWebPage(ShouldDelayAttachingDrawingArea = ShouldDelayAttachingDrawingArea::No);
+    enum class IsSwapFromSuspended { No, Yes };
+    void initializeWebPage(IsSwapFromSuspended = IsSwapFromSuspended::No);
 
     WeakPtr<SecKeyProxyStore> secKeyProxyStore(const WebCore::AuthenticationChallenge&);
         
@@ -1574,11 +1574,11 @@
     void setCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents) { m_canShortCircuitHorizontalWheelEvents = canShortCircuitHorizontalWheelEvents; }
 
     void reattachToWebProcess();
-    void swapToWebProcess(Ref<WebProcessProxy>&&, std::unique_ptr<SuspendedPageProxy>&&, ShouldDelayAttachingDrawingArea);
+    void swapToWebProcess(Ref<WebProcessProxy>&&, std::unique_ptr<SuspendedPageProxy>&&, IsSwapFromSuspended);
     void didFailToSuspendAfterProcessSwap();
     void didSuspendAfterProcessSwap();
 
-    void finishAttachingToWebProcess(ShouldDelayAttachingDrawingArea = ShouldDelayAttachingDrawingArea::No);
+    void finishAttachingToWebProcess(IsSwapFromSuspended = IsSwapFromSuspended::No);
 
     RefPtr<API::Navigation> reattachToWebProcessForReload();
     RefPtr<API::Navigation> reattachToWebProcessWithItem(WebBackForwardListItem&);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (239776 => 239777)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-01-09 18:09:00 UTC (rev 239776)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-01-09 18:23:22 UTC (rev 239777)
@@ -402,7 +402,7 @@
     , m_overrideContentSecurityPolicy { parameters.overrideContentSecurityPolicy }
     , m_cpuLimit(parameters.cpuLimit)
 #if PLATFORM(MAC)
-    , m_shouldAttachDrawingAreaOnPageTransition(parameters.shouldDelayAttachingDrawingArea)
+    , m_shouldAttachDrawingAreaOnPageTransition(parameters.isSwapFromSuspended)
 #endif
 {
     ASSERT(m_pageID);
@@ -472,6 +472,9 @@
     m_drawingArea->setPaintingEnabled(false);
     m_drawingArea->setShouldScaleViewToFitDocument(parameters.shouldScaleViewToFitDocument);
 
+    if (parameters.isSwapFromSuspended)
+        freezeLayerTree(LayerTreeFreezeReason::SwapFromSuspended);
+
 #if ENABLE(ASYNC_SCROLLING)
     m_useAsyncScrolling = parameters.store.getBoolValueForKey(WebPreferencesKey::threadedScrollingEnabledKey());
     if (!m_drawingArea->supportsAsyncScrolling())
@@ -694,7 +697,7 @@
         m_drawingArea->updatePreferences(parameters.store);
         m_drawingArea->setPaintingEnabled(true);
 #if PLATFORM(MAC)
-        m_shouldAttachDrawingAreaOnPageTransition = parameters.shouldDelayAttachingDrawingArea;
+        m_shouldAttachDrawingAreaOnPageTransition = parameters.isSwapFromSuspended;
 #endif
         unfreezeLayerTree(LayerTreeFreezeReason::PageSuspended);
     }
@@ -3096,8 +3099,11 @@
 {
     unfreezeLayerTree(LayerTreeFreezeReason::PageTransition);
 
+    bool isInitialEmptyDocument = !m_mainFrame;
+    if (!isInitialEmptyDocument)
+        unfreezeLayerTree(LayerTreeFreezeReason::SwapFromSuspended);
+
 #if PLATFORM(MAC)
-    bool isInitialEmptyDocument = !m_mainFrame;
     if (m_shouldAttachDrawingAreaOnPageTransition && !isInitialEmptyDocument) {
         m_shouldAttachDrawingAreaOnPageTransition = false;
         // Unfreezing the layer tree above schedules a layer flush so we delay attaching the drawing area

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (239776 => 239777)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-01-09 18:09:00 UTC (rev 239776)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-01-09 18:23:22 UTC (rev 239777)
@@ -696,6 +696,7 @@
         ProcessSuspended        = 1 << 2,
         PageSuspended           = 1 << 3,
         Printing                = 1 << 4,
+        SwapFromSuspended       = 1 << 5,
     };
     void freezeLayerTree(LayerTreeFreezeReason);
     void unfreezeLayerTree(LayerTreeFreezeReason);

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (239776 => 239777)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2019-01-09 18:09:00 UTC (rev 239776)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2019-01-09 18:23:22 UTC (rev 239777)
@@ -97,7 +97,7 @@
     updateLayerHostingContext();
     setColorSpace(parameters.colorSpace);
 
-    if (!parameters.shouldDelayAttachingDrawingArea)
+    if (!parameters.isSwapFromSuspended)
         attach();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to