|
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 |
|
3 // found in the LICENSE file. |
|
4 |
|
5 #include "base/process.h" |
|
6 #include "base/process_util.h" |
|
7 |
|
8 namespace base { |
|
9 |
|
10 void Process::Close() { |
|
11 process_ = 0; |
|
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 |
|
14 // end up w/ a zombie when it does finally exit. |
|
15 } |
|
16 |
|
17 void Process::Terminate(int result_code) { |
|
18 // result_code isn't supportable. |
|
19 if (!process_) |
|
20 return; |
|
21 // We don't wait here. It's the responsibility of other code to reap the |
|
22 // child. |
|
23 KillProcess(process_, result_code, false); |
|
24 } |
|
25 |
|
26 bool Process::IsProcessBackgrounded() const { |
|
27 // http://code.google.com/p/chromium/issues/detail?id=8083 |
|
28 return false; |
|
29 } |
|
30 |
|
31 bool Process::SetProcessBackgrounded(bool value) { |
|
32 // http://code.google.com/p/chromium/issues/detail?id=8083 |
|
33 // Just say we did it to keep renderer happy at the moment. Need to finish |
|
34 // cleaning this up w/in higher layers since windows is probably the only |
|
35 // one that can raise priorities w/o privileges. |
|
36 return true; |
|
37 } |
|
38 |
|
39 bool Process::EmptyWorkingSet() { |
|
40 // http://code.google.com/p/chromium/issues/detail?id=8083 |
|
41 return false; |
|
42 } |
|
43 |
|
44 ProcessId Process::pid() const { |
|
45 if (process_ == 0) |
|
46 return 0; |
|
47 |
|
48 return GetProcId(process_); |
|
49 } |
|
50 |
|
51 bool Process::is_current() const { |
|
52 return process_ == GetCurrentProcessHandle(); |
|
53 } |
|
54 |
|
55 // static |
|
56 Process Process::Current() { |
|
57 return Process(GetCurrentProcessHandle()); |
|
58 } |
|
59 |
|
60 } // namspace base |