Title: [250209] releases/WebKitGTK/webkit-2.26/Source/WebKit
Revision
250209
Author
carlo...@webkit.org
Date
2019-09-23 01:39:11 -0700 (Mon, 23 Sep 2019)

Log Message

Merge r249953 - [GTK] Initial view loading is slow
https://bugs.webkit.org/show_bug.cgi?id=201451

Reviewed by Sergio Villar Senin.

The problem is that now we are always calling DrawingAreaProxy::waitForBackingStoreUpdateOnNextPaint() after a
new process is launched and we used to do that only when launching a new process after a crash. This makes
m_hasReceivedFirstUpdate useless, because it's always set to true right after a process is launched. Then, we
wait up to half a second (which is usually the case for the initial load) until the first update. We only want
to do that when recovering from a crash or when swapping processes to avoid flashing effect.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::launchProcess): Add ProcessLaunchReason parameter and pass it to
finishAttachingToWebProcess instead of IsProcessSwap.
(WebKit::WebPageProxy::swapToWebProcess): Pass ProcessLaunchReason::ProcessSwap to
finishAttachingToWebProcess().
(WebKit::WebPageProxy::finishAttachingToWebProcess): Do not call
DrawingAreaProxy::waitForBackingStoreUpdateOnNextPaint() when process launch reason is ProcessLaunchReason::InitialProcess.
(WebKit::WebPageProxy::launchProcessForReload): Pass ProcessLaunchReason::Reload to launchProcess().
* UIProcess/WebPageProxy.h: Remove IsProcessSwap and add ProcessLaunchReason instead that is passed to
launchProcess and finishAttachingToWebProcess.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.26/Source/WebKit/ChangeLog (250208 => 250209)


--- releases/WebKitGTK/webkit-2.26/Source/WebKit/ChangeLog	2019-09-23 08:39:08 UTC (rev 250208)
+++ releases/WebKitGTK/webkit-2.26/Source/WebKit/ChangeLog	2019-09-23 08:39:11 UTC (rev 250209)
@@ -1,3 +1,27 @@
+2019-09-17  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [GTK] Initial view loading is slow
+        https://bugs.webkit.org/show_bug.cgi?id=201451
+
+        Reviewed by Sergio Villar Senin.
+
+        The problem is that now we are always calling DrawingAreaProxy::waitForBackingStoreUpdateOnNextPaint() after a
+        new process is launched and we used to do that only when launching a new process after a crash. This makes
+        m_hasReceivedFirstUpdate useless, because it's always set to true right after a process is launched. Then, we
+        wait up to half a second (which is usually the case for the initial load) until the first update. We only want
+        to do that when recovering from a crash or when swapping processes to avoid flashing effect.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::launchProcess): Add ProcessLaunchReason parameter and pass it to
+        finishAttachingToWebProcess instead of IsProcessSwap.
+        (WebKit::WebPageProxy::swapToWebProcess): Pass ProcessLaunchReason::ProcessSwap to
+        finishAttachingToWebProcess().
+        (WebKit::WebPageProxy::finishAttachingToWebProcess): Do not call
+        DrawingAreaProxy::waitForBackingStoreUpdateOnNextPaint() when process launch reason is ProcessLaunchReason::InitialProcess.
+        (WebKit::WebPageProxy::launchProcessForReload): Pass ProcessLaunchReason::Reload to launchProcess().
+        * UIProcess/WebPageProxy.h: Remove IsProcessSwap and add ProcessLaunchReason instead that is passed to
+        launchProcess and finishAttachingToWebProcess.
+
 2019-09-18  Carlos Alberto Lopez Perez  <clo...@igalia.com>
 
         [GTK][WPE] bubblewrap sandbox should be disabled when running inside docker

Modified: releases/WebKitGTK/webkit-2.26/Source/WebKit/UIProcess/WebPageProxy.cpp (250208 => 250209)


--- releases/WebKitGTK/webkit-2.26/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-09-23 08:39:08 UTC (rev 250208)
+++ releases/WebKitGTK/webkit-2.26/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-09-23 08:39:11 UTC (rev 250209)
@@ -718,7 +718,7 @@
     });
 }
 
-void WebPageProxy::launchProcess(const RegistrableDomain& registrableDomain)
+void WebPageProxy::launchProcess(const RegistrableDomain& registrableDomain, ProcessLaunchReason reason)
 {
     ASSERT(!m_isClosed);
     ASSERT(!hasRunningProcess());
@@ -740,7 +740,7 @@
     m_process->addExistingWebPage(*this, WebProcessProxy::BeginsUsingDataStore::Yes);
     m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID, *this);
 
-    finishAttachingToWebProcess(IsProcessSwap::No);
+    finishAttachingToWebProcess(reason);
 }
 
 bool WebPageProxy::suspendCurrentPageIfPossible(API::Navigation& navigation, Optional<FrameIdentifier> mainFrameID, ProcessSwapRequestedByClient processSwapRequestedByClient, ShouldDelayClosingUntilEnteringAcceleratedCompositingMode shouldDelayClosingUntilEnteringAcceleratedCompositingMode)
@@ -813,10 +813,10 @@
     m_process->addExistingWebPage(*this, WebProcessProxy::BeginsUsingDataStore::No);
     m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID, *this);
 
-    finishAttachingToWebProcess(IsProcessSwap::Yes);
+    finishAttachingToWebProcess(ProcessLaunchReason::ProcessSwap);
 }
 
-void WebPageProxy::finishAttachingToWebProcess(IsProcessSwap isProcessSwap)
+void WebPageProxy::finishAttachingToWebProcess(ProcessLaunchReason reason)
 {
     ASSERT(m_process->state() != AuxiliaryProcessProxy::State::Terminated);
 
@@ -826,7 +826,7 @@
     didAttachToRunningProcess();
 
     // In the process-swap case, the ProvisionalPageProxy already took care of initializing the WebPage in the WebProcess.
-    if (isProcessSwap != IsProcessSwap::Yes)
+    if (reason != ProcessLaunchReason::ProcessSwap)
         initializeWebPage();
 
     m_inspector->updateForNewPageProcess(this);
@@ -840,7 +840,8 @@
 
     pageClient().didRelaunchProcess();
     m_pageLoadState.didSwapWebProcesses();
-    m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
+    if (reason != ProcessLaunchReason::InitialProcess)
+        m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
 }
 
 void WebPageProxy::didAttachToRunningProcess()
@@ -890,7 +891,7 @@
     
     ASSERT(!hasRunningProcess());
     auto registrableDomain = m_backForwardList->currentItem() ? RegistrableDomain { URL(URL(), m_backForwardList->currentItem()->url()) } : RegistrableDomain { };
-    launchProcess(registrableDomain);
+    launchProcess(registrableDomain, ProcessLaunchReason::Crash);
 
     if (!m_backForwardList->currentItem()) {
         RELEASE_LOG_IF_ALLOWED(Loading, "launchProcessForReload: no current item to reload: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID.toUInt64());
@@ -922,7 +923,7 @@
     }
 
     ASSERT(!hasRunningProcess());
-    launchProcess(RegistrableDomain { URL(URL(), item.url()) });
+    launchProcess(RegistrableDomain { URL(URL(), item.url()) }, ProcessLaunchReason::InitialProcess);
 
     if (&item != m_backForwardList->currentItem())
         m_backForwardList->goToItem(item);
@@ -1108,7 +1109,7 @@
 WebProcessProxy& WebPageProxy::ensureRunningProcess()
 {
     if (!hasRunningProcess())
-        launchProcess({ });
+        launchProcess({ }, ProcessLaunchReason::InitialProcess);
 
     return m_process;
 }
@@ -1121,7 +1122,7 @@
     RELEASE_LOG_IF_ALLOWED(Loading, "loadRequest: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID.toUInt64());
 
     if (!hasRunningProcess())
-        launchProcess(RegistrableDomain { request.url() });
+        launchProcess(RegistrableDomain { request.url() }, ProcessLaunchReason::InitialProcess);
 
     auto navigation = m_navigationState->createLoadRequestNavigation(ResourceRequest(request), m_backForwardList->currentItem());
     loadRequestWithNavigationShared(m_process.copyRef(), navigation.get(), WTFMove(request), shouldOpenExternalURLsPolicy, userData, ShouldTreatAsContinuingLoad::No);
@@ -1168,7 +1169,7 @@
     }
 
     if (!hasRunningProcess())
-        launchProcess({ });
+        launchProcess({ }, ProcessLaunchReason::InitialProcess);
 
     URL fileURL = URL(URL(), fileURLString);
     if (!fileURL.isLocalFile()) {
@@ -1223,7 +1224,7 @@
     }
 
     if (!hasRunningProcess())
-        launchProcess({ });
+        launchProcess({ }, ProcessLaunchReason::InitialProcess);
 
     auto navigation = m_navigationState->createLoadDataNavigation(makeUnique<API::SubstituteData>(data.vector(), MIMEType, encoding, baseURL, userData));
     loadDataWithNavigationShared(m_process.copyRef(), navigation, data, MIMEType, encoding, baseURL, userData, ShouldTreatAsContinuingLoad::No, WTF::nullopt, shouldOpenExternalURLsPolicy);
@@ -1273,7 +1274,7 @@
         m_isLoadingAlternateHTMLStringForFailingProvisionalLoad = true;
 
     if (!hasRunningProcess())
-        launchProcess(RegistrableDomain { baseURL });
+        launchProcess(RegistrableDomain { baseURL }, ProcessLaunchReason::InitialProcess);
 
     auto transaction = m_pageLoadState.transaction();
 
@@ -1310,7 +1311,7 @@
     }
 
     if (!hasRunningProcess())
-        launchProcess({ });
+        launchProcess({ }, ProcessLaunchReason::InitialProcess);
 
     auto transaction = m_pageLoadState.transaction();
     m_pageLoadState.setPendingAPIRequest(transaction, { 0, WTF::blankURL().string() });
@@ -1340,7 +1341,7 @@
         return;
 
     if (!hasRunningProcess())
-        launchProcess(RegistrableDomain { URL(URL(), urlString) });
+        launchProcess(RegistrableDomain { URL(URL(), urlString) }, ProcessLaunchReason::InitialProcess);
 
     m_process->send(Messages::WebPage::NavigateToPDFLinkWithSimulatedClick(urlString, documentPoint, screenPoint), m_pageID);
     m_process->responsivenessTimer().start();
@@ -3649,7 +3650,7 @@
 void WebPageProxy::launchInitialProcessIfNecessary()
 {
     if (&process() == process().processPool().dummyProcessProxy())
-        launchProcess({ });
+        launchProcess({ }, ProcessLaunchReason::InitialProcess);
 }
 
 void WebPageProxy::runJavaScriptInMainFrame(const String& script, bool forceUserGesture, WTF::Function<void (API::SerializedScriptValue*, bool hadException, const ExceptionDetails&, CallbackBase::Error)>&& callbackFunction)

Modified: releases/WebKitGTK/webkit-2.26/Source/WebKit/UIProcess/WebPageProxy.h (250208 => 250209)


--- releases/WebKitGTK/webkit-2.26/Source/WebKit/UIProcess/WebPageProxy.h	2019-09-23 08:39:08 UTC (rev 250208)
+++ releases/WebKitGTK/webkit-2.26/Source/WebKit/UIProcess/WebPageProxy.h	2019-09-23 08:39:11 UTC (rev 250209)
@@ -1731,14 +1731,18 @@
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
     void setCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents) { m_canShortCircuitHorizontalWheelEvents = canShortCircuitHorizontalWheelEvents; }
 
-    void launchProcess(const WebCore::RegistrableDomain&);
+    enum class ProcessLaunchReason {
+        InitialProcess,
+        ProcessSwap,
+        Crash
+    };
+
+    void launchProcess(const WebCore::RegistrableDomain&, ProcessLaunchReason);
     void swapToWebProcess(Ref<WebProcessProxy>&&, std::unique_ptr<DrawingAreaProxy>&&, RefPtr<WebFrameProxy>&& mainFrame);
     void didFailToSuspendAfterProcessSwap();
     void didSuspendAfterProcessSwap();
+    void finishAttachingToWebProcess(ProcessLaunchReason);
 
-    enum class IsProcessSwap { No, Yes };
-    void finishAttachingToWebProcess(IsProcessSwap);
-
     RefPtr<API::Navigation> launchProcessForReload();
     RefPtr<API::Navigation> launchProcessWithItem(WebBackForwardListItem&);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to