| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
| 10 #include "base/process/kill.h" | 10 #include "base/process/kill.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 process_.Set(other.process_.Take()); | 39 process_.Set(other.process_.Take()); |
| 40 is_current_process_ = other.is_current_process_; | 40 is_current_process_ = other.is_current_process_; |
| 41 other.Close(); | 41 other.Close(); |
| 42 return *this; | 42 return *this; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // static | 45 // static |
| 46 Process Process::Current() { | 46 Process Process::Current() { |
| 47 Process process; | 47 Process process; |
| 48 process.is_current_process_ = true; | 48 process.is_current_process_ = true; |
| 49 return process.Pass(); | 49 return process; |
| 50 } | 50 } |
| 51 | 51 |
| 52 // static | 52 // static |
| 53 Process Process::Open(ProcessId pid) { | 53 Process Process::Open(ProcessId pid) { |
| 54 return Process(::OpenProcess(kBasicProcessAccess, FALSE, pid)); | 54 return Process(::OpenProcess(kBasicProcessAccess, FALSE, pid)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // static | 57 // static |
| 58 Process Process::OpenWithExtraPrivileges(ProcessId pid) { | 58 Process Process::OpenWithExtraPrivileges(ProcessId pid) { |
| 59 DWORD access = kBasicProcessAccess | PROCESS_DUP_HANDLE | PROCESS_VM_READ; | 59 DWORD access = kBasicProcessAccess | PROCESS_DUP_HANDLE | PROCESS_VM_READ; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 return (::SetPriorityClass(Handle(), priority) != 0); | 182 return (::SetPriorityClass(Handle(), priority) != 0); |
| 183 } | 183 } |
| 184 | 184 |
| 185 int Process::GetPriority() const { | 185 int Process::GetPriority() const { |
| 186 DCHECK(IsValid()); | 186 DCHECK(IsValid()); |
| 187 return ::GetPriorityClass(Handle()); | 187 return ::GetPriorityClass(Handle()); |
| 188 } | 188 } |
| 189 | 189 |
| 190 } // namespace base | 190 } // namespace base |
| OLD | NEW |