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