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

Unified Diff: content/child/child_thread.cc

Issue 441003002: Revert r286729 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/child_thread.h ('k') | content/child/process_background_message_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « content/child/child_thread.h ('k') | content/child/process_background_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698