| 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 19 matching lines...) Expand all Loading... |
| 30 return *this; | 30 return *this; |
| 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 |
| 41 Process Process::DeprecatedGetProcessFromHandle(ProcessHandle handle) { |
| 42 DCHECK_NE(handle, GetCurrentProcessHandle()); |
| 43 return Process(handle); |
| 44 } |
| 45 |
| 40 #if !defined(OS_LINUX) | 46 #if !defined(OS_LINUX) |
| 41 // static | 47 // static |
| 42 bool Process::CanBackgroundProcesses() { | 48 bool Process::CanBackgroundProcesses() { |
| 43 return false; | 49 return false; |
| 44 } | 50 } |
| 45 #endif // !defined(OS_LINUX) | 51 #endif // !defined(OS_LINUX) |
| 46 | 52 |
| 47 bool Process::IsValid() const { | 53 bool Process::IsValid() const { |
| 48 return process_ != kNullProcessHandle; | 54 return process_ != kNullProcessHandle; |
| 49 } | 55 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 return false; | 104 return false; |
| 99 } | 105 } |
| 100 #endif // !defined(OS_LINUX) | 106 #endif // !defined(OS_LINUX) |
| 101 | 107 |
| 102 int Process::GetPriority() const { | 108 int Process::GetPriority() const { |
| 103 DCHECK(IsValid()); | 109 DCHECK(IsValid()); |
| 104 return getpriority(PRIO_PROCESS, process_); | 110 return getpriority(PRIO_PROCESS, process_); |
| 105 } | 111 } |
| 106 | 112 |
| 107 } // namspace base | 113 } // namspace base |
| OLD | NEW |