| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { | 98 BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { |
| 99 g_child_process_list.Get().remove(this); | 99 g_child_process_list.Get().remove(this); |
| 100 } | 100 } |
| 101 | 101 |
| 102 // static | 102 // static |
| 103 void BrowserChildProcessHostImpl::TerminateAll() { | 103 void BrowserChildProcessHostImpl::TerminateAll() { |
| 104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 105 // Make a copy since the BrowserChildProcessHost dtor mutates the original | 105 // Make a copy since the BrowserChildProcessHost dtor mutates the original |
| 106 // list. | 106 // list. |
| 107 BrowserChildProcessList copy = g_child_process_list.Get(); | 107 BrowserChildProcessList copy = g_child_process_list.Get(); |
| 108 STLDeleteElements(©); | 108 for (BrowserChildProcessList::iterator it = copy.begin(); |
| 109 it != copy.end(); ++it) { |
| 110 delete (*it)->delegate(); // ~*HostDelegate deletes *HostImpl. |
| 111 } |
| 109 } | 112 } |
| 110 | 113 |
| 111 void BrowserChildProcessHostImpl::Launch( | 114 void BrowserChildProcessHostImpl::Launch( |
| 112 #if defined(OS_WIN) | 115 #if defined(OS_WIN) |
| 113 const FilePath& exposed_dir, | 116 const FilePath& exposed_dir, |
| 114 #elif defined(OS_POSIX) | 117 #elif defined(OS_POSIX) |
| 115 bool use_zygote, | 118 bool use_zygote, |
| 116 const base::EnvironmentVector& environ, | 119 const base::EnvironmentVector& environ, |
| 117 #endif | 120 #endif |
| 118 CommandLine* cmd_line) { | 121 CommandLine* cmd_line) { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 320 |
| 318 | 321 |
| 319 void BrowserChildProcessHostImpl::OnProcessLaunched() { | 322 void BrowserChildProcessHostImpl::OnProcessLaunched() { |
| 320 if (!child_process_->GetHandle()) { | 323 if (!child_process_->GetHandle()) { |
| 321 delete delegate_; // Will delete us | 324 delete delegate_; // Will delete us |
| 322 return; | 325 return; |
| 323 } | 326 } |
| 324 data_.handle = child_process_->GetHandle(); | 327 data_.handle = child_process_->GetHandle(); |
| 325 delegate_->OnProcessLaunched(); | 328 delegate_->OnProcessLaunched(); |
| 326 } | 329 } |
| OLD | NEW |