| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 quota_message_filter_ = | 194 quota_message_filter_ = |
| 195 new QuotaMessageFilter(thread_safe_sender_.get()); | 195 new QuotaMessageFilter(thread_safe_sender_.get()); |
| 196 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(), | 196 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(), |
| 197 quota_message_filter_.get())); | 197 quota_message_filter_.get())); |
| 198 | 198 |
| 199 channel_->AddFilter(histogram_message_filter_.get()); | 199 channel_->AddFilter(histogram_message_filter_.get()); |
| 200 channel_->AddFilter(sync_message_filter_.get()); | 200 channel_->AddFilter(sync_message_filter_.get()); |
| 201 channel_->AddFilter(new tracing::ChildTraceMessageFilter( | 201 channel_->AddFilter(new tracing::ChildTraceMessageFilter( |
| 202 ChildProcess::current()->io_message_loop_proxy())); | 202 ChildProcess::current()->io_message_loop_proxy())); |
| 203 channel_->AddFilter(resource_message_filter_.get()); | 203 channel_->AddFilter(resource_message_filter_.get()); |
| 204 channel_->AddFilter(quota_message_filter_.get()); | 204 channel_->AddFilter(quota_message_filter_->GetFilter()); |
| 205 channel_->AddFilter(service_worker_message_filter_.get()); | 205 channel_->AddFilter(service_worker_message_filter_->GetFilter()); |
| 206 | 206 |
| 207 // In single process mode we may already have a power monitor | 207 // In single process mode we may already have a power monitor |
| 208 if (!base::PowerMonitor::Get()) { | 208 if (!base::PowerMonitor::Get()) { |
| 209 scoped_ptr<PowerMonitorBroadcastSource> power_monitor_source( | 209 scoped_ptr<PowerMonitorBroadcastSource> power_monitor_source( |
| 210 new PowerMonitorBroadcastSource()); | 210 new PowerMonitorBroadcastSource()); |
| 211 channel_->AddFilter(power_monitor_source->GetMessageFilter()); | 211 channel_->AddFilter(power_monitor_source->GetMessageFilter()); |
| 212 | 212 |
| 213 power_monitor_.reset(new base::PowerMonitor( | 213 power_monitor_.reset(new base::PowerMonitor( |
| 214 power_monitor_source.PassAs<base::PowerMonitorSource>())); | 214 power_monitor_source.PassAs<base::PowerMonitorSource>())); |
| 215 } | 215 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 ::HeapProfilerStop, | 257 ::HeapProfilerStop, |
| 258 ::GetHeapProfile)); | 258 ::GetHeapProfile)); |
| 259 #endif | 259 #endif |
| 260 } | 260 } |
| 261 | 261 |
| 262 ChildThread::~ChildThread() { | 262 ChildThread::~ChildThread() { |
| 263 #ifdef IPC_MESSAGE_LOG_ENABLED | 263 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 264 IPC::Logging::GetInstance()->SetIPCSender(NULL); | 264 IPC::Logging::GetInstance()->SetIPCSender(NULL); |
| 265 #endif | 265 #endif |
| 266 | 266 |
| 267 channel_->RemoveFilter(service_worker_message_filter_.get()); | 267 channel_->RemoveFilter(service_worker_message_filter_->GetFilter()); |
| 268 channel_->RemoveFilter(quota_message_filter_.get()); | 268 channel_->RemoveFilter(quota_message_filter_->GetFilter()); |
| 269 channel_->RemoveFilter(histogram_message_filter_.get()); | 269 channel_->RemoveFilter(histogram_message_filter_.get()); |
| 270 channel_->RemoveFilter(sync_message_filter_.get()); | 270 channel_->RemoveFilter(sync_message_filter_.get()); |
| 271 | 271 |
| 272 // The ChannelProxy object caches a pointer to the IPC thread, so need to | 272 // The ChannelProxy object caches a pointer to the IPC thread, so need to |
| 273 // reset it as it's not guaranteed to outlive this object. | 273 // reset it as it's not guaranteed to outlive this object. |
| 274 // NOTE: this also has the side-effect of not closing the main IPC channel to | 274 // NOTE: this also has the side-effect of not closing the main IPC channel to |
| 275 // the browser process. This is needed because this is the signal that the | 275 // the browser process. This is needed because this is the signal that the |
| 276 // browser uses to know that this process has died, so we need it to be alive | 276 // browser uses to know that this process has died, so we need it to be alive |
| 277 // until this process is shut down, and the OS closes the handle | 277 // until this process is shut down, and the OS closes the handle |
| 278 // automatically. We used to watch the object handle on Windows to do this, | 278 // automatically. We used to watch the object handle on Windows to do this, |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 // inflight that would addref it. | 489 // inflight that would addref it. |
| 490 Send(new ChildProcessHostMsg_ShutdownRequest); | 490 Send(new ChildProcessHostMsg_ShutdownRequest); |
| 491 } | 491 } |
| 492 | 492 |
| 493 void ChildThread::EnsureConnected() { | 493 void ChildThread::EnsureConnected() { |
| 494 LOG(INFO) << "ChildThread::EnsureConnected()"; | 494 LOG(INFO) << "ChildThread::EnsureConnected()"; |
| 495 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); | 495 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); |
| 496 } | 496 } |
| 497 | 497 |
| 498 } // namespace content | 498 } // namespace content |
| OLD | NEW |