| 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/process/kill.h" | 9 #include "base/process/kill.h" |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 // static | 42 // static |
| 43 Process Process::Current() { | 43 Process Process::Current() { |
| 44 Process process; | 44 Process process; |
| 45 process.is_current_process_ = true; | 45 process.is_current_process_ = true; |
| 46 return process.Pass(); | 46 return process.Pass(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // static | 49 // static |
| 50 Process Process::Open(ProcessId pid) { |
| 51 return Process(::OpenProcess(kBasicProcessAccess, FALSE, pid)); |
| 52 } |
| 53 |
| 54 // static |
| 50 Process Process::OpenWithExtraPriviles(ProcessId pid) { | 55 Process Process::OpenWithExtraPriviles(ProcessId pid) { |
| 51 DWORD access = kBasicProcessAccess | PROCESS_DUP_HANDLE | PROCESS_VM_READ; | 56 DWORD access = kBasicProcessAccess | PROCESS_DUP_HANDLE | PROCESS_VM_READ; |
| 52 ProcessHandle handle = ::OpenProcess(access, FALSE, pid); | 57 return Process(::OpenProcess(access, FALSE, pid)); |
| 53 return Process(handle); | |
| 54 } | 58 } |
| 55 | 59 |
| 56 // static | 60 // static |
| 57 Process Process::OpenWithAccess(ProcessId pid, DWORD desired_access) { | 61 Process Process::OpenWithAccess(ProcessId pid, DWORD desired_access) { |
| 58 return Process(::OpenProcess(desired_access, FALSE, pid)); | 62 return Process(::OpenProcess(desired_access, FALSE, pid)); |
| 59 } | 63 } |
| 60 | 64 |
| 61 // static | 65 // static |
| 62 Process Process::DeprecatedGetProcessFromHandle(ProcessHandle handle) { | 66 Process Process::DeprecatedGetProcessFromHandle(ProcessHandle handle) { |
| 63 DCHECK_NE(handle, ::GetCurrentProcess()); | 67 DCHECK_NE(handle, ::GetCurrentProcess()); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 170 |
| 167 return (::SetPriorityClass(Handle(), priority) != 0); | 171 return (::SetPriorityClass(Handle(), priority) != 0); |
| 168 } | 172 } |
| 169 | 173 |
| 170 int Process::GetPriority() const { | 174 int Process::GetPriority() const { |
| 171 DCHECK(IsValid()); | 175 DCHECK(IsValid()); |
| 172 return ::GetPriorityClass(Handle()); | 176 return ::GetPriorityClass(Handle()); |
| 173 } | 177 } |
| 174 | 178 |
| 175 } // namespace base | 179 } // namespace base |
| OLD | NEW |