| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 channel_->AddFilter(histogram_message_filter_.get()); | 210 channel_->AddFilter(histogram_message_filter_.get()); |
| 211 channel_->AddFilter(sync_message_filter_.get()); | 211 channel_->AddFilter(sync_message_filter_.get()); |
| 212 channel_->AddFilter(new tracing::ChildTraceMessageFilter( | 212 channel_->AddFilter(new tracing::ChildTraceMessageFilter( |
| 213 ChildProcess::current()->io_message_loop_proxy())); | 213 ChildProcess::current()->io_message_loop_proxy())); |
| 214 channel_->AddFilter(resource_message_filter_.get()); | 214 channel_->AddFilter(resource_message_filter_.get()); |
| 215 channel_->AddFilter(quota_message_filter_->GetFilter()); | 215 channel_->AddFilter(quota_message_filter_->GetFilter()); |
| 216 channel_->AddFilter(service_worker_message_filter_->GetFilter()); | 216 channel_->AddFilter(service_worker_message_filter_->GetFilter()); |
| 217 | 217 |
| 218 // In single process mode we may already have a power monitor | 218 // In single process mode we may already have a power monitor |
| 219 if (!base::PowerMonitor::Get()) { | 219 if (!base::PowerMonitor::IsInitialized()) { |
| 220 scoped_ptr<PowerMonitorBroadcastSource> power_monitor_source( | 220 scoped_ptr<PowerMonitorBroadcastSource> power_monitor_source( |
| 221 new PowerMonitorBroadcastSource()); | 221 new PowerMonitorBroadcastSource()); |
| 222 channel_->AddFilter(power_monitor_source->GetMessageFilter()); | 222 channel_->AddFilter(power_monitor_source->GetMessageFilter()); |
| 223 | 223 |
| 224 power_monitor_.reset(new base::PowerMonitor( | 224 base::PowerMonitor::Initialize( |
| 225 power_monitor_source.PassAs<base::PowerMonitorSource>())); | 225 power_monitor_source.PassAs<base::PowerMonitorSource>()); |
| 226 } | 226 } |
| 227 | 227 |
| 228 #if defined(OS_POSIX) | 228 #if defined(OS_POSIX) |
| 229 // Check that --process-type is specified so we don't do this in unit tests | 229 // Check that --process-type is specified so we don't do this in unit tests |
| 230 // and single-process mode. | 230 // and single-process mode. |
| 231 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) | 231 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) |
| 232 channel_->AddFilter(new SuicideOnChannelErrorFilter()); | 232 channel_->AddFilter(new SuicideOnChannelErrorFilter()); |
| 233 #endif | 233 #endif |
| 234 | 234 |
| 235 base::MessageLoop::current()->PostDelayedTask( | 235 base::MessageLoop::current()->PostDelayedTask( |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 // inflight that would addref it. | 480 // inflight that would addref it. |
| 481 Send(new ChildProcessHostMsg_ShutdownRequest); | 481 Send(new ChildProcessHostMsg_ShutdownRequest); |
| 482 } | 482 } |
| 483 | 483 |
| 484 void ChildThread::EnsureConnected() { | 484 void ChildThread::EnsureConnected() { |
| 485 VLOG(0) << "ChildThread::EnsureConnected()"; | 485 VLOG(0) << "ChildThread::EnsureConnected()"; |
| 486 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); | 486 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); |
| 487 } | 487 } |
| 488 | 488 |
| 489 } // namespace content | 489 } // namespace content |
| OLD | NEW |