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

Issue 1133143003: [Android] Suspend shared timers for hidden renderers (Closed)

Created:
5 years, 7 months ago by jdduke (slow)
Modified:
5 years, 2 months ago
Reviewers:
Sami, sky, no sievers
CC:
chromium-reviews, darin-cc_chromium.org, jam, mkwst+moarreviews-renderer_chromium.org, mlamouri+watch-content_chromium.org, qinmin, Tima Vaisburd, mlamouri (slow - plz ping)
Base URL:
https://chromium.googlesource.com/chromium/src.git@input_remove_suspend
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Android] Suspend shared timers for hidden renderers Instead of tracking the visibility state of all renderers in the browser and using that to kill shared timers, make each renderer process responsible for the suspension of its own shared timers after it is completely hidden. This ensures background tabs eventually go silent even while a foreground tab (in a separate process) is active. BUG=469049, 486135 Committed: https://crrev.com/73220f023ede1c7bd5c4bd5548e9b5f2b3531430 Cr-Commit-Position: refs/heads/master@{#347434}

Patch Set 1 #

Patch Set 2 : Cleanup #

Patch Set 3 : Comment #

Total comments: 4

Patch Set 4 : SetBackgrounded #

Patch Set 5 : Rebase #

Patch Set 6 : Move logic to the scheduler #

Total comments: 6

Patch Set 7 : Code review and test #

Total comments: 2

Patch Set 8 : Code review #

Total comments: 4

Patch Set 9 : Code review #

Patch Set 10 : Use ContentRendererClient #

Unified diffs Side-by-side diffs Delta from patch set Stats (+207 lines, -13 lines) Patch
M chrome/renderer/chrome_content_renderer_client.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M chrome/renderer/chrome_content_renderer_client.cc View 1 2 3 4 5 6 7 8 9 1 chunk +9 lines, -0 lines 0 comments Download
M components/scheduler/renderer/renderer_scheduler.h View 1 2 3 4 5 6 2 chunks +16 lines, -0 lines 0 comments Download
M components/scheduler/renderer/renderer_scheduler_impl.h View 1 2 3 4 5 6 7 6 chunks +17 lines, -0 lines 0 comments Download
M components/scheduler/renderer/renderer_scheduler_impl.cc View 1 2 3 4 5 6 7 8 7 chunks +75 lines, -4 lines 0 comments Download
M components/scheduler/renderer/renderer_scheduler_impl_unittest.cc View 1 2 3 4 5 6 2 chunks +45 lines, -0 lines 0 comments Download
M content/child/child_thread_impl.h View 1 2 3 4 5 2 chunks +1 line, -1 line 0 comments Download
M content/child/child_thread_impl.cc View 1 2 3 4 5 6 7 2 chunks +8 lines, -8 lines 0 comments Download
M content/public/renderer/content_renderer_client.h View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -0 lines 0 comments Download
M content/public/renderer/content_renderer_client.cc View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -0 lines 0 comments Download
M content/renderer/render_thread_impl.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M content/renderer/render_thread_impl.cc View 1 2 3 4 5 6 7 8 9 2 chunks +14 lines, -0 lines 0 comments Download
M content/test/fake_renderer_scheduler.h View 1 2 3 4 5 6 2 chunks +3 lines, -0 lines 0 comments Download
M content/test/fake_renderer_scheduler.cc View 1 2 3 4 5 6 2 chunks +9 lines, -0 lines 0 comments Download

Messages

Total messages: 33 (7 generated)
jdduke (slow)
sievers, skyostil: Thoughts? I considered putting the logic in RenderProcessHostImpl (using an IPC to control ...
5 years, 7 months ago (2015-05-12 18:12:48 UTC) #3
jdduke (slow)
https://codereview.chromium.org/1133143003/diff/60001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/1133143003/diff/60001/content/renderer/render_thread_impl.cc#newcode1192 content/renderer/render_thread_impl.cc:1192: base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( I guess we can just query the scheduler ...
5 years, 7 months ago (2015-05-12 18:14:36 UTC) #4
Sami
Like we talked offline, RendererSchedulerImpl is probably a better home for this logic to avoid ...
5 years, 7 months ago (2015-05-14 10:47:08 UTC) #6
jdduke (slow)
On 2015/05/14 10:47:08, Sami wrote: > Like we talked offline, RendererSchedulerImpl is probably a better ...
5 years, 7 months ago (2015-05-14 15:00:48 UTC) #7
Sami
On 2015/05/14 15:00:48, jdduke wrote: > On 2015/05/14 10:47:08, Sami wrote: > > Like we ...
5 years, 7 months ago (2015-05-14 15:09:08 UTC) #8
jdduke (slow)
On 2015/05/14 15:09:08, Sami wrote: > On 2015/05/14 15:00:48, jdduke wrote: > > On 2015/05/14 ...
5 years, 7 months ago (2015-05-14 15:20:45 UTC) #9
Sami
On 2015/05/14 15:20:45, jdduke wrote: > On 2015/05/14 15:09:08, Sami wrote: > > On 2015/05/14 ...
5 years, 7 months ago (2015-05-14 15:36:35 UTC) #10
jdduke (slow)
On 2015/05/14 15:36:35, Sami wrote: > On 2015/05/14 15:20:45, jdduke wrote: > > On 2015/05/14 ...
5 years, 7 months ago (2015-05-14 15:38:19 UTC) #11
no sievers
https://codereview.chromium.org/1133143003/diff/60001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/1133143003/diff/60001/content/renderer/render_thread_impl.cc#newcode1888 content/renderer/render_thread_impl.cc:1888: // TODO(jdduke): Consider instead using the "backgrounded" signal from ...
5 years, 7 months ago (2015-05-15 00:10:38 UTC) #12
jdduke (slow)
+qinmin per the comment about audio playback. https://codereview.chromium.org/1133143003/diff/60001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/1133143003/diff/60001/content/renderer/render_thread_impl.cc#newcode1889 content/renderer/render_thread_impl.cc:1889: // browser, ...
5 years, 7 months ago (2015-05-15 15:41:19 UTC) #13
jdduke (slow)
Sami, ps#6 implements something like what we discussed, where we tell the scheduler we're backgrounded ...
5 years, 3 months ago (2015-08-27 22:55:36 UTC) #14
Sami
On 2015/08/27 22:55:36, jdduke wrote: > Sami, ps#6 implements something like what we discussed, where ...
5 years, 3 months ago (2015-08-28 14:15:01 UTC) #15
jdduke (slow)
Added a test, thoughts? It's a bit more plumbing than I'd like, but I agree ...
5 years, 3 months ago (2015-08-31 18:36:08 UTC) #16
Sami
Thanks for adding the test. One more suggestion for making the scheduler logic a little ...
5 years, 3 months ago (2015-09-01 11:09:29 UTC) #17
jdduke (slow)
https://codereview.chromium.org/1133143003/diff/140001/components/scheduler/renderer/renderer_scheduler_impl.cc File components/scheduler/renderer/renderer_scheduler_impl.cc (right): https://codereview.chromium.org/1133143003/diff/140001/components/scheduler/renderer/renderer_scheduler_impl.cc#newcode772 components/scheduler/renderer/renderer_scheduler_impl.cc:772: SuspendTimerQueue(); On 2015/09/01 11:09:29, Sami wrote: > Could you ...
5 years, 3 months ago (2015-09-01 16:37:03 UTC) #19
Sami
Thanks, lgtm! https://codereview.chromium.org/1133143003/diff/180001/components/scheduler/renderer/renderer_scheduler_impl.cc File components/scheduler/renderer/renderer_scheduler_impl.cc (right): https://codereview.chromium.org/1133143003/diff/180001/components/scheduler/renderer/renderer_scheduler_impl.cc#newcode654 components/scheduler/renderer/renderer_scheduler_impl.cc:654: // Note that this will only take ...
5 years, 3 months ago (2015-09-01 17:08:16 UTC) #20
jdduke (slow)
Thanks for review. sievers@ could you take a look at content/renderer and content/child? https://codereview.chromium.org/1133143003/diff/180001/components/scheduler/renderer/renderer_scheduler_impl.cc File ...
5 years, 3 months ago (2015-09-01 17:38:58 UTC) #21
no sievers
content lgtm
5 years, 3 months ago (2015-09-03 19:33:48 UTC) #22
jdduke (slow)
Turns out we need a different signal than OS_ANDROID to enable this, as we don't ...
5 years, 3 months ago (2015-09-03 22:03:26 UTC) #24
sky
LGTM
5 years, 3 months ago (2015-09-03 23:08:45 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1133143003/210001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1133143003/210001
5 years, 3 months ago (2015-09-04 16:07:47 UTC) #28
commit-bot: I haz the power
Committed patchset #10 (id:210001)
5 years, 3 months ago (2015-09-04 17:03:57 UTC) #29
commit-bot: I haz the power
Patchset 10 (id:??) landed as https://crrev.com/73220f023ede1c7bd5c4bd5548e9b5f2b3531430 Cr-Commit-Position: refs/heads/master@{#347434}
5 years, 3 months ago (2015-09-04 17:04:42 UTC) #30
Yaron
On 2015/09/04 17:04:42, commit-bot: I haz the power wrote: > Patchset 10 (id:??) landed as ...
5 years, 2 months ago (2015-09-29 17:42:47 UTC) #31
Yaron
On 2015/09/04 17:04:42, commit-bot: I haz the power wrote: > Patchset 10 (id:??) landed as ...
5 years, 2 months ago (2015-09-29 17:42:49 UTC) #32
jdduke (slow)
5 years, 2 months ago (2015-09-29 17:47:53 UTC) #33
Message was sent while issue was closed.
On 2015/09/29 17:42:49, Yaron wrote:
> On 2015/09/04 17:04:42, commit-bot: I haz the power wrote:
> > Patchset 10 (id:??) landed as
> > https://crrev.com/73220f023ede1c7bd5c4bd5548e9b5f2b3531430
> > Cr-Commit-Position: refs/heads/master@{#347434}
> 
> drive-by: I don't know the full context of this but does it mean that
> ChromeApplication.BackgroundProcessing logic can be simplified or removed?
> There's some logic there and in ContentViewStatics which attempts to handle
> background processing and suspend timers. Is it redundant now?

Eventually, yes absolutely. We still need to get accurate audio signals though
to ensure we always get the SetBackgrounded signal when appropriate (see
crbug.com/489789). I think we'll still need the ContentViewStatics hook to allow
WebView timer suspension, but we'll definitely be able to get rid of the
ChromeApplication.BackgroundProcessing stuff. Let me file a new bug to ensure
that cleanup happens.

Powered by Google App Engine
This is Rietveld 408576698