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