| Index: content/child/child_thread.cc
|
| diff --git a/content/child/child_thread.cc b/content/child/child_thread.cc
|
| index 7e58c1ffd2fd449b193d5829d5de424279f7bd0d..7c6432af2452c81e8f4b7ad644380f4d5b3cc3dd 100644
|
| --- a/content/child/child_thread.cc
|
| +++ b/content/child/child_thread.cc
|
| @@ -34,7 +34,6 @@
|
| #include "content/child/fileapi/webfilesystem_impl.h"
|
| #include "content/child/mojo/mojo_application.h"
|
| #include "content/child/power_monitor_broadcast_source.h"
|
| -#include "content/child/process_background_message_filter.h"
|
| #include "content/child/quota_dispatcher.h"
|
| #include "content/child/quota_message_filter.h"
|
| #include "content/child/resource_dispatcher.h"
|
| @@ -283,7 +282,6 @@ void ChildThread::Init(const Options& options) {
|
| histogram_message_filter_ = new ChildHistogramMessageFilter();
|
| resource_message_filter_ =
|
| new ChildResourceMessageFilter(resource_dispatcher());
|
| - process_background_message_filter_ = new ProcessBackgroundMessageFilter();
|
|
|
| service_worker_message_filter_ =
|
| new ServiceWorkerMessageFilter(thread_safe_sender_.get());
|
| @@ -296,7 +294,6 @@ void ChildThread::Init(const Options& options) {
|
| channel_->AddFilter(histogram_message_filter_.get());
|
| channel_->AddFilter(sync_message_filter_.get());
|
| channel_->AddFilter(resource_message_filter_.get());
|
| - channel_->AddFilter(process_background_message_filter_.get());
|
| channel_->AddFilter(quota_message_filter_->GetFilter());
|
| channel_->AddFilter(service_worker_message_filter_->GetFilter());
|
|
|
| @@ -369,7 +366,6 @@ ChildThread::~ChildThread() {
|
|
|
| channel_->RemoveFilter(histogram_message_filter_.get());
|
| channel_->RemoveFilter(sync_message_filter_.get());
|
| - channel_->RemoveFilter(process_background_message_filter_.get());
|
|
|
| // The ChannelProxy object caches a pointer to the IPC thread, so need to
|
| // reset it as it's not guaranteed to outlive this object.
|
| @@ -480,6 +476,8 @@ bool ChildThread::OnMessageReceived(const IPC::Message& msg) {
|
| IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData,
|
| OnGetChildProfilerData)
|
| IPC_MESSAGE_HANDLER(ChildProcessMsg_DumpHandles, OnDumpHandles)
|
| + IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded,
|
| + OnProcessBackgrounded)
|
| #if defined(USE_TCMALLOC)
|
| IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats)
|
| #endif
|
| @@ -588,4 +586,12 @@ void ChildThread::EnsureConnected() {
|
| base::KillProcess(base::GetCurrentProcessHandle(), 0, false);
|
| }
|
|
|
| +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);
|
| +}
|
| +
|
| } // namespace content
|
|
|