diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-29 17:43:44 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-29 17:43:44 +0000 |
commit | 276aa6a60396329c7fb4a988bd0be7f7d0895651 (patch) | |
tree | 62ed233e5faf34a14cf99fcbe49416b64e506d23 /base/process_posix.cc | |
parent | 57f9caa083ef107001b12ec6e455e23a5f94e420 (diff) | |
download | chromium_src-276aa6a60396329c7fb4a988bd0be7f7d0895651.zip chromium_src-276aa6a60396329c7fb4a988bd0be7f7d0895651.tar.gz chromium_src-276aa6a60396329c7fb4a988bd0be7f7d0895651.tar.bz2 |
Lower priorities of background tabs on linux.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/345009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30470 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_posix.cc')
-rw-r--r-- | base/process_posix.cc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/base/process_posix.cc b/base/process_posix.cc index f0e019a..29166b9 100644 --- a/base/process_posix.cc +++ b/base/process_posix.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <sys/resource.h> + #include "base/process.h" #include "base/process_util.h" @@ -9,7 +11,7 @@ namespace base { void Process::Close() { process_ = 0; - // if the process wasn't termiated (so we waited) or the state + // if the process wasn't terminated (so we waited) or the state // wasn't already collected w/ a wait from process_utils, we're gonna // end up w/ a zombie when it does finally exit. } @@ -23,18 +25,19 @@ void Process::Terminate(int result_code) { KillProcess(process_, result_code, false); } +#if !defined(OS_LINUX) bool Process::IsProcessBackgrounded() const { - // http://code.google.com/p/chromium/issues/detail?id=8083 + // See SetProcessBackgrounded(). return false; } bool Process::SetProcessBackgrounded(bool value) { - // http://code.google.com/p/chromium/issues/detail?id=8083 - // Just say we did it to keep renderer happy at the moment. Need to finish - // cleaning this up w/in higher layers since windows is probably the only - // one that can raise priorities w/o privileges. - return true; + // POSIX only allows lowering the priority of a process, so if we + // were to lower it we wouldn't be able to raise it back to its initial + // priority. + return false; } +#endif ProcessId Process::pid() const { if (process_ == 0) @@ -52,4 +55,9 @@ Process Process::Current() { return Process(GetCurrentProcessHandle()); } +int Process::GetPriority() const { + DCHECK(process_); + return getpriority(PRIO_PROCESS, process_); +} + } // namspace base |