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

Unified Diff: base/win/scoped_handle.h

Issue 11078014: Fix move.h's to use a concrete RValue carrier object rather than hacking a RValue&. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adding ☃. Created 8 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/move.h ('k') | chrome/browser/usb/usb_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/win/scoped_handle.h
diff --git a/base/win/scoped_handle.h b/base/win/scoped_handle.h
index 62734b631c54e43a1d5a9938c065ca42fd7bd8e4..e08aa8655bffba6b321a780d8110711b9a588623 100644
--- a/base/win/scoped_handle.h
+++ b/base/win/scoped_handle.h
@@ -49,8 +49,10 @@ class GenericScopedHandle {
}
// Move constructor for C++03 move emulation of this type.
- GenericScopedHandle(RValue& other) : handle_(Traits::NullHandle()) {
- Set(other.Take());
+ GenericScopedHandle(RValue other) : handle_(Traits::NullHandle()) {
+ if (this != other.object) {
Jeffrey Yasskin 2012/10/12 20:34:47 I think this can never be false.
awong 2012/10/12 20:44:12 Oops. This was a error during a revert. Fixed.
+ Set(other.object->Take());
+ }
}
~GenericScopedHandle() {
@@ -62,10 +64,8 @@ class GenericScopedHandle {
}
// Move operator= for C++03 move emulation of this type.
- GenericScopedHandle& operator=(RValue& other) {
- if (this != &other) {
- Set(other.Take());
- }
+ GenericScopedHandle& operator=(RValue other) {
+ Set(other.object->Take());
return *this;
}
« no previous file with comments | « base/move.h ('k') | chrome/browser/usb/usb_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698