michael@0: // Copyright (c) 2008 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #include "base/process.h" michael@0: #include "base/process_util.h" michael@0: michael@0: namespace base { michael@0: michael@0: void Process::Close() { michael@0: process_ = 0; michael@0: // if the process wasn't termiated (so we waited) or the state michael@0: // wasn't already collected w/ a wait from process_utils, we're gonna michael@0: // end up w/ a zombie when it does finally exit. michael@0: } michael@0: michael@0: void Process::Terminate(int result_code) { michael@0: // result_code isn't supportable. michael@0: if (!process_) michael@0: return; michael@0: // We don't wait here. It's the responsibility of other code to reap the michael@0: // child. michael@0: KillProcess(process_, result_code, false); michael@0: } michael@0: michael@0: bool Process::IsProcessBackgrounded() const { michael@0: // http://code.google.com/p/chromium/issues/detail?id=8083 michael@0: return false; michael@0: } michael@0: michael@0: bool Process::SetProcessBackgrounded(bool value) { michael@0: // http://code.google.com/p/chromium/issues/detail?id=8083 michael@0: // Just say we did it to keep renderer happy at the moment. Need to finish michael@0: // cleaning this up w/in higher layers since windows is probably the only michael@0: // one that can raise priorities w/o privileges. michael@0: return true; michael@0: } michael@0: michael@0: bool Process::EmptyWorkingSet() { michael@0: // http://code.google.com/p/chromium/issues/detail?id=8083 michael@0: return false; michael@0: } michael@0: michael@0: ProcessId Process::pid() const { michael@0: if (process_ == 0) michael@0: return 0; michael@0: michael@0: return GetProcId(process_); michael@0: } michael@0: michael@0: bool Process::is_current() const { michael@0: return process_ == GetCurrentProcessHandle(); michael@0: } michael@0: michael@0: // static michael@0: Process Process::Current() { michael@0: return Process(GetCurrentProcessHandle()); michael@0: } michael@0: michael@0: } // namspace base