From e1b0277c20198c31b8782f567634552243182d08 Mon Sep 17 00:00:00 2001 From: dcheng Date: Tue, 1 Dec 2015 04:09:52 -0800 Subject: 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} --- dbus/file_descriptor.cc | 9 ++++----- dbus/file_descriptor.h | 8 +++----- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'dbus') diff --git a/dbus/file_descriptor.cc b/dbus/file_descriptor.cc index c740f28..b690881 100644 --- a/dbus/file_descriptor.cc +++ b/dbus/file_descriptor.cc @@ -21,9 +21,8 @@ void CHROME_DBUS_EXPORT FileDescriptor::Deleter::operator()( FROM_HERE, base::Bind(&base::DeletePointer, fd), false); } -FileDescriptor::FileDescriptor(RValue other) - : value_(-1), owner_(false), valid_(false) { - Swap(other.object); +FileDescriptor::FileDescriptor(FileDescriptor&& other) : FileDescriptor() { + Swap(&other); } FileDescriptor::~FileDescriptor() { @@ -31,8 +30,8 @@ FileDescriptor::~FileDescriptor() { base::File auto_closer(value_); } -FileDescriptor& FileDescriptor::operator=(RValue other) { - Swap(other.object); +FileDescriptor& FileDescriptor::operator=(FileDescriptor&& other) { + Swap(&other); return *this; } diff --git a/dbus/file_descriptor.h b/dbus/file_descriptor.h index 8a41097..41f7b4e 100644 --- a/dbus/file_descriptor.h +++ b/dbus/file_descriptor.h @@ -34,7 +34,7 @@ namespace dbus { // also allows the caller to do this work on the File thread to conform // with i/o restrictions. class CHROME_DBUS_EXPORT FileDescriptor { - MOVE_ONLY_TYPE_FOR_CPP_03(FileDescriptor, RValue); + MOVE_ONLY_TYPE_FOR_CPP_03(FileDescriptor); public: // This provides a simple way to pass around file descriptors since they must @@ -49,13 +49,11 @@ class CHROME_DBUS_EXPORT FileDescriptor { explicit FileDescriptor(int value) : value_(value), owner_(false), valid_(false) {} - // Move constructor for C++03 move emulation of this type. - FileDescriptor(RValue other); + FileDescriptor(FileDescriptor&& other); virtual ~FileDescriptor(); - // Move operator= for C++03 move emulation of this type. - FileDescriptor& operator=(RValue other); + FileDescriptor& operator=(FileDescriptor&& other); // Retrieves value as an int without affecting ownership. int value() const; -- cgit v1.1