[PSON] Flash on back navigation on Mac
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jan 2019 18:35:05 +0000 (18:35 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jan 2019 18:35:05 +0000 (18:35 +0000)
commit2dd8e1e9d7efaaf1d9bc49f637176fc7bcf4426e
tree57562dcb6480c1e8755775a7b52ea5033d4865d3
parenta986f618828824142ecb53da8111af2751de3f25
[PSON] Flash on back navigation on Mac
https://bugs.webkit.org/show_bug.cgi?id=193716
<rdar://problem/47148458>

Reviewed by Chris Dumez.

Source/WebKit:

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

* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::~SuspendedPageProxy):
(WebKit::SuspendedPageProxy::close):

Track closed state so we don't send the message twice, causing unhandled message errors in web process.

(WebKit::SuspendedPageProxy::didProcessRequestToSuspend):

Close the suspended page if the suspension fails.
Skip this if we are using web process side compositing on Mac.

* UIProcess/SuspendedPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::enterAcceleratedCompositingMode):

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

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::closeFailedSuspendedPagesForPage):
* UIProcess/WebProcessPool.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::suspendForProcessSwap):

Don't close the page on suspension failure. This is now managed by the UI process.

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

Closing of the previous page is delayed so waiting for didFinishNavigation is
not sufficient to guarantee we have received all the messages. Wait for them.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240443 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/SuspendedPageProxy.cpp
Source/WebKit/UIProcess/SuspendedPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm