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