Summary: | Open WebSockets should not prevent a page from entering PageCache | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Chris Dumez <cdumez> | ||||
Component: | WebCore Misc. | Assignee: | Chris Dumez <cdumez> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | ap, barraclough, commit-queue, kling | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=142612 | ||||||
Bug Depends on: | 143806 | ||||||
Bug Blocks: | |||||||
Attachments: |
|
Description
Chris Dumez
2015-04-07 17:18:19 PDT
Created attachment 250319 [details]
Patch
Comment on attachment 250319 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=250319&action=review > Source/WebCore/Modules/websockets/WebSocket.cpp:481 > + m_channel->suspend(); Is DocumentWillBecomeInactive the only reason for which canSuspend is respected, or are you changing the behavior for other suspension reasons too? If the latter, how did you confirm that it's right? Comment on attachment 250319 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=250319&action=review >> Source/WebCore/Modules/websockets/WebSocket.cpp:481 >> + m_channel->suspend(); > > Is DocumentWillBecomeInactive the only reason for which canSuspend is respected, or are you changing the behavior for other suspension reasons too? If the latter, how did you confirm that it's right? I am not changing the behavior for other suspensions than page cache as far as I know. canSuspend() is only called from ScriptExecutionContext::canSuspendActiveDOMObjects(), which is only called from PageCache::canCachePageContainingThisFrame(). When PageCache::canCache() returns true, we call PageCache::add() which constructs a CachedPage and CachedFrame. In the CachedFrame constructor, we call Document::suspendActiveDOMObjects(ActiveDOMObject::DocumentWillBecomeInactive); This is the only place this ReasonForSuspension is used. Also note the following comment in ActiveDOMObject.h: virtual bool canSuspend() const = 0; // Returning false in canSuspend() will prevent the page from entering the PageCache. This time the comment seems accurate :) Makes sense! We should upgrade the comment to a function name (something like canSuspendForPageCache). And ActiveDOMObject::DocumentWillBecomeInactive is a suspicious name too. (In reply to comment #4) > Makes sense! We should upgrade the comment to a function name (something > like canSuspendForPageCache). And > ActiveDOMObject::DocumentWillBecomeInactive is a suspicious name too. Good idea, I'll do the renaming in a follow-up patch. Comment on attachment 250319 [details] Patch Clearing flags on attachment: 250319 Committed r182517: <http://trac.webkit.org/changeset/182517> All reviewed patches have been landed. Closing bug. |