Changeset 249953 in webkit


Ignore:
Timestamp:
Sep 17, 2019 4:05:00 AM (5 years ago)
Author:
Carlos Garcia Campos
Message:

[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.

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r249952 r249953  
     12019-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Initial view loading is slow
     4        https://bugs.webkit.org/show_bug.cgi?id=201451
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        The problem is that now we are always calling DrawingAreaProxy::waitForBackingStoreUpdateOnNextPaint() after a
     9        new process is launched and we used to do that only when launching a new process after a crash. This makes
     10        m_hasReceivedFirstUpdate useless, because it's always set to true right after a process is launched. Then, we
     11        wait up to half a second (which is usually the case for the initial load) until the first update. We only want
     12        to do that when recovering from a crash or when swapping processes to avoid flashing effect.
     13
     14        * UIProcess/WebPageProxy.cpp:
     15        (WebKit::WebPageProxy::launchProcess): Add ProcessLaunchReason parameter and pass it to
     16        finishAttachingToWebProcess instead of IsProcessSwap.
     17        (WebKit::WebPageProxy::swapToWebProcess): Pass ProcessLaunchReason::ProcessSwap to
     18        finishAttachingToWebProcess().
     19        (WebKit::WebPageProxy::finishAttachingToWebProcess): Do not call
     20        DrawingAreaProxy::waitForBackingStoreUpdateOnNextPaint() when process launch reason is ProcessLaunchReason::InitialProcess.
     21        (WebKit::WebPageProxy::launchProcessForReload): Pass ProcessLaunchReason::Reload to launchProcess().
     22        * UIProcess/WebPageProxy.h: Remove IsProcessSwap and add ProcessLaunchReason instead that is passed to
     23        launchProcess and finishAttachingToWebProcess.
     24
    1252019-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
    226
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r249942 r249953  
    723723}
    724724
    725 void WebPageProxy::launchProcess(const RegistrableDomain& registrableDomain)
     725void WebPageProxy::launchProcess(const RegistrableDomain& registrableDomain, ProcessLaunchReason reason)
    726726{
    727727    ASSERT(!m_isClosed);
     
    745745    m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_webPageID, *this);
    746746
    747     finishAttachingToWebProcess(IsProcessSwap::No);
     747    finishAttachingToWebProcess(reason);
    748748}
    749749
     
    819819    m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_webPageID, *this);
    820820
    821     finishAttachingToWebProcess(IsProcessSwap::Yes);
    822 }
    823 
    824 void WebPageProxy::finishAttachingToWebProcess(IsProcessSwap isProcessSwap)
     821    finishAttachingToWebProcess(ProcessLaunchReason::ProcessSwap);
     822}
     823
     824void WebPageProxy::finishAttachingToWebProcess(ProcessLaunchReason reason)
    825825{
    826826    ASSERT(m_process->state() != AuxiliaryProcessProxy::State::Terminated);
     
    832832
    833833    // In the process-swap case, the ProvisionalPageProxy already took care of initializing the WebPage in the WebProcess.
    834     if (isProcessSwap != IsProcessSwap::Yes)
     834    if (reason != ProcessLaunchReason::ProcessSwap)
    835835        initializeWebPage();
    836836
     
    846846    pageClient().didRelaunchProcess();
    847847    m_pageLoadState.didSwapWebProcesses();
    848     m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
     848    if (reason != ProcessLaunchReason::InitialProcess)
     849        m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
    849850}
    850851
     
    896897    ASSERT(!hasRunningProcess());
    897898    auto registrableDomain = m_backForwardList->currentItem() ? RegistrableDomain { URL(URL(), m_backForwardList->currentItem()->url()) } : RegistrableDomain { };
    898     launchProcess(registrableDomain);
     899    launchProcess(registrableDomain, ProcessLaunchReason::Crash);
    899900
    900901    if (!m_backForwardList->currentItem()) {
     
    928929
    929930    ASSERT(!hasRunningProcess());
    930     launchProcess(RegistrableDomain { URL(URL(), item.url()) });
     931    launchProcess(RegistrableDomain { URL(URL(), item.url()) }, ProcessLaunchReason::InitialProcess);
    931932
    932933    if (&item != m_backForwardList->currentItem())
     
    11291130{
    11301131    if (!hasRunningProcess())
    1131         launchProcess({ });
     1132        launchProcess({ }, ProcessLaunchReason::InitialProcess);
    11321133
    11331134    return m_process;
     
    11421143
    11431144    if (!hasRunningProcess())
    1144         launchProcess(RegistrableDomain { request.url() });
     1145        launchProcess(RegistrableDomain { request.url() }, ProcessLaunchReason::InitialProcess);
    11451146
    11461147    auto navigation = m_navigationState->createLoadRequestNavigation(ResourceRequest(request), m_backForwardList->currentItem());
     
    12051206
    12061207    if (!hasRunningProcess())
    1207         launchProcess({ });
     1208        launchProcess({ }, ProcessLaunchReason::InitialProcess);
    12081209
    12091210    URL fileURL = URL(URL(), fileURLString);
     
    12681269
    12691270    if (!hasRunningProcess())
    1270         launchProcess({ });
     1271        launchProcess({ }, ProcessLaunchReason::InitialProcess);
    12711272
    12721273    auto navigation = m_navigationState->createLoadDataNavigation(makeUnique<API::SubstituteData>(data.vector(), MIMEType, encoding, baseURL, userData));
     
    13181319
    13191320    if (!hasRunningProcess())
    1320         launchProcess(RegistrableDomain { baseURL });
     1321        launchProcess(RegistrableDomain { baseURL }, ProcessLaunchReason::InitialProcess);
    13211322
    13221323    auto transaction = m_pageLoadState.transaction();
     
    13551356
    13561357    if (!hasRunningProcess())
    1357         launchProcess({ });
     1358        launchProcess({ }, ProcessLaunchReason::InitialProcess);
    13581359
    13591360    auto transaction = m_pageLoadState.transaction();
     
    13851386
    13861387    if (!hasRunningProcess())
    1387         launchProcess(RegistrableDomain { URL(URL(), urlString) });
     1388        launchProcess(RegistrableDomain { URL(URL(), urlString) }, ProcessLaunchReason::InitialProcess);
    13881389
    13891390    m_process->send(Messages::WebPage::NavigateToPDFLinkWithSimulatedClick(urlString, documentPoint, screenPoint), m_webPageID);
     
    36893690{
    36903691    if (&process() == process().processPool().dummyProcessProxy())
    3691         launchProcess({ });
     3692        launchProcess({ }, ProcessLaunchReason::InitialProcess);
    36923693}
    36933694
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r249891 r249953  
    17481748    void setCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents) { m_canShortCircuitHorizontalWheelEvents = canShortCircuitHorizontalWheelEvents; }
    17491749
    1750     void launchProcess(const WebCore::RegistrableDomain&);
     1750    enum class ProcessLaunchReason {
     1751        InitialProcess,
     1752        ProcessSwap,
     1753        Crash
     1754    };
     1755
     1756    void launchProcess(const WebCore::RegistrableDomain&, ProcessLaunchReason);
    17511757    void swapToWebProcess(Ref<WebProcessProxy>&&, WebCore::PageIdentifier, std::unique_ptr<DrawingAreaProxy>&&, RefPtr<WebFrameProxy>&& mainFrame);
    17521758    void didFailToSuspendAfterProcessSwap();
    17531759    void didSuspendAfterProcessSwap();
    1754 
    1755     enum class IsProcessSwap { No, Yes };
    1756     void finishAttachingToWebProcess(IsProcessSwap);
     1760    void finishAttachingToWebProcess(ProcessLaunchReason);
    17571761
    17581762    RefPtr<API::Navigation> launchProcessForReload();
Note: See TracChangeset for help on using the changeset viewer.