| Index: content/child/child_thread.cc
|
| diff --git a/content/child/child_thread.cc b/content/child/child_thread.cc
|
| index c66b7d42d4fddb2e579c0458e5d4ef48fea21163..39ac738f478e5984f8a381c39bd95882dd66afe1 100644
|
| --- a/content/child/child_thread.cc
|
| +++ b/content/child/child_thread.cc
|
| @@ -16,6 +16,7 @@
|
| #include "base/lazy_instance.h"
|
| #include "base/logging.h"
|
| #include "base/message_loop/message_loop.h"
|
| +#include "base/message_loop/timer_slack.h"
|
| #include "base/process/kill.h"
|
| #include "base/process/process_handle.h"
|
| #include "base/strings/string_util.h"
|
| @@ -440,10 +441,8 @@ bool ChildThread::OnMessageReceived(const IPC::Message& msg) {
|
| IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData,
|
| OnGetChildProfilerData)
|
| IPC_MESSAGE_HANDLER(ChildProcessMsg_DumpHandles, OnDumpHandles)
|
| -#if defined(OS_WIN)
|
| IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded,
|
| OnProcessBackgrounded)
|
| -#endif
|
| #if defined(USE_TCMALLOC)
|
| IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats)
|
| #endif
|
| @@ -552,10 +551,18 @@ void ChildThread::EnsureConnected() {
|
| base::KillProcess(base::GetCurrentProcessHandle(), 0, false);
|
| }
|
|
|
| -#if defined(OS_WIN)
|
| void ChildThread::OnProcessBackgrounded(bool background) {
|
| + // Set timer slack to maximum on main thread when in background.
|
| + base::TimerSlack timer_slack = base::TIMER_SLACK_NONE;
|
| + if (background)
|
| + timer_slack = base::TIMER_SLACK_MAXIMUM;
|
| + base::MessageLoop::current()->SetTimerSlack(timer_slack);
|
| +
|
| +#ifdef OS_WIN
|
| + // Windows Vista+ has a fancy process backgrounding mode that can only be set
|
| + // from within the process.
|
| base::Process::Current().SetProcessBackgrounded(background);
|
| +#endif // OS_WIN
|
| }
|
| -#endif
|
|
|
| } // namespace content
|
|
|