Chromium Code Reviews| Index: base/win/scoped_handle.h |
| diff --git a/base/win/scoped_handle.h b/base/win/scoped_handle.h |
| index 3378d004f32c96386cf29ef8defeee157ef9e51b..7111c1a87e9012aff15bf28748e687be805cf45a 100644 |
| --- a/base/win/scoped_handle.h |
| +++ b/base/win/scoped_handle.h |
| @@ -49,7 +49,8 @@ class GenericScopedHandle { |
| } |
| // Move constructor for C++03 move emulation of this type. |
| - GenericScopedHandle(RValue& other) : handle_(other.Take()) { |
| + GenericScopedHandle(RValue& other) : handle_(Traits::NullHandle()) { |
| + Set(other.Take()); |
|
Wez
2012/08/10 17:03:47
Are these changes from another CL?
alexeypa (please no reviews)
2012/08/10 17:12:24
This is from an already submitted CL.
|
| } |
| ~GenericScopedHandle() { |
| @@ -62,9 +63,9 @@ class GenericScopedHandle { |
| // Move operator= for C++03 move emulation of this type. |
| GenericScopedHandle& operator=(RValue& other) { |
| - // Swapping the handles helps to avoid problems while assigning a handle |
| - // to itself. It is also cheap and matches base::scoped_ptr behavior. |
| - Swap(other); |
| + if (this != &other) { |
| + Set(other.Take()); |
| + } |
| return *this; |
| } |
| @@ -97,12 +98,6 @@ class GenericScopedHandle { |
| return &handle_; |
| } |
| - void Swap(GenericScopedHandle& other) { |
| - Handle tmp = handle_; |
| - handle_ = other.handle_; |
| - other.handle_ = tmp; |
| - } |
| - |
| // Transfers ownership away from this object. |
| Handle Take() { |
| Handle temp = handle_; |