| 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.h" | 5 #include "content/browser/browser_child_process_host.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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } | 209 } |
| 210 disconnect_was_alive_ = true; | 210 disconnect_was_alive_ = true; |
| 211 #if defined(OS_WIN) | 211 #if defined(OS_WIN) |
| 212 child_watcher_.StartWatching( | 212 child_watcher_.StartWatching( |
| 213 new base::WaitableEvent(data().handle), this); | 213 new base::WaitableEvent(data().handle), this); |
| 214 #else | 214 #else |
| 215 // On non-Windows platforms, give the child process some time to die after | 215 // On non-Windows platforms, give the child process some time to die after |
| 216 // disconnecting the channel so that the exit code and termination status | 216 // disconnecting the channel so that the exit code and termination status |
| 217 // become available. This is best effort -- if the process doesn't die | 217 // become available. This is best effort -- if the process doesn't die |
| 218 // within the time limit, this object gets destroyed. | 218 // within the time limit, this object gets destroyed. |
| 219 const int kExitCodeWaitMs = 250; | 219 const base::TimeDelta kExitCodeWait = |
| 220 base::TimeDelta::FromMilliseconds(250); |
| 220 MessageLoop::current()->PostDelayedTask( | 221 MessageLoop::current()->PostDelayedTask( |
| 221 FROM_HERE, | 222 FROM_HERE, |
| 222 base::Bind(&BrowserChildProcessHost::OnChildDisconnected, | 223 base::Bind(&BrowserChildProcessHost::OnChildDisconnected, |
| 223 task_factory_.GetWeakPtr()), | 224 task_factory_.GetWeakPtr()), |
| 224 kExitCodeWaitMs); | 225 kExitCodeWait); |
| 225 #endif | 226 #endif |
| 226 return; | 227 return; |
| 227 } | 228 } |
| 228 | 229 |
| 229 default: | 230 default: |
| 230 break; | 231 break; |
| 231 } | 232 } |
| 232 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Disconnected", | 233 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Disconnected", |
| 233 data().type, | 234 data().type, |
| 234 content::PROCESS_TYPE_MAX); | 235 content::PROCESS_TYPE_MAX); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 306 |
| 306 return *iterator_; | 307 return *iterator_; |
| 307 } while (true); | 308 } while (true); |
| 308 | 309 |
| 309 return NULL; | 310 return NULL; |
| 310 } | 311 } |
| 311 | 312 |
| 312 bool BrowserChildProcessHost::Iterator::Done() { | 313 bool BrowserChildProcessHost::Iterator::Done() { |
| 313 return iterator_ == g_child_process_list.Get().end(); | 314 return iterator_ == g_child_process_list.Get().end(); |
| 314 } | 315 } |
| OLD | NEW |