Suspended page persists even after back/forward list item is gone
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Nov 2018 00:24:08 +0000 (00:24 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Nov 2018 00:24:08 +0000 (00:24 +0000)
commit4b639c723ea5293faf3eb26f68d47ae03a2cca69
tree3159e757e55fbe3065f9e7220b1ab31430b04e4d
parent48bc5d10c20ad560d7f32dcd4439db29fd6bbe1c
Suspended page persists even after back/forward list item is gone
https://bugs.webkit.org/show_bug.cgi?id=191488
<rdar://problem/45953006>

Reviewed by Geoffrey Garen.

Source/WebKit:

Currently, the WebProcessPool owns the SuspendedPageProxy objects and makes sure we cap how
many we can have. The WebBackForwardListItem merely has a WeakPtr to its associated
SuspendedPageProxy. However, there is no point in having the WebProcessPool keeping a
SuspendedPageProxy object alive if there is no longer any WebBackForwardListItem pointing
to it.

To address the issue, WebBackForwardListItem nows tells the WebProcessPool to destroy
its SuspendedPageProxy when necessary. WebBackForwardList also takes care of nulling
out the WebBackForwardListItem's SuspendedPageProxy after the item has been removed
from the list (in case somebody keeps the item alive).

* Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::~WebBackForwardListItem):
(WebKit::WebBackForwardListItem::setSuspendedPage):
(WebKit::WebBackForwardListItem::suspendedPageIsNoLongerNeeded):
* Shared/WebBackForwardListItem.h:
* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::SuspendedPageProxy):
* UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::didRemoveItem):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::removeSuspendedPageProxy):
* UIProcess/WebProcessPool.h:

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

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