| 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/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
| 8 | 8 |
| 9 namespace base { | 9 namespace base { |
| 10 | 10 |
| 11 void Process::Close() { | 11 void Process::Close() { |
| 12 process_ = 0; | 12 process_ = 0; |
| 13 // if the process wasn't termiated (so we waited) or the state | 13 // if the process wasn't termiated (so we waited) or the state |
| 14 // wasn't already collected w/ a wait from process_utils, we're gonna | 14 // wasn't already collected w/ a wait from process_utils, we're gonna |
| 15 // end up w/ a zombie when it does finally exit. | 15 // end up w/ a zombie when it does finally exit. |
| 16 } | 16 } |
| 17 | 17 |
| 18 void Process::Terminate(int result_code) { | 18 void Process::Terminate(int result_code) { |
| 19 // result_code isn't supportable. | 19 // result_code isn't supportable. |
| 20 if (!process_) | 20 if (!process_) |
| 21 return; | 21 return; |
| 22 // Wait so we clean up the zombie | 22 // Wait so we clean up the zombie |
| 23 KillProcess(process_, result_code, true); | 23 KillProcess(process_, result_code, true); |
| 24 } | 24 } |
| 25 | 25 |
| 26 bool Process::IsProcessBackgrounded() const { | 26 bool Process::IsProcessBackgrounded() const { |
| 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 NOTIMPLEMENTED(); | 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 |
| 33 // cleaning this up w/in higher layers since windows is probably the only | 34 // cleaning this up w/in higher layers since windows is probably the only |
| 34 // one that can raise priorities w/o privileges. | 35 // one that can raise priorities w/o privileges. |
| 35 return true; | 36 return true; |
| 36 } | 37 } |
| 37 | 38 |
| 38 bool Process::ReduceWorkingSet() { | 39 bool Process::ReduceWorkingSet() { |
| 39 NOTIMPLEMENTED(); | 40 // http://code.google.com/p/chromium/issues/detail?id=8083 |
| 40 return false; | 41 return false; |
| 41 } | 42 } |
| 42 | 43 |
| 43 bool Process::UnReduceWorkingSet() { | 44 bool Process::UnReduceWorkingSet() { |
| 44 NOTIMPLEMENTED(); | 45 // http://code.google.com/p/chromium/issues/detail?id=8083 |
| 45 return false; | 46 return false; |
| 46 } | 47 } |
| 47 | 48 |
| 48 bool Process::EmptyWorkingSet() { | 49 bool Process::EmptyWorkingSet() { |
| 49 NOTIMPLEMENTED(); | 50 // http://code.google.com/p/chromium/issues/detail?id=8083 |
| 50 return false; | 51 return false; |
| 51 } | 52 } |
| 52 | 53 |
| 53 int32 Process::pid() const { | 54 int32 Process::pid() const { |
| 54 if (process_ == 0) | 55 if (process_ == 0) |
| 55 return 0; | 56 return 0; |
| 56 | 57 |
| 57 return GetProcId(process_); | 58 return GetProcId(process_); |
| 58 } | 59 } |
| 59 | 60 |
| 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 |