Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1534)

Side by Side Diff: base/process/process_win.cc

Issue 1407443002: Remove old C++03 move emulation code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: std::move and reflow Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/process/process_posix.cc ('k') | base/win/scoped_handle.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/win/windows_version.h" 11 #include "base/win/windows_version.h"
12 12
13 namespace { 13 namespace {
14 14
15 DWORD kBasicProcessAccess = 15 DWORD kBasicProcessAccess =
16 PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION | SYNCHRONIZE; 16 PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION | SYNCHRONIZE;
17 17
18 } // namespace 18 } // namespace
19 19
20 namespace base { 20 namespace base {
21 21
22 Process::Process(ProcessHandle handle) 22 Process::Process(ProcessHandle handle)
23 : is_current_process_(false), 23 : is_current_process_(false),
24 process_(handle) { 24 process_(handle) {
25 CHECK_NE(handle, ::GetCurrentProcess()); 25 CHECK_NE(handle, ::GetCurrentProcess());
26 } 26 }
27 27
28 Process::Process(RValue other) 28 Process::Process(Process&& other)
29 : is_current_process_(other.object->is_current_process_), 29 : is_current_process_(other.is_current_process_),
30 process_(other.object->process_.Take()) { 30 process_(other.process_.Take()) {
31 other.object->Close(); 31 other.Close();
32 } 32 }
33 33
34 Process::~Process() { 34 Process::~Process() {
35 } 35 }
36 36
37 Process& Process::operator=(RValue other) { 37 Process& Process::operator=(Process&& other) {
38 if (this != other.object) { 38 DCHECK_NE(this, &other);
39 process_.Set(other.object->process_.Take()); 39 process_.Set(other.process_.Take());
40 is_current_process_ = other.object->is_current_process_; 40 is_current_process_ = other.is_current_process_;
41 other.object->Close(); 41 other.Close();
42 }
43 return *this; 42 return *this;
44 } 43 }
45 44
46 // static 45 // static
47 Process Process::Current() { 46 Process Process::Current() {
48 Process process; 47 Process process;
49 process.is_current_process_ = true; 48 process.is_current_process_ = true;
50 return process.Pass(); 49 return process.Pass();
51 } 50 }
52 51
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 181
183 return (::SetPriorityClass(Handle(), priority) != 0); 182 return (::SetPriorityClass(Handle(), priority) != 0);
184 } 183 }
185 184
186 int Process::GetPriority() const { 185 int Process::GetPriority() const {
187 DCHECK(IsValid()); 186 DCHECK(IsValid());
188 return ::GetPriorityClass(Handle()); 187 return ::GetPriorityClass(Handle());
189 } 188 }
190 189
191 } // namespace base 190 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_posix.cc ('k') | base/win/scoped_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698