Chromium Code Reviews| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 #include <sys/resource.h> | 9 #include <sys/resource.h> |
| 10 #include <sys/wait.h> | 10 #include <sys/wait.h> |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 } | 218 } |
| 219 | 219 |
| 220 Process::~Process() { | 220 Process::~Process() { |
| 221 } | 221 } |
| 222 | 222 |
| 223 Process::Process(Process&& other) : process_(other.process_) { | 223 Process::Process(Process&& other) : process_(other.process_) { |
| 224 other.Close(); | 224 other.Close(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 Process& Process::operator=(Process&& other) { | 227 Process& Process::operator=(Process&& other) { |
| 228 DCHECK_NE(this, &other); | |
| 229 process_ = other.process_; | 228 process_ = other.process_; |
| 230 other.Close(); | 229 other.Close(); |
|
danakj
2017/04/05 19:17:40
How does this not close itself?
danakj
2017/04/05 20:33:41
This looks like a broken assignment period.
Proce
dyaroshev
2017/04/05 20:42:47
Closing actually just assigns a special value to h
danakj
2017/04/05 20:59:34
Hrm.. ok ya.. weird. That wasn't what I expected,
| |
| 231 return *this; | 230 return *this; |
| 232 } | 231 } |
| 233 | 232 |
| 234 // static | 233 // static |
| 235 Process Process::Current() { | 234 Process Process::Current() { |
| 236 return Process(GetCurrentProcessHandle()); | 235 return Process(GetCurrentProcessHandle()); |
| 237 } | 236 } |
| 238 | 237 |
| 239 // static | 238 // static |
| 240 Process Process::Open(ProcessId pid) { | 239 Process Process::Open(ProcessId pid) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 return false; | 380 return false; |
| 382 } | 381 } |
| 383 #endif // !defined(OS_LINUX) && !defined(OS_MACOSX) | 382 #endif // !defined(OS_LINUX) && !defined(OS_MACOSX) |
| 384 | 383 |
| 385 int Process::GetPriority() const { | 384 int Process::GetPriority() const { |
| 386 DCHECK(IsValid()); | 385 DCHECK(IsValid()); |
| 387 return getpriority(PRIO_PROCESS, process_); | 386 return getpriority(PRIO_PROCESS, process_); |
| 388 } | 387 } |
| 389 | 388 |
| 390 } // namespace base | 389 } // namespace base |
| OLD | NEW |