Make back forward cache work with process swapping.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Apr 2018 04:55:32 +0000 (04:55 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Apr 2018 04:55:32 +0000 (04:55 +0000)
commitbb7a83b6135fccf3e71eb9da651b3a46bcaaaf56
tree346f67146554002b91d58e5c1b993b06fe2c5203
parent1f174f758647cdfdcd67a28f3195b84aab6baaa8
Make back forward cache work with process swapping.
<rdar://problem/38676604> and https://bugs.webkit.org/show_bug.cgi?id=184793

Reviewed by Chris Dumez.

Source/WebCore:

Covered by API tests.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadWithNavigationAction):
(WebCore::FrameLoader::load):
(WebCore::FrameLoader::loadWithDocumentLoader):
(WebCore::FrameLoader::reloadWithOverrideEncoding):
(WebCore::FrameLoader::reload):
(WebCore::FrameLoader::commitProvisionalLoad):
(WebCore::FrameLoader::loadDifferentDocumentItem):
* loader/FrameLoader.h:

Source/WebKit:

We previously saved old processes in "SuspendedPageProxy" objects.
Now we reuse them when going back or forward.

* Platform/Logging.h:

* Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::setSuspendedPage):
(WebKit::WebBackForwardListItem::loggingString):
* Shared/WebBackForwardListItem.h:
(WebKit::WebBackForwardListItem::suspendedPage const):

Teach Navigation objects their source WebBackForwardListItems:
* UIProcess/API/APINavigation.cpp:
(API::Navigation::Navigation):
(API::Navigation::loggingString const):
* UIProcess/API/APINavigation.h:
(API::Navigation::create):
(API::Navigation::targetItem const):
(API::Navigation::fromItem const):
(API::Navigation::backForwardListItem): Deleted.

* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):

* UIProcess/SuspendedPageProxy.cpp:
(WebKit::messageNamesToIgnoreWhileSuspended):
(WebKit::SuspendedPageProxy::SuspendedPageProxy):
(WebKit::SuspendedPageProxy::~SuspendedPageProxy):
(WebKit::SuspendedPageProxy::webProcessDidClose):
(WebKit::SuspendedPageProxy::didReceiveMessage):
(WebKit::SuspendedPageProxy::loggingString const):
* UIProcess/SuspendedPageProxy.h:
(WebKit::SuspendedPageProxy::origin const):

* UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::WebBackForwardList):
(WebKit::WebBackForwardList::~WebBackForwardList):
(WebKit::WebBackForwardList::pageClosed):
(WebKit::WebBackForwardList::addItem):
(WebKit::WebBackForwardList::goToItem):
(WebKit::WebBackForwardList::removeAllItems):
(WebKit::WebBackForwardList::clear):
(WebKit::WebBackForwardList::restoreFromState):
(WebKit::WebBackForwardList::filteredItemStates const):
(WebKit::WebBackForwardList::itemStates const):
(WebKit::WebBackForwardList::loggingString):
* UIProcess/WebBackForwardList.h:

* UIProcess/WebNavigationState.cpp:
(WebKit::WebNavigationState::createLoadRequestNavigation):
(WebKit::WebNavigationState::createBackForwardNavigation):
* UIProcess/WebNavigationState.h:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::reattachToWebProcess):
(WebKit::WebPageProxy::maybeCreateSuspendedPage):
(WebKit::WebPageProxy::reattachToWebProcessWithItem):
(WebKit::WebPageProxy::loadRequest):
(WebKit::WebPageProxy::loadFile):
(WebKit::WebPageProxy::goToBackForwardItem):
(WebKit::WebPageProxy::receivedPolicyDecision):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::didCreateMainFrame):
(WebKit::WebPageProxy::didCreateSubframe):
(WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
(WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::connectionWillOpen):
(WebKit::WebPageProxy::attachToProcessForNavigation): Deleted.
* UIProcess/WebPageProxy.h:

* UIProcess/WebProcessLifetimeTracker.cpp:
(WebKit::WebProcessLifetimeTracker::webPageEnteringWebProcess):
(WebKit::WebProcessLifetimeTracker::connectionWillOpen): Deleted.
* UIProcess/WebProcessLifetimeTracker.h:

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigation):
(WebKit::WebProcessPool::registerSuspendedPageProxy):
(WebKit::WebProcessPool::unregisterSuspendedPageProxy):
* UIProcess/WebProcessPool.h:

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::suspendWebPageProxy):
(WebKit::WebProcessProxy::updateBackForwardItem):
(WebKit::WebProcessProxy::frameCreated):
* UIProcess/WebProcessProxy.h:

* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::attachDrawingArea):

* WebProcess/WebPage/WebBackForwardListProxy.cpp:
(WebKit::WebBackForwardListProxy::addItemFromUIProcess):
(WebKit::WebBackForwardListProxy::addItem):
* WebProcess/WebPage/WebBackForwardListProxy.h:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_credentialsMessenger):
(WebKit::WebPage::reinitializeWebPage):
(WebKit::WebPage::goToBackForwardItem):
(WebKit::WebPage::restoreSessionInternal):
(WebKit::WebPage::restoreSession):
(WebKit::WebPage::updateBackForwardListForReattach):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Force a reattachment of the drawing
  area from a resumed WebProcess to the UIProcess (to make the page cache work)

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230834 268f45cc-cd09-0410-ab3c-d52691b4dbfc
34 files changed:
Source/WebCore/ChangeLog
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/FrameLoader.h
Source/WebKit/ChangeLog
Source/WebKit/Platform/Logging.h
Source/WebKit/Shared/WebBackForwardListItem.cpp
Source/WebKit/Shared/WebBackForwardListItem.h
Source/WebKit/UIProcess/API/APINavigation.cpp
Source/WebKit/UIProcess/API/APINavigation.h
Source/WebKit/UIProcess/Cocoa/NavigationState.mm
Source/WebKit/UIProcess/SuspendedPageProxy.cpp
Source/WebKit/UIProcess/SuspendedPageProxy.h
Source/WebKit/UIProcess/WebBackForwardList.cpp
Source/WebKit/UIProcess/WebBackForwardList.h
Source/WebKit/UIProcess/WebNavigationState.cpp
Source/WebKit/UIProcess/WebNavigationState.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebProcessLifetimeTracker.cpp
Source/WebKit/UIProcess/WebProcessLifetimeTracker.h
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/WebProcessProxy.cpp
Source/WebKit/UIProcess/WebProcessProxy.h
Source/WebKit/WebProcess/WebPage/DrawingArea.h
Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp
Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm