OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 "base/process.h" | 5 #include "base/process.h" |
6 #include "base/process_util.h" | 6 #include "base/process_util.h" |
7 | 7 |
8 namespace base { | 8 namespace base { |
9 | 9 |
10 void Process::Close() { | 10 void Process::Close() { |
11 process_ = 0; | 11 process_ = 0; |
12 // if the process wasn't termiated (so we waited) or the state | 12 // if the process wasn't termiated (so we waited) or the state |
13 // wasn't already collected w/ a wait from process_utils, we're gonna | 13 // wasn't already collected w/ a wait from process_utils, we're gonna |
14 // end up w/ a zombie when it does finally exit. | 14 // end up w/ a zombie when it does finally exit. |
15 } | 15 } |
16 | 16 |
17 void Process::Terminate(int result_code) { | 17 void Process::Terminate(int result_code) { |
18 // result_code isn't supportable. | 18 // result_code isn't supportable. |
19 if (!process_) | 19 if (!process_) |
20 return; | 20 return; |
21 // Wait so we clean up the zombie | 21 // We don't wait here. It's the responsibility of other code to reap the |
22 KillProcess(process_, result_code, true); | 22 // child. |
| 23 KillProcess(process_, result_code, false); |
23 } | 24 } |
24 | 25 |
25 bool Process::IsProcessBackgrounded() const { | 26 bool Process::IsProcessBackgrounded() const { |
26 // http://code.google.com/p/chromium/issues/detail?id=8083 | 27 // http://code.google.com/p/chromium/issues/detail?id=8083 |
27 return false; | 28 return false; |
28 } | 29 } |
29 | 30 |
30 bool Process::SetProcessBackgrounded(bool value) { | 31 bool Process::SetProcessBackgrounded(bool value) { |
31 // http://code.google.com/p/chromium/issues/detail?id=8083 | 32 // http://code.google.com/p/chromium/issues/detail?id=8083 |
32 // Just say we did it to keep renderer happy at the moment. Need to finish | 33 // Just say we did it to keep renderer happy at the moment. Need to finish |
(...skipping 27 matching lines...) Expand all Loading... |
60 bool Process::is_current() const { | 61 bool Process::is_current() const { |
61 return process_ == GetCurrentProcessHandle(); | 62 return process_ == GetCurrentProcessHandle(); |
62 } | 63 } |
63 | 64 |
64 // static | 65 // static |
65 Process Process::Current() { | 66 Process Process::Current() { |
66 return Process(GetCurrentProcessHandle()); | 67 return Process(GetCurrentProcessHandle()); |
67 } | 68 } |
68 | 69 |
69 } // namspace base | 70 } // namspace base |
OLD | NEW |