Bug 192668

Summary: [PSON] We should not need to navigate to 'about:blank' to suspend pages
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, commit-queue, dbates, ews-watchlist, ggaren, japhet, koivisto, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 192772, 193224    
Bug Blocks:    
Attachments:
Description Flags
WIP Patch
none
Patch
none
Patch none

Chris Dumez
Reported 2018-12-13 10:09:37 PST
We should not need to navigate to 'about:blank' to suspend pages to support PageCache when PSON is enabled.
Attachments
WIP Patch (16.31 KB, patch)
2018-12-13 10:54 PST, Chris Dumez
no flags
Patch (27.70 KB, patch)
2018-12-13 12:33 PST, Chris Dumez
no flags
Patch (31.59 KB, patch)
2018-12-13 13:58 PST, Chris Dumez
no flags
Radar WebKit Bug Importer
Comment 1 2018-12-13 10:35:56 PST
Chris Dumez
Comment 2 2018-12-13 10:54:45 PST
Created attachment 357238 [details] WIP Patch
EWS Watchlist
Comment 3 2018-12-13 10:56:46 PST
Attachment 357238 [details] did not pass style-queue: ERROR: Source/WebKit/WebProcess/WebPage/WebDocumentLoader.cpp:53: Should have a space between // and comment [whitespace/comments] [4] ERROR: Source/WebKit/WebProcess/WebPage/WebPage.cpp:1333: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Total errors found: 2 in 16 files If any of these errors are false positives, please file a bug against check-webkit-style.
Chris Dumez
Comment 4 2018-12-13 12:33:32 PST
Chris Dumez
Comment 5 2018-12-13 13:58:00 PST
WebKit Commit Bot
Comment 6 2018-12-13 15:17:53 PST
Comment on attachment 357251 [details] Patch Clearing flags on attachment: 357251 Committed r239182: <https://trac.webkit.org/changeset/239182>
WebKit Commit Bot
Comment 7 2018-12-13 15:17:54 PST
All reviewed patches have been landed. Closing bug.
Antti Koivisto
Comment 8 2018-12-14 05:18:33 PST
Comment on attachment 357251 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=357251&action=review Nice! > Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:-739 > - if (request.url() == WTF::blankURL() && webPage->isSuspended()) { Does isSuspended bit on WebPage have any clients after this? Maybe it is not even needed anymore? > Source/WebKit/WebProcess/WebPage/WebPage.cpp:1331 > + if (!PageCache::singleton().addIfCacheable(*currentHistoryItem, corePage())) { > + failedToSuspend(); > + return; > + } So this leaves us in a new type of state where we the current page is moved to page cache but we haven't navigated anywhere. I suppose that is ok. Does failedToSuspend() throws away the process? Could we just close the page when caching fails but keep the process around (since it has useful caches etc for back navigation)?
Chris Dumez
Comment 9 2018-12-14 08:43:23 PST
(In reply to Antti Koivisto from comment #8) > Comment on attachment 357251 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=357251&action=review > > Nice! > > > Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:-739 > > - if (request.url() == WTF::blankURL() && webPage->isSuspended()) { > > Does isSuspended bit on WebPage have any clients after this? Maybe it is not > even needed anymore? There is still one call site: bool WebProcess::hasPageRequiringPageCacheWhileSuspended() const { for (auto& page : m_pageMap.values()) { if (page->isSuspended()) return true; } return false; } We need to know a page is suspended for process-swap when the process actually gets suspended on iOS to avoid clearing the PageCache. > > > Source/WebKit/WebProcess/WebPage/WebPage.cpp:1331 > > + if (!PageCache::singleton().addIfCacheable(*currentHistoryItem, corePage())) { > > + failedToSuspend(); > > + return; > > + } > > So this leaves us in a new type of state where we the current page is moved > to page cache but we haven't navigated anywhere. I suppose that is ok. Yes, it is kind of a new state but it seems to work OK, and navigating to the current history item works fine too and restores it from PageCache. > > Does failedToSuspend() throws away the process? Could we just close the page > when caching fails but keep the process around (since it has useful caches > etc for back navigation)? Yes, I am not keeping the process around anymore if page cache fails. I have discussed this with Brady and Geoff as well. If it turns out to be an issue, then we can do better and cache processes. It is not quite as easy as it sounds though because if you re-attach to a process that used to have a WebPage with your ID, you may get leftover IPC from the previous page when you reconnect and it would trigger MESSAGE_CHECK failures in the UIProcess. So we'd still need some kind of handshake like Close -> DoneClosing before we would be able to reuse the process.
Antti Koivisto
Comment 10 2018-12-14 12:08:51 PST
> Yes, I am not keeping the process around anymore if page cache fails. I have > discussed this with Brady and Geoff as well. > If it turns out to be an issue, then we can do better and cache processes. > It is not quite as easy as it sounds though because > if you re-attach to a process that used to have a WebPage with your ID, you > may get leftover IPC from the previous page when > you reconnect and it would trigger MESSAGE_CHECK failures in the UIProcess. > So we'd still need some kind of handshake like > Close -> DoneClosing before we would be able to reuse the process. Makes sense. A suspended page is always in this specific page cache-like state. A hypothetical per-domain process cache would handle other cases.
Note You need to log in before you can comment on or make changes to this bug.