| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 251 } |
| 252 disconnect_was_alive_ = true; | 252 disconnect_was_alive_ = true; |
| 253 #if defined(OS_WIN) | 253 #if defined(OS_WIN) |
| 254 child_watcher_.StartWatching( | 254 child_watcher_.StartWatching( |
| 255 new base::WaitableEvent(data_.handle), this); | 255 new base::WaitableEvent(data_.handle), this); |
| 256 #else | 256 #else |
| 257 // On non-Windows platforms, give the child process some time to die after | 257 // On non-Windows platforms, give the child process some time to die after |
| 258 // disconnecting the channel so that the exit code and termination status | 258 // disconnecting the channel so that the exit code and termination status |
| 259 // become available. This is best effort -- if the process doesn't die | 259 // become available. This is best effort -- if the process doesn't die |
| 260 // within the time limit, this object gets destroyed. | 260 // within the time limit, this object gets destroyed. |
| 261 const int kExitCodeWaitMs = 250; | 261 const base::TimeDelta kExitCodeWait = |
| 262 base::TimeDelta::FromMilliseconds(250); |
| 262 MessageLoop::current()->PostDelayedTask( | 263 MessageLoop::current()->PostDelayedTask( |
| 263 FROM_HERE, | 264 FROM_HERE, |
| 264 base::Bind(&BrowserChildProcessHostImpl::OnChildDisconnected, | 265 base::Bind(&BrowserChildProcessHostImpl::OnChildDisconnected, |
| 265 task_factory_.GetWeakPtr()), | 266 task_factory_.GetWeakPtr()), |
| 266 kExitCodeWaitMs); | 267 kExitCodeWait); |
| 267 #endif | 268 #endif |
| 268 return; | 269 return; |
| 269 } | 270 } |
| 270 | 271 |
| 271 default: | 272 default: |
| 272 break; | 273 break; |
| 273 } | 274 } |
| 274 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Disconnected", | 275 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Disconnected", |
| 275 data_.type, | 276 data_.type, |
| 276 content::PROCESS_TYPE_MAX); | 277 content::PROCESS_TYPE_MAX); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 310 |
| 310 | 311 |
| 311 void BrowserChildProcessHostImpl::OnProcessLaunched() { | 312 void BrowserChildProcessHostImpl::OnProcessLaunched() { |
| 312 if (!child_process_->GetHandle()) { | 313 if (!child_process_->GetHandle()) { |
| 313 delete delegate_; // Will delete us | 314 delete delegate_; // Will delete us |
| 314 return; | 315 return; |
| 315 } | 316 } |
| 316 data_.handle = child_process_->GetHandle(); | 317 data_.handle = child_process_->GetHandle(); |
| 317 delegate_->OnProcessLaunched(); | 318 delegate_->OnProcessLaunched(); |
| 318 } | 319 } |
| OLD | NEW |