This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
Tab content should be discarded when memory usage is too high #13210
Labels
initiative/perf
priority/P1
Blocks development or testing. Product cannot run. Must be fixed immediately, shipped next release.
QA/checked-Linux
QA/checked-macOS
QA/checked-Win64
QA/test-plan-specified
release-notes/include
Milestone
Description
Muon / Chromium has a feature whereby a tab's contents will be disposed and the memory freed when under memory pressure.
This was previously enabled, but disabled in #12916 due to #10673.
However, performance is hindered by not having tabs discarded, so we should do two things:
a. The ability to switch to and away from discarded tabs
b. The ability to detach previously-discarded tabs
This issue tracks both the re-enabling of the feature and the fixing of the underlying issues which led to the feature being disabled.
Prerequisites
TabState is not updated for the new discarded WebContents. This happens in
add-new-contents
event which isn't received for discarded replacement WebContents. Therefore if the window has 2 tabs, one being discarded, the state reports 1 tab and the detach will not be allowed.Status: Issue Implement chrome.tabs.onReplaced.addEventListener muon#487. Muon tab event
tab-replaced-at
implemented in Fix/tabs discard dead tab muon#504When a discarded tab is detached, it seems to be destroyed immediately, and the 'did-detach' event never fires. Therefore the handler which adds the frame to the new window never fires. Even if the handler is forced to run, the tab in the new window is dead, since it has been destroyed.
Status: Issue Tab is destroyed when detached if it has previously been discarded muon#496. Fix in Fix/tabs discard dead tab muon#504
When a discarded tab is detached, attached to a new window, and loaded, it does not remember its scroll position. The new webview has a src element (unlike when detaching and attaching non-discarded tabs) even though browser-laptop is not setting it, but does use the existing tabId.
New muon version with above changes integrated with browser-laptop
Steps to Reproduce
The problems with tab discarding can be viewed with the new Debug menu option 'Allow manual tab discarding'
Please turn off the preference for tab previews whilst testing!
Tab discarding works
Actual result:
Cannot switch to tab
Expected result:
Tab is made active and tab's contents are loaded again
Tab detaching works
Actual result:
Tab either disappears or attaches to a new window but is blank and not loadable / useable.
Expected result:
Tab detaches to a new window with its contents intact.
Tab detaching after reloading after discarding works 😮
Actual result:
Tab either disappears or attaches to a new window but is blank and not loadable / useable.
Expected result:
Tab detaches to a new window with its contents intact.
More test conditions not neccessarily connected to this issue, but there because of some changed code, are specified in the PR #13120
Brave Version
about:brave info:
0.21.x source
Reproducible on current live release:
No, since automatic discarding is disabled
The text was updated successfully, but these errors were encountered: