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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 break; | 199 break; |
200 } | 200 } |
201 disconnect_was_alive_ = true; | 201 disconnect_was_alive_ = true; |
202 #if defined(OS_WIN) | 202 #if defined(OS_WIN) |
203 child_watcher_.StartWatching(new base::WaitableEvent(handle()), this); | 203 child_watcher_.StartWatching(new base::WaitableEvent(handle()), this); |
204 #else | 204 #else |
205 // On non-Windows platforms, give the child process some time to die after | 205 // On non-Windows platforms, give the child process some time to die after |
206 // disconnecting the channel so that the exit code and termination status | 206 // disconnecting the channel so that the exit code and termination status |
207 // become available. This is best effort -- if the process doesn't die | 207 // become available. This is best effort -- if the process doesn't die |
208 // within the time limit, this object gets destroyed. | 208 // within the time limit, this object gets destroyed. |
209 const int kExitCodeWaitMs = 250; | 209 const base::TimeDelta kExitCodeWait = |
| 210 base::TimeDelta::FromMilliseconds(250); |
210 MessageLoop::current()->PostDelayedTask( | 211 MessageLoop::current()->PostDelayedTask( |
211 FROM_HERE, | 212 FROM_HERE, |
212 base::Bind(&BrowserChildProcessHost::OnChildDisconnected, | 213 base::Bind(&BrowserChildProcessHost::OnChildDisconnected, |
213 task_factory_.GetWeakPtr()), | 214 task_factory_.GetWeakPtr()), |
214 kExitCodeWaitMs); | 215 kExitCodeWait); |
215 #endif | 216 #endif |
216 return; | 217 return; |
217 } | 218 } |
218 | 219 |
219 default: | 220 default: |
220 break; | 221 break; |
221 } | 222 } |
222 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Disconnected", | 223 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Disconnected", |
223 this->type(), | 224 this->type(), |
224 content::PROCESS_TYPE_MAX); | 225 content::PROCESS_TYPE_MAX); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 296 |
296 return *iterator_; | 297 return *iterator_; |
297 } while (true); | 298 } while (true); |
298 | 299 |
299 return NULL; | 300 return NULL; |
300 } | 301 } |
301 | 302 |
302 bool BrowserChildProcessHost::Iterator::Done() { | 303 bool BrowserChildProcessHost::Iterator::Done() { |
303 return iterator_ == g_child_process_list.Get().end(); | 304 return iterator_ == g_child_process_list.Get().end(); |
304 } | 305 } |
OLD | NEW |