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

Unified Diff: mojo/public/cpp/system/handle.h

Issue 828373008: Allow constructing {Interface,Struct}Ptr from nullptr (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
Index: mojo/public/cpp/system/handle.h
diff --git a/mojo/public/cpp/system/handle.h b/mojo/public/cpp/system/handle.h
index 211d895d910b39edb286b5c5db75b80b2852da69..0c5adc77aa1f02825ace5845274597130b1387a0 100644
--- a/mojo/public/cpp/system/handle.h
+++ b/mojo/public/cpp/system/handle.h
@@ -84,7 +84,7 @@ namespace mojo {
// like the C++11 |unique_ptr|.
template <class HandleType>
class ScopedHandleBase {
- MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(ScopedHandleBase, RValue)
+ MOJO_MOVE_ONLY_TYPE(ScopedHandleBase)
public:
ScopedHandleBase() {}
@@ -96,11 +96,11 @@ class ScopedHandleBase {
: handle_(other.release()) {}
// Move-only constructor and operator=.
- ScopedHandleBase(RValue other) : handle_(other.object->release()) {}
- ScopedHandleBase& operator=(RValue other) {
- if (other.object != this) {
+ ScopedHandleBase(ScopedHandleBase&& other) : handle_(other.release()) {}
+ ScopedHandleBase& operator=(ScopedHandleBase&& other) {
+ if (&other != this) {
CloseIfNecessary();
- handle_ = other.object->release();
+ handle_ = other.release();
}
return *this;
}

Powered by Google App Engine
This is Rietveld 408576698