| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/child_process_launcher.h" | 5 #include "chrome/browser/child_process_launcher.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/thread.h" | 10 #include "base/thread.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 #endif | 305 #endif |
| 306 { | 306 { |
| 307 did_crash = base::DidProcessCrash(&child_exited, handle); | 307 did_crash = base::DidProcessCrash(&child_exited, handle); |
| 308 } | 308 } |
| 309 | 309 |
| 310 // POSIX: If the process crashed, then the kernel closed the socket for it | 310 // POSIX: If the process crashed, then the kernel closed the socket for it |
| 311 // and so the child has already died by the time we get here. Since | 311 // and so the child has already died by the time we get here. Since |
| 312 // DidProcessCrash called waitpid with WNOHANG, it'll reap the process. | 312 // DidProcessCrash called waitpid with WNOHANG, it'll reap the process. |
| 313 // However, if DidProcessCrash didn't reap the child, we'll need to in | 313 // However, if DidProcessCrash didn't reap the child, we'll need to in |
| 314 // Terminate via ProcessWatcher. So we can't close the handle here. | 314 // Terminate via ProcessWatcher. So we can't close the handle here. |
| 315 // | |
| 316 // This is moot on Windows where |child_exited| will always be true. | |
| 317 if (child_exited) | 315 if (child_exited) |
| 318 context_->process_.Close(); | 316 context_->process_.Close(); |
| 319 | 317 |
| 320 return did_crash; | 318 return did_crash; |
| 321 } | 319 } |
| 322 | 320 |
| 323 void ChildProcessLauncher::SetProcessBackgrounded(bool background) { | 321 void ChildProcessLauncher::SetProcessBackgrounded(bool background) { |
| 324 DCHECK(!context_->starting_); | 322 DCHECK(!context_->starting_); |
| 325 context_->process_.SetProcessBackgrounded(background); | 323 context_->process_.SetProcessBackgrounded(background); |
| 326 } | 324 } |
| OLD | NEW |