Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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.
5 #include "base/process.h"
6 #include "base/process_util.h"
8 namespace base {
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 }
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 }
26 bool Process::IsProcessBackgrounded() const {
27 // http://code.google.com/p/chromium/issues/detail?id=8083
28 return false;
29 }
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 }
39 bool Process::EmptyWorkingSet() {
40 // http://code.google.com/p/chromium/issues/detail?id=8083
41 return false;
42 }
44 ProcessId Process::pid() const {
45 if (process_ == 0)
46 return 0;
48 return GetProcId(process_);
49 }
51 bool Process::is_current() const {
52 return process_ == GetCurrentProcessHandle();
53 }
55 // static
56 Process Process::Current() {
57 return Process(GetCurrentProcessHandle());
58 }
60 } // namspace base