| 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/browser/browser_child_process_host_impl.h" | 5 #include "content/browser/browser_child_process_host_impl.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 BrowserChildProcessHostImpl::BrowserChildProcessHostImpl( | 94 BrowserChildProcessHostImpl::BrowserChildProcessHostImpl( |
| 95 int process_type, | 95 int process_type, |
| 96 BrowserChildProcessHostDelegate* delegate) | 96 BrowserChildProcessHostDelegate* delegate) |
| 97 : data_(process_type), | 97 : data_(process_type), |
| 98 delegate_(delegate), | 98 delegate_(delegate), |
| 99 power_monitor_message_broadcaster_(this) { | 99 power_monitor_message_broadcaster_(this) { |
| 100 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); | 100 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); |
| 101 | 101 |
| 102 child_process_host_.reset(ChildProcessHost::Create(this)); | 102 child_process_host_.reset(ChildProcessHost::Create(this)); |
| 103 child_process_host_->AddFilter(new TraceMessageFilter); | 103 AddFilter(new TraceMessageFilter); |
| 104 child_process_host_->AddFilter(new ProfilerMessageFilter(process_type)); | 104 AddFilter(new ProfilerMessageFilter(process_type)); |
| 105 child_process_host_->AddFilter(new HistogramMessageFilter()); | 105 AddFilter(new HistogramMessageFilter); |
| 106 | 106 |
| 107 g_child_process_list.Get().push_back(this); | 107 g_child_process_list.Get().push_back(this); |
| 108 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); | 108 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); |
| 109 } | 109 } |
| 110 | 110 |
| 111 BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { | 111 BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { |
| 112 g_child_process_list.Get().remove(this); | 112 g_child_process_list.Get().remove(this); |
| 113 | 113 |
| 114 #if defined(OS_WIN) | 114 #if defined(OS_WIN) |
| 115 DeleteProcessWaitableEvent(early_exit_watcher_.GetWatchedEvent()); | 115 DeleteProcessWaitableEvent(early_exit_watcher_.GetWatchedEvent()); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 void BrowserChildProcessHostImpl::SetBackgrounded(bool backgrounded) { | 211 void BrowserChildProcessHostImpl::SetBackgrounded(bool backgrounded) { |
| 212 child_process_->SetProcessBackgrounded(backgrounded); | 212 child_process_->SetProcessBackgrounded(backgrounded); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void BrowserChildProcessHostImpl::SetTerminateChildOnShutdown( | 215 void BrowserChildProcessHostImpl::SetTerminateChildOnShutdown( |
| 216 bool terminate_on_shutdown) { | 216 bool terminate_on_shutdown) { |
| 217 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 217 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 218 child_process_->SetTerminateChildOnShutdown(terminate_on_shutdown); | 218 child_process_->SetTerminateChildOnShutdown(terminate_on_shutdown); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void BrowserChildProcessHostImpl::AddFilter(BrowserMessageFilter* filter) { |
| 222 child_process_host_->AddFilter(filter->GetFilter()); |
| 223 } |
| 224 |
| 221 void BrowserChildProcessHostImpl::NotifyProcessInstanceCreated( | 225 void BrowserChildProcessHostImpl::NotifyProcessInstanceCreated( |
| 222 const ChildProcessData& data) { | 226 const ChildProcessData& data) { |
| 223 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 227 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 224 FOR_EACH_OBSERVER(BrowserChildProcessObserver, g_observers.Get(), | 228 FOR_EACH_OBSERVER(BrowserChildProcessObserver, g_observers.Get(), |
| 225 BrowserChildProcessInstanceCreated(data)); | 229 BrowserChildProcessInstanceCreated(data)); |
| 226 } | 230 } |
| 227 | 231 |
| 228 base::TerminationStatus BrowserChildProcessHostImpl::GetTerminationStatus( | 232 base::TerminationStatus BrowserChildProcessHostImpl::GetTerminationStatus( |
| 229 bool known_dead, int* exit_code) { | 233 bool known_dead, int* exit_code) { |
| 230 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 234 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 352 |
| 349 void BrowserChildProcessHostImpl::OnProcessExitedEarly( | 353 void BrowserChildProcessHostImpl::OnProcessExitedEarly( |
| 350 base::WaitableEvent* event) { | 354 base::WaitableEvent* event) { |
| 351 DeleteProcessWaitableEvent(event); | 355 DeleteProcessWaitableEvent(event); |
| 352 OnChildDisconnected(); | 356 OnChildDisconnected(); |
| 353 } | 357 } |
| 354 | 358 |
| 355 #endif | 359 #endif |
| 356 | 360 |
| 357 } // namespace content | 361 } // namespace content |
| OLD | NEW |