Changeset 240343 in webkit


Ignore:
Timestamp:
Jan 23, 2019 9:43:02 AM (5 years ago)
Author:
Antti Koivisto
Message:

[PSON] Flash on back navigation on Mac
https://bugs.webkit.org/show_bug.cgi?id=193716
<rdar://problem/47148458>

Reviewed by Chris Dumez.

We close the page immediately if we fail to suspend. Layers disappear and we get a flash.

  • UIProcess/SuspendedPageProxy.cpp:

(WebKit::SuspendedPageProxy::didProcessRequestToSuspend):

Remove the suspended page (so closing it on web process side) if the suspension fails.
Skip this if we are using web process side compositing on Mac.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::enterAcceleratedCompositingMode):

On Mac, remove failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive.

  • UIProcess/WebProcessPool.cpp:

(WebKit::WebProcessPool::removeFailedSuspendedPagesForPage):

  • UIProcess/WebProcessPool.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::suspendForProcessSwap):

Don't close the page on suspension failure.

Location:
trunk/Source/WebKit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r240342 r240343  
     12019-01-23  Antti Koivisto  <antti@apple.com>
     2
     3        [PSON] Flash on back navigation on Mac
     4        https://bugs.webkit.org/show_bug.cgi?id=193716
     5        <rdar://problem/47148458>
     6
     7        Reviewed by Chris Dumez.
     8
     9        We close the page immediately if we fail to suspend. Layers disappear and we get a flash.
     10
     11        * UIProcess/SuspendedPageProxy.cpp:
     12        (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
     13
     14        Remove the suspended page (so closing it on web process side) if the suspension fails.
     15        Skip this if we are using web process side compositing on Mac.
     16
     17        * UIProcess/WebPageProxy.cpp:
     18        (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
     19
     20        On Mac, remove failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive.
     21
     22        * UIProcess/WebProcessPool.cpp:
     23        (WebKit::WebProcessPool::removeFailedSuspendedPagesForPage):
     24        * UIProcess/WebProcessPool.h:
     25        * WebProcess/WebPage/WebPage.cpp:
     26        (WebKit::WebPage::suspendForProcessSwap):
     27
     28        Don't close the page on suspension failure.
     29
    1302019-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
    231
  • trunk/Source/WebKit/UIProcess/SuspendedPageProxy.cpp

    r240046 r240343  
    2727#include "SuspendedPageProxy.h"
    2828
     29#include "DrawingAreaProxy.h"
    2930#include "Logging.h"
    3031#include "WebPageMessages.h"
     
    155156    m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_page.pageID());
    156157
     158    bool shouldKeepOnFailure = false;
     159#if PLATFORM(MAC)
     160    // With web process side tiles, we need to keep the suspended page around on failure to avoid flashing.
     161    // It is removed by WebPageProxy::enterAcceleratedCompositingMode when the target page is ready.
     162    shouldKeepOnFailure = m_page.drawingArea() && m_page.drawingArea()->type() == DrawingAreaTypeTiledCoreAnimation;
     163#endif
     164    if (newSuspensionState == SuspensionState::FailedToSuspend && !shouldKeepOnFailure) {
     165        RunLoop::main().dispatch([weakProcessPool = makeWeakPtr(m_process->processPool()), weakThis = makeWeakPtr(*this)] {
     166            if (weakProcessPool && weakThis)
     167                weakProcessPool->removeSuspendedPage(*weakThis);
     168        });
     169    }
     170
    157171    if (m_readyToUnsuspendHandler)
    158172        m_readyToUnsuspendHandler(this);
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r240342 r240343  
    68486848void WebPageProxy::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
    68496849{
     6850#if PLATFORM(MAC)
     6851    ASSERT(m_drawingArea->type() == DrawingAreaTypeTiledCoreAnimation);
     6852#endif
    68506853    pageClient().enterAcceleratedCompositingMode(layerTreeContext);
     6854    // We needed the failed suspended page to stay alive to avoid flashing. Now we can get rid of it.
     6855    m_process->processPool().removeFailedSuspendedPagesForPage(*this);
    68516856}
    68526857
  • trunk/Source/WebKit/UIProcess/WebProcessPool.cpp

    r240292 r240343  
    22712271}
    22722272
     2273void WebProcessPool::removeFailedSuspendedPagesForPage(WebPageProxy& page)
     2274{
     2275    m_suspendedPages.removeAllMatching([&page](auto& suspendedPage) {
     2276        return &suspendedPage->page() == &page && suspendedPage->failedToSuspend();
     2277    });
     2278}
     2279
    22732280std::unique_ptr<SuspendedPageProxy> WebProcessPool::takeSuspendedPage(SuspendedPageProxy& suspendedPage)
    22742281{
  • trunk/Source/WebKit/UIProcess/WebProcessPool.h

    r239535 r240343  
    451451    void addSuspendedPage(std::unique_ptr<SuspendedPageProxy>&&);
    452452    void removeAllSuspendedPagesForPage(WebPageProxy&);
     453    void removeFailedSuspendedPagesForPage(WebPageProxy&);
    453454    std::unique_ptr<SuspendedPageProxy> takeSuspendedPage(SuspendedPageProxy&);
    454455    void removeSuspendedPage(SuspendedPageProxy&);
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r240298 r240343  
    13411341{
    13421342    auto failedToSuspend = [this, protectedThis = makeRef(*this)] {
    1343         close();
    13441343        send(Messages::WebPageProxy::DidFailToSuspendAfterProcessSwap());
    13451344    };
Note: See TracChangeset for help on using the changeset viewer.