| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 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/wait.h> | 8 #include <sys/wait.h> |
| 9 | 9 |
| 10 #include "base/files/scoped_file.h" | 10 #include "base/files/scoped_file.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } // namespace | 209 } // namespace |
| 210 | 210 |
| 211 namespace base { | 211 namespace base { |
| 212 | 212 |
| 213 Process::Process(ProcessHandle handle) : process_(handle) { | 213 Process::Process(ProcessHandle handle) : process_(handle) { |
| 214 } | 214 } |
| 215 | 215 |
| 216 Process::~Process() { | 216 Process::~Process() { |
| 217 } | 217 } |
| 218 | 218 |
| 219 Process::Process(RValue other) | 219 Process::Process(Process&& other) : process_(other.process_) { |
| 220 : process_(other.object->process_) { | 220 other.Close(); |
| 221 other.object->Close(); | |
| 222 } | 221 } |
| 223 | 222 |
| 224 Process& Process::operator=(RValue other) { | 223 Process& Process::operator=(Process&& other) { |
| 225 if (this != other.object) { | 224 DCHECK_NE(this, &other); |
| 226 process_ = other.object->process_; | 225 process_ = other.process_; |
| 227 other.object->Close(); | 226 other.Close(); |
| 228 } | |
| 229 return *this; | 227 return *this; |
| 230 } | 228 } |
| 231 | 229 |
| 232 // static | 230 // static |
| 233 Process Process::Current() { | 231 Process Process::Current() { |
| 234 return Process(GetCurrentProcessHandle()); | 232 return Process(GetCurrentProcessHandle()); |
| 235 } | 233 } |
| 236 | 234 |
| 237 // static | 235 // static |
| 238 Process Process::Open(ProcessId pid) { | 236 Process Process::Open(ProcessId pid) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 return false; | 369 return false; |
| 372 } | 370 } |
| 373 #endif // !defined(OS_LINUX) | 371 #endif // !defined(OS_LINUX) |
| 374 | 372 |
| 375 int Process::GetPriority() const { | 373 int Process::GetPriority() const { |
| 376 DCHECK(IsValid()); | 374 DCHECK(IsValid()); |
| 377 return getpriority(PRIO_PROCESS, process_); | 375 return getpriority(PRIO_PROCESS, process_); |
| 378 } | 376 } |
| 379 | 377 |
| 380 } // namespace base | 378 } // namespace base |
| OLD | NEW |