Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Issue 1914143002: Experimental 'purging and suspending' backgrounded tabs behind the flag (Closed)

Created:
4 years, 8 months ago by hajimehoshi
Modified:
4 years, 7 months ago
CC:
chromium-reviews, creis+watch_chromium.org, darin-cc_chromium.org, jam, mkwst+moarreviews-renderer_chromium.org, mlamouri+watch-content_chromium.org, nasko+codewatch_chromium.org, scheduler-bugs_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Experimental 'purging and suspending' backgrounded tabs behind the flag This CL adds an experimental feature, 'purging and suspending' backgrounded tabs to save memory usage. This feature is behind the flag '--purge-and-suspend-time' taking a time value in seconds. When the indicated time passes after a tab goes backgrounded, the backgrounded tab's memory cache is purged and suspended. We expect only purgable memory like cache is purged and tab behaviors would never be affected. This CL adds only suspending and not purging any cache. I'll add purging feature later. BUG=551995, 607077 Committed: https://crrev.com/6909327ee89d7bd5b69e9e578bcb28388271b2ea Cr-Commit-Position: refs/heads/master@{#393476}

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Total comments: 6

Patch Set 4 : RendererScheduler should only do suspending #

Patch Set 5 : (rebase) #

Patch Set 6 : Add tests #

Patch Set 7 : Add is_cache_purged_ to avoid redundant purging #

Total comments: 2

Patch Set 8 : Address on dcheng@'s review #

Total comments: 6

Patch Set 9 : Address on reviews #

Total comments: 5

Patch Set 10 : Address on reviews #

Total comments: 4

Patch Set 11 : Address on Sami's review #

Patch Set 12 : (rebasing) #

Total comments: 2

Patch Set 13 : Address on haraken's review #

Unified diffs Side-by-side diffs Delta from patch set Stats (+124 lines, -5 lines) Patch
M chrome/browser/memory/tab_manager.h View 1 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/memory/tab_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +36 lines, -2 lines 0 comments Download
M chrome/browser/memory/tab_manager_browsertest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/chrome_switches.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/chrome_switches.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +6 lines, -0 lines 0 comments Download
M components/scheduler/renderer/renderer_scheduler.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +5 lines, -0 lines 0 comments Download
M components/scheduler/renderer/renderer_scheduler_impl.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M components/scheduler/renderer/renderer_scheduler_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +11 lines, -0 lines 0 comments Download
M components/scheduler/renderer/renderer_scheduler_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +18 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +4 lines, -0 lines 0 comments Download
M content/child/child_thread_impl.h View 1 chunk +1 line, -0 lines 0 comments Download
M content/child/child_thread_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -0 lines 0 comments Download
M content/common/child_process_messages.h View 1 chunk +3 lines, -0 lines 0 comments Download
M content/public/browser/render_process_host.h View 1 1 chunk +3 lines, -0 lines 0 comments Download
M content/public/test/mock_render_process_host.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M content/public/test/mock_render_process_host.cc View 1 1 chunk +2 lines, -0 lines 0 comments Download
M content/renderer/render_thread_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +3 lines, -0 lines 0 comments Download
M content/renderer/render_thread_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +15 lines, -2 lines 0 comments Download
M content/test/fake_renderer_scheduler.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M content/test/fake_renderer_scheduler.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -0 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 44 (16 generated)
hajimehoshi
PTAL
4 years, 7 months ago (2016-04-27 08:38:18 UTC) #4
Sami
https://codereview.chromium.org/1914143002/diff/40001/components/scheduler/renderer/renderer_scheduler_impl.cc File components/scheduler/renderer/renderer_scheduler_impl.cc (right): https://codereview.chromium.org/1914143002/diff/40001/components/scheduler/renderer/renderer_scheduler_impl.cc#newcode389 components/scheduler/renderer/renderer_scheduler_impl.cc:389: if (helper_.IsShutdown() || !MainThreadOnly().renderer_backgrounded) We should probably cancel suspend_timers_when_backgrounded_closure_ ...
4 years, 7 months ago (2016-04-27 15:44:43 UTC) #6
hajimehoshi
Thank you! https://codereview.chromium.org/1914143002/diff/40001/components/scheduler/renderer/renderer_scheduler_impl.cc File components/scheduler/renderer/renderer_scheduler_impl.cc (right): https://codereview.chromium.org/1914143002/diff/40001/components/scheduler/renderer/renderer_scheduler_impl.cc#newcode389 components/scheduler/renderer/renderer_scheduler_impl.cc:389: if (helper_.IsShutdown() || !MainThreadOnly().renderer_backgrounded) On 2016/04/27 15:44:43, ...
4 years, 7 months ago (2016-04-28 10:26:58 UTC) #7
Sami
Thanks, I think this division of work seems appropriate. Please add a RendererSchedulerImpl test for ...
4 years, 7 months ago (2016-04-28 13:16:28 UTC) #8
hajimehoshi
On 2016/04/28 13:16:28, Sami wrote: > Thanks, I think this division of work seems appropriate. ...
4 years, 7 months ago (2016-05-09 08:58:34 UTC) #9
hajimehoshi
+kinuko for content/ +dcheng for content/common
4 years, 7 months ago (2016-05-09 12:16:56 UTC) #12
dcheng
https://codereview.chromium.org/1914143002/diff/120001/chrome/browser/memory/tab_manager.cc File chrome/browser/memory/tab_manager.cc (right): https://codereview.chromium.org/1914143002/diff/120001/chrome/browser/memory/tab_manager.cc#newcode571 chrome/browser/memory/tab_manager.cc:571: if (NowTicks() - tab.last_active < purge_and_suspend_time_delta) Nit: maybe just ...
4 years, 7 months ago (2016-05-10 04:49:54 UTC) #13
hajimehoshi
Thank you! https://codereview.chromium.org/1914143002/diff/120001/chrome/browser/memory/tab_manager.cc File chrome/browser/memory/tab_manager.cc (right): https://codereview.chromium.org/1914143002/diff/120001/chrome/browser/memory/tab_manager.cc#newcode571 chrome/browser/memory/tab_manager.cc:571: if (NowTicks() - tab.last_active < purge_and_suspend_time_delta) On ...
4 years, 7 months ago (2016-05-10 06:54:11 UTC) #14
kinuko
content lgtm
4 years, 7 months ago (2016-05-10 10:42:09 UTC) #15
dcheng
https://codereview.chromium.org/1914143002/diff/140001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/1914143002/diff/140001/content/renderer/render_thread_impl.cc#newcode1698 content/renderer/render_thread_impl.cc:1698: renderer_scheduler_->SuspendRendererWhenBackgrounded(); Will we ever send a "purge and suspend" ...
4 years, 7 months ago (2016-05-10 16:28:06 UTC) #16
Georges Khalil
In Description: - This features is -> This feature is - after a tabs goes ...
4 years, 7 months ago (2016-05-10 18:58:58 UTC) #17
hajimehoshi
Thank you! https://codereview.chromium.org/1914143002/diff/140001/chrome/browser/memory/tab_manager.cc File chrome/browser/memory/tab_manager.cc (right): https://codereview.chromium.org/1914143002/diff/140001/chrome/browser/memory/tab_manager.cc#newcode518 chrome/browser/memory/tab_manager.cc:518: // updating on ChromeOS via the delegate. ...
4 years, 7 months ago (2016-05-11 07:23:31 UTC) #21
hajimehoshi
On 2016/05/10 18:58:58, Georges Khalil wrote: > In Description: > - This features is -> ...
4 years, 7 months ago (2016-05-11 07:23:49 UTC) #22
Georges Khalil
chrome/browser/memory/* lgtm % nit. https://codereview.chromium.org/1914143002/diff/160001/chrome/browser/memory/tab_manager_browsertest.cc File chrome/browser/memory/tab_manager_browsertest.cc (right): https://codereview.chromium.org/1914143002/diff/160001/chrome/browser/memory/tab_manager_browsertest.cc#newcode20 chrome/browser/memory/tab_manager_browsertest.cc:20: #include "chrome/common/chrome_switches.h" nit: remove this.
4 years, 7 months ago (2016-05-11 15:01:23 UTC) #23
dcheng
https://codereview.chromium.org/1914143002/diff/160001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/1914143002/diff/160001/content/renderer/render_thread_impl.cc#newcode1702 content/renderer/render_thread_impl.cc:1702: renderer_scheduler_->SuspendRendererWhenBackgrounded(); Sorry, to clarify my earlier comment: it seems ...
4 years, 7 months ago (2016-05-11 17:42:22 UTC) #24
hajimehoshi
https://codereview.chromium.org/1914143002/diff/160001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/1914143002/diff/160001/content/renderer/render_thread_impl.cc#newcode1702 content/renderer/render_thread_impl.cc:1702: renderer_scheduler_->SuspendRendererWhenBackgrounded(); On 2016/05/11 17:42:22, dcheng wrote: > Sorry, to ...
4 years, 7 months ago (2016-05-12 05:20:14 UTC) #25
dcheng
On 2016/05/12 at 05:20:14, hajimehoshi wrote: > https://codereview.chromium.org/1914143002/diff/160001/content/renderer/render_thread_impl.cc > File content/renderer/render_thread_impl.cc (right): > > https://codereview.chromium.org/1914143002/diff/160001/content/renderer/render_thread_impl.cc#newcode1702 ...
4 years, 7 months ago (2016-05-12 05:25:47 UTC) #26
hajimehoshi
Thank you! https://codereview.chromium.org/1914143002/diff/160001/chrome/browser/memory/tab_manager_browsertest.cc File chrome/browser/memory/tab_manager_browsertest.cc (right): https://codereview.chromium.org/1914143002/diff/160001/chrome/browser/memory/tab_manager_browsertest.cc#newcode20 chrome/browser/memory/tab_manager_browsertest.cc:20: #include "chrome/common/chrome_switches.h" On 2016/05/11 15:01:23, Georges Khalil ...
4 years, 7 months ago (2016-05-12 08:33:18 UTC) #27
Sami
components/renderer lgtm with two nits. https://codereview.chromium.org/1914143002/diff/180001/components/scheduler/renderer/renderer_scheduler.h File components/scheduler/renderer/renderer_scheduler.h (right): https://codereview.chromium.org/1914143002/diff/180001/components/scheduler/renderer/renderer_scheduler.h#newcode131 components/scheduler/renderer/renderer_scheduler.h:131: // Tells the scheduler ...
4 years, 7 months ago (2016-05-12 11:31:35 UTC) #28
hajimehoshi
> https://codereview.chromium.org/1914143002/diff/40001/components/scheduler/renderer/renderer_scheduler_impl.cc#newcode392 > components/scheduler/renderer/renderer_scheduler_impl.cc:392: > SuspendTimerQueueWhenBackgrounded(); > We should think about whether we need to ...
4 years, 7 months ago (2016-05-13 05:57:11 UTC) #29
hajimehoshi
Thank you! https://codereview.chromium.org/1914143002/diff/180001/components/scheduler/renderer/renderer_scheduler.h File components/scheduler/renderer/renderer_scheduler.h (right): https://codereview.chromium.org/1914143002/diff/180001/components/scheduler/renderer/renderer_scheduler.h#newcode131 components/scheduler/renderer/renderer_scheduler.h:131: // Tells the scheduler that the render ...
4 years, 7 months ago (2016-05-13 06:07:46 UTC) #30
dcheng
ipc lgtm
4 years, 7 months ago (2016-05-13 06:08:51 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1914143002/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1914143002/220001
4 years, 7 months ago (2016-05-13 06:38:25 UTC) #34
haraken
LGTM https://codereview.chromium.org/1914143002/diff/220001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/1914143002/diff/220001/content/renderer/render_thread_impl.cc#newcode1725 content/renderer/render_thread_impl.cc:1725: is_cache_purged_ = true; Nit: It would make more ...
4 years, 7 months ago (2016-05-13 07:23:32 UTC) #35
hajimehoshi
Thank you! https://codereview.chromium.org/1914143002/diff/220001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/1914143002/diff/220001/content/renderer/render_thread_impl.cc#newcode1725 content/renderer/render_thread_impl.cc:1725: is_cache_purged_ = true; On 2016/05/13 07:23:32, haraken ...
4 years, 7 months ago (2016-05-13 07:36:05 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1914143002/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1914143002/240001
4 years, 7 months ago (2016-05-13 07:36:28 UTC) #40
commit-bot: I haz the power
Committed patchset #13 (id:240001)
4 years, 7 months ago (2016-05-13 08:31:09 UTC) #42
commit-bot: I haz the power
4 years, 7 months ago (2016-05-13 08:32:51 UTC) #44
Message was sent while issue was closed.
Patchset 13 (id:??) landed as
https://crrev.com/6909327ee89d7bd5b69e9e578bcb28388271b2ea
Cr-Commit-Position: refs/heads/master@{#393476}

Powered by Google App Engine
This is Rietveld 408576698