| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/process.h" | 5 #include "base/process/process.h" |
| 6 | 6 |
| 7 #include <sys/resource.h> | 7 #include <sys/resource.h> |
| 8 #include <sys/time.h> | 8 #include <sys/time.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 } | 31 } |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 Process Process::Current() { | 34 Process Process::Current() { |
| 35 Process process; | 35 Process process; |
| 36 process.process_ = GetCurrentProcessHandle(); | 36 process.process_ = GetCurrentProcessHandle(); |
| 37 return process.Pass(); | 37 return process.Pass(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 // static | 40 // static |
| 41 Process Process::OpenWithExtraPriviles(ProcessId pid) { |
| 42 if (pid == GetCurrentProcId()) |
| 43 return Current(); |
| 44 |
| 45 // On POSIX process handles are the same as PIDs, and there are no privileges |
| 46 // to set. |
| 47 return Process(pid); |
| 48 } |
| 49 |
| 50 // static |
| 41 Process Process::DeprecatedGetProcessFromHandle(ProcessHandle handle) { | 51 Process Process::DeprecatedGetProcessFromHandle(ProcessHandle handle) { |
| 42 DCHECK_NE(handle, GetCurrentProcessHandle()); | 52 DCHECK_NE(handle, GetCurrentProcessHandle()); |
| 43 return Process(handle); | 53 return Process(handle); |
| 44 } | 54 } |
| 45 | 55 |
| 46 #if !defined(OS_LINUX) | 56 #if !defined(OS_LINUX) |
| 47 // static | 57 // static |
| 48 bool Process::CanBackgroundProcesses() { | 58 bool Process::CanBackgroundProcesses() { |
| 49 return false; | 59 return false; |
| 50 } | 60 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 return false; | 126 return false; |
| 117 } | 127 } |
| 118 #endif // !defined(OS_LINUX) | 128 #endif // !defined(OS_LINUX) |
| 119 | 129 |
| 120 int Process::GetPriority() const { | 130 int Process::GetPriority() const { |
| 121 DCHECK(IsValid()); | 131 DCHECK(IsValid()); |
| 122 return getpriority(PRIO_PROCESS, process_); | 132 return getpriority(PRIO_PROCESS, process_); |
| 123 } | 133 } |
| 124 | 134 |
| 125 } // namspace base | 135 } // namspace base |
| OLD | NEW |