OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/child/child_thread.h" | 5 #include "content/child/child_thread.h" |
6 | 6 |
7 #include <signal.h> | 7 #include <signal.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 ChildProcess::current()->io_message_loop_proxy())); | 308 ChildProcess::current()->io_message_loop_proxy())); |
309 } | 309 } |
310 | 310 |
311 // In single process mode we may already have a power monitor | 311 // In single process mode we may already have a power monitor |
312 if (!base::PowerMonitor::Get()) { | 312 if (!base::PowerMonitor::Get()) { |
313 scoped_ptr<PowerMonitorBroadcastSource> power_monitor_source( | 313 scoped_ptr<PowerMonitorBroadcastSource> power_monitor_source( |
314 new PowerMonitorBroadcastSource()); | 314 new PowerMonitorBroadcastSource()); |
315 channel_->AddFilter(power_monitor_source->GetMessageFilter()); | 315 channel_->AddFilter(power_monitor_source->GetMessageFilter()); |
316 | 316 |
317 power_monitor_.reset(new base::PowerMonitor( | 317 power_monitor_.reset(new base::PowerMonitor( |
318 power_monitor_source.PassAs<base::PowerMonitorSource>())); | 318 power_monitor_source.Pass())); |
319 } | 319 } |
320 | 320 |
321 #if defined(OS_POSIX) | 321 #if defined(OS_POSIX) |
322 // Check that --process-type is specified so we don't do this in unit tests | 322 // Check that --process-type is specified so we don't do this in unit tests |
323 // and single-process mode. | 323 // and single-process mode. |
324 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) | 324 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) |
325 channel_->AddFilter(new SuicideOnChannelErrorFilter()); | 325 channel_->AddFilter(new SuicideOnChannelErrorFilter()); |
326 #endif | 326 #endif |
327 | 327 |
328 int connection_timeout = kConnectionTimeoutS; | 328 int connection_timeout = kConnectionTimeoutS; |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 | 595 |
596 void ChildThread::OnProcessBackgrounded(bool background) { | 596 void ChildThread::OnProcessBackgrounded(bool background) { |
597 // Set timer slack to maximum on main thread when in background. | 597 // Set timer slack to maximum on main thread when in background. |
598 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; | 598 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; |
599 if (background) | 599 if (background) |
600 timer_slack = base::TIMER_SLACK_MAXIMUM; | 600 timer_slack = base::TIMER_SLACK_MAXIMUM; |
601 base::MessageLoop::current()->SetTimerSlack(timer_slack); | 601 base::MessageLoop::current()->SetTimerSlack(timer_slack); |
602 } | 602 } |
603 | 603 |
604 } // namespace content | 604 } // namespace content |
OLD | NEW |