diff options
author | Luis Hector Chavez <lhchavez@google.com> | 2017-07-26 17:38:05 +0000 |
---|---|---|
committer | Luis Hector Chavez <lhchavez@google.com> | 2017-07-26 17:38:05 +0000 |
commit | 21a249e4d9cb0b2ec6f0ff84ed5f7939ea67ac52 (patch) | |
tree | d380c2689495d31fd250cf8f1d0ceebbdd4cf250 /mojo/public/cpp/bindings/interface_request.h | |
parent | 8ac9103e05b66812c25348943383f9365d1ce3e0 (diff) | |
download | libmojo-21a249e4d9cb0b2ec6f0ff84ed5f7939ea67ac52.tar.gz |
Revert "libmojo: Uprev the library to r456626 from Chromium"
This reverts commit 8ac9103e05b66812c25348943383f9365d1ce3e0.
Reason for revert: Broke the mac_sdk
Exempt-From-Owner-Approval: Fixing mac_sdk
Change-Id: I0b74d1abaa66933a93fd6f82ff018e8948c1204e
Diffstat (limited to 'mojo/public/cpp/bindings/interface_request.h')
-rw-r--r-- | mojo/public/cpp/bindings/interface_request.h | 45 |
1 files changed, 8 insertions, 37 deletions
diff --git a/mojo/public/cpp/bindings/interface_request.h b/mojo/public/cpp/bindings/interface_request.h index 29d8836..fc23aec 100644 --- a/mojo/public/cpp/bindings/interface_request.h +++ b/mojo/public/cpp/bindings/interface_request.h @@ -5,17 +5,12 @@ #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_REQUEST_H_ -#include <string> #include <utility> #include "base/macros.h" -#include "base/optional.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" -#include "mojo/public/cpp/bindings/disconnect_reason.h" #include "mojo/public/cpp/bindings/interface_ptr.h" -#include "mojo/public/cpp/bindings/pipe_control_message_proxy.h" -#include "mojo/public/cpp/system/message_pipe.h" namespace mojo { @@ -33,19 +28,6 @@ class InterfaceRequest { InterfaceRequest() {} InterfaceRequest(decltype(nullptr)) {} - // Creates a new message pipe over which Interface is to be served, binding - // the specified InterfacePtr to one end of the message pipe and this - // InterfaceRequest to the other. For example usage, see comments on - // MakeRequest(InterfacePtr*) below. - explicit InterfaceRequest(InterfacePtr<Interface>* ptr, - scoped_refptr<base::SingleThreadTaskRunner> runner = - base::ThreadTaskRunnerHandle::Get()) { - MessagePipe pipe; - ptr->Bind(InterfacePtrInfo<Interface>(std::move(pipe.handle0), 0u), - std::move(runner)); - Bind(std::move(pipe.handle1)); - } - // Takes the message pipe from another InterfaceRequest. InterfaceRequest(InterfaceRequest&& other) { handle_ = std::move(other.handle_); @@ -82,20 +64,6 @@ class InterfaceRequest { return !is_pending() && !other.is_pending(); } - void ResetWithReason(uint32_t custom_reason, const std::string& description) { - if (!handle_.is_valid()) - return; - - Message message = - PipeControlMessageProxy::ConstructPeerEndpointClosedMessage( - kMasterInterfaceId, DisconnectReason(custom_reason, description)); - MojoResult result = WriteMessageNew( - handle_.get(), message.TakeMojoMessage(), MOJO_WRITE_MESSAGE_FLAG_NONE); - DCHECK_EQ(MOJO_RESULT_OK, result); - - handle_.reset(); - } - private: ScopedMessagePipeHandle handle_; @@ -135,9 +103,9 @@ InterfaceRequest<Interface> MakeRequest(ScopedMessagePipeHandle handle) { // // DatabasePtr database = ...; // Connect to database. // TablePtr table; -// database->OpenTable(MakeRequest(&table)); +// database->OpenTable(GetProxy(&table)); // -// Upon return from MakeRequest, |table| is ready to have methods called on it. +// Upon return from GetProxy, |table| is ready to have methods called on it. // // Example #2: Registering a local implementation with a remote service. // ===================================================================== @@ -151,16 +119,19 @@ InterfaceRequest<Interface> MakeRequest(ScopedMessagePipeHandle handle) { // // CollectorPtr collector = ...; // Connect to Collector. // SourcePtr source; -// InterfaceRequest<Source> source_request(&source); +// InterfaceRequest<Source> source_request = GetProxy(&source); // collector->RegisterSource(std::move(source)); // CreateSource(std::move(source_request)); // Create implementation locally. // template <typename Interface> -InterfaceRequest<Interface> MakeRequest( +InterfaceRequest<Interface> GetProxy( InterfacePtr<Interface>* ptr, scoped_refptr<base::SingleThreadTaskRunner> runner = base::ThreadTaskRunnerHandle::Get()) { - return InterfaceRequest<Interface>(ptr, runner); + MessagePipe pipe; + ptr->Bind(InterfacePtrInfo<Interface>(std::move(pipe.handle0), 0u), + std::move(runner)); + return MakeRequest<Interface>(std::move(pipe.handle1)); } // Fuses an InterfaceRequest<T> endpoint with an InterfacePtrInfo<T> endpoint. |