summaryrefslogtreecommitdiffstats
path: root/mojo/public/cpp/bindings/interface_ptr.h
diff options
context:
space:
mode:
Diffstat (limited to 'mojo/public/cpp/bindings/interface_ptr.h')
-rw-r--r--mojo/public/cpp/bindings/interface_ptr.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/mojo/public/cpp/bindings/interface_ptr.h b/mojo/public/cpp/bindings/interface_ptr.h
index c56e770..a2ede4d 100644
--- a/mojo/public/cpp/bindings/interface_ptr.h
+++ b/mojo/public/cpp/bindings/interface_ptr.h
@@ -18,16 +18,22 @@ class ErrorHandler;
// InterfacePtr represents a proxy to a remote instance of an interface.
template <typename Interface>
class InterfacePtr {
- MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(InterfacePtr, RValue)
+ MOJO_MOVE_ONLY_TYPE(InterfacePtr)
public:
InterfacePtr() {}
+ InterfacePtr(decltype(nullptr)) {}
- InterfacePtr(RValue other) {
- internal_state_.Swap(&other.object->internal_state_);
+ InterfacePtr(InterfacePtr&& other) {
+ internal_state_.Swap(&other.internal_state_);
}
- InterfacePtr& operator=(RValue other) {
+ InterfacePtr& operator=(InterfacePtr&& other) {
+ reset();
+ internal_state_.Swap(&other.internal_state_);
+ return *this;
+ }
+
+ InterfacePtr& operator=(decltype(nullptr)) {
reset();
- internal_state_.Swap(&other.object->internal_state_);
return *this;
}