diff options
author | dcheng <dcheng@chromium.org> | 2015-12-01 04:09:52 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-01 12:10:42 +0000 |
commit | e1b0277c20198c31b8782f567634552243182d08 (patch) | |
tree | 75fde33e5410051ddff4de64bbdd9766d294ef25 /base/process | |
parent | 7f54a6c611e793e47712cd4a988a46b5fbbdfd07 (diff) | |
download | chromium_src-e1b0277c20198c31b8782f567634552243182d08.zip chromium_src-e1b0277c20198c31b8782f567634552243182d08.tar.gz chromium_src-e1b0277c20198c31b8782f567634552243182d08.tar.bz2 |
Remove old C++03 move emulation code.
Chrome allows the use of C++11 features now, so just use rvalue
references directly.
BUG=543901
Review URL: https://codereview.chromium.org/1407443002
Cr-Commit-Position: refs/heads/master@{#362394}
Diffstat (limited to 'base/process')
-rw-r--r-- | base/process/process.h | 8 | ||||
-rw-r--r-- | base/process/process_posix.cc | 14 | ||||
-rw-r--r-- | base/process/process_win.cc | 19 |
3 files changed, 18 insertions, 23 deletions
diff --git a/base/process/process.h b/base/process/process.h index 6ff7d76..36f8574 100644 --- a/base/process/process.h +++ b/base/process/process.h @@ -32,19 +32,17 @@ namespace base { // the process dies, and it may be reused by the system, which means that it may // end up pointing to the wrong process. class BASE_EXPORT Process { - MOVE_ONLY_TYPE_FOR_CPP_03(Process, RValue) + MOVE_ONLY_TYPE_FOR_CPP_03(Process) public: explicit Process(ProcessHandle handle = kNullProcessHandle); - // Move constructor for C++03 move emulation of this type. - Process(RValue other); + Process(Process&& other); // The destructor does not terminate the process. ~Process(); - // Move operator= for C++03 move emulation of this type. - Process& operator=(RValue other); + Process& operator=(Process&& other); // Returns an object for the current process. static Process Current(); diff --git a/base/process/process_posix.cc b/base/process/process_posix.cc index 2320ce7..7b2eed7 100644 --- a/base/process/process_posix.cc +++ b/base/process/process_posix.cc @@ -217,16 +217,14 @@ Process::Process(ProcessHandle handle) : process_(handle) { Process::~Process() { } -Process::Process(RValue other) - : process_(other.object->process_) { - other.object->Close(); +Process::Process(Process&& other) : process_(other.process_) { + other.Close(); } -Process& Process::operator=(RValue other) { - if (this != other.object) { - process_ = other.object->process_; - other.object->Close(); - } +Process& Process::operator=(Process&& other) { + DCHECK_NE(this, &other); + process_ = other.process_; + other.Close(); return *this; } diff --git a/base/process/process_win.cc b/base/process/process_win.cc index 818864f..e7f35b3 100644 --- a/base/process/process_win.cc +++ b/base/process/process_win.cc @@ -25,21 +25,20 @@ Process::Process(ProcessHandle handle) CHECK_NE(handle, ::GetCurrentProcess()); } -Process::Process(RValue other) - : is_current_process_(other.object->is_current_process_), - process_(other.object->process_.Take()) { - other.object->Close(); +Process::Process(Process&& other) + : is_current_process_(other.is_current_process_), + process_(other.process_.Take()) { + other.Close(); } Process::~Process() { } -Process& Process::operator=(RValue other) { - if (this != other.object) { - process_.Set(other.object->process_.Take()); - is_current_process_ = other.object->is_current_process_; - other.object->Close(); - } +Process& Process::operator=(Process&& other) { + DCHECK_NE(this, &other); + process_.Set(other.process_.Take()); + is_current_process_ = other.is_current_process_; + other.Close(); return *this; } |