Chromium Code Reviews| Index: mojo/public/cpp/bindings/interface_handle.h |
| diff --git a/mojo/public/cpp/bindings/interface_handle.h b/mojo/public/cpp/bindings/interface_handle.h |
| index e03fad5203b4b37ff27b9e9c906090142675a833..79bc8c0585c6e2845be5ece944988cb73b9a05eb 100644 |
| --- a/mojo/public/cpp/bindings/interface_handle.h |
| +++ b/mojo/public/cpp/bindings/interface_handle.h |
| @@ -5,17 +5,23 @@ |
| #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_ |
| #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_INFO_H_ |
| +#include <cstddef> |
| + |
| #include "mojo/public/cpp/system/macros.h" |
| #include "mojo/public/cpp/system/message_pipe.h" |
| namespace mojo { |
| +template <typename Interface> |
| +class InterfacePtr; |
| + |
| // InterfaceHandle stores necessary information to communicate with a remote |
| // interface implementation, which could be used to construct an InterfacePtr. |
| template <typename Interface> |
| class InterfaceHandle { |
| public: |
| InterfaceHandle() : version_(0u) {} |
| + InterfaceHandle(std::nullptr_t) : version_(0u) {} |
| InterfaceHandle(ScopedMessagePipeHandle handle, uint32_t version) |
| : handle_(handle.Pass()), version_(version) {} |
| @@ -25,6 +31,10 @@ class InterfaceHandle { |
| other.version_ = 0u; |
| } |
| + InterfaceHandle(InterfacePtr<Interface> ptr) { |
|
viettrungluu
2016/02/10 01:04:08
&& probably.
To make this file compilable, probab
vardhan
2016/02/11 22:47:53
Done.
(to be clear, it will currently compile even
|
| + *this = ptr.PassInterfaceHandle(); |
| + } |
| + |
| ~InterfaceHandle() {} |
| InterfaceHandle& operator=(InterfaceHandle&& other) { |
| @@ -37,6 +47,8 @@ class InterfaceHandle { |
| return *this; |
| } |
| + // Tests as true if we have a valid handle. |
| + explicit operator bool() const { return is_valid(); } |
| bool is_valid() const { return handle_.is_valid(); } |
| ScopedMessagePipeHandle PassHandle() { return handle_.Pass(); } |