diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-05 19:36:20 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-05 19:36:20 +0000 |
commit | 57cd3d24748da3060fa42b70979a4c0390139ba1 (patch) | |
tree | ab2984c37a500b24e5adfebbb9dc95dc25875574 /base/message_loop/message_loop.h | |
parent | 95218f20e3d6d5214857076ecd0c2e6e89f3669e (diff) | |
download | chromium_src-57cd3d24748da3060fa42b70979a4c0390139ba1.zip chromium_src-57cd3d24748da3060fa42b70979a4c0390139ba1.tar.gz chromium_src-57cd3d24748da3060fa42b70979a4c0390139ba1.tar.bz2 |
[Mac] Maximise timer slack for background tabs
When a tab not playing audio is sent to the background, set timer slack to its maximum value.
Support for setting timer slack is added at the MessageLoop level, the concrete implementation of this CL only affects CFMessagePump backed MessageLoops (which means just the main thread for backgrounded renderer processes at present).
The MessageLoop implementation is designed to support its use on Windows and Linux (the Windows API sets slack per-timer like the Mac one, while on Linux slack, is set per-thread via a call to prctl() using PR_SET_TIMERSLACK).
BUG=356804
Review URL: https://codereview.chromium.org/289863005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_loop/message_loop.h')
-rw-r--r-- | base/message_loop/message_loop.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h index 165299d..22d4f73 100644 --- a/base/message_loop/message_loop.h +++ b/base/message_loop/message_loop.h @@ -18,6 +18,7 @@ #include "base/message_loop/message_loop_proxy.h" #include "base/message_loop/message_loop_proxy_impl.h" #include "base/message_loop/message_pump.h" +#include "base/message_loop/timer_slack.h" #include "base/observer_list.h" #include "base/pending_task.h" #include "base/sequenced_task_runner_helpers.h" @@ -274,6 +275,11 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { // arbitrary MessageLoop to QuitWhenIdle. static Closure QuitWhenIdleClosure(); + // Set the timer slack for this message loop. + void SetTimerSlack(TimerSlack timer_slack) { + pump_->SetTimerSlack(timer_slack); + } + // Returns true if this loop is |type|. This allows subclasses (especially // those in tests) to specialize how they are identified. virtual bool IsType(Type type) const; |