Chromium Code Reviews| Index: dbus/file_descriptor.cc |
| diff --git a/dbus/file_descriptor.cc b/dbus/file_descriptor.cc |
| index e607fc01356d8ca284f0ea1732150a0a43a3bf69..472f5718f0041d44ef9039972346aaa7558e11c6 100644 |
| --- a/dbus/file_descriptor.cc |
| +++ b/dbus/file_descriptor.cc |
| @@ -17,11 +17,30 @@ void CHROME_DBUS_EXPORT FileDescriptor::Deleter::operator()( |
| FROM_HERE, base::Bind(&base::DeletePointer<FileDescriptor>, fd), false); |
| } |
| +FileDescriptor::FileDescriptor(RValue other) |
| + : value_(other.object->value_), |
| + owner_(other.object->owner_), |
| + valid_(other.object->valid_) { |
| + other.object->value_ = -1; |
| + other.object->valid_ = false; |
| + other.object->owner_ = false; |
| +} |
| + |
| FileDescriptor::~FileDescriptor() { |
| if (owner_) |
| base::File auto_closer(value_); |
| } |
| +FileDescriptor& FileDescriptor::operator=(RValue other) { |
| + value_ = other.object->value_; |
|
Alex Vakulenko
2015/06/10 18:55:47
I think here you should do just std::swap() on eac
Reilly Grant (use Gerrit)
2015/06/10 19:21:10
Done.
|
| + owner_ = other.object->owner_; |
| + valid_ = other.object->valid_; |
| + other.object->value_ = -1; |
| + other.object->valid_ = false; |
| + other.object->owner_ = false; |
| + return *this; |
| +} |
| + |
| int FileDescriptor::value() const { |
| CHECK(valid_); |
| return value_; |