Index: mojo/public/cpp/bindings/lib/interface_endpoint_client.h |
diff --git a/mojo/public/cpp/bindings/lib/interface_endpoint_client.h b/mojo/public/cpp/bindings/lib/interface_endpoint_client.h |
index 3f820db3c30c66b179e6b2203478f66bb0b19509..abf801312a0ac68882178d2a960d7f4c580bfbb7 100644 |
--- a/mojo/public/cpp/bindings/lib/interface_endpoint_client.h |
+++ b/mojo/public/cpp/bindings/lib/interface_endpoint_client.h |
@@ -17,6 +17,7 @@ |
#include "base/single_thread_task_runner.h" |
#include "base/threading/thread_checker.h" |
#include "mojo/public/cpp/bindings/callback.h" |
+#include "mojo/public/cpp/bindings/error.h" |
#include "mojo/public/cpp/bindings/message.h" |
#include "mojo/public/cpp/bindings/message_filter.h" |
#include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" |
@@ -67,23 +68,30 @@ class InterfaceEndpointClient : public MessageReceiverWithResponder { |
AssociatedGroup* associated_group(); |
uint32_t interface_id() const; |
+ void set_interface_name(const std::string& name) { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ interface_name_ = name; |
+ } |
+ |
// After this call the object is in an invalid state and shouldn't be reused. |
ScopedInterfaceEndpointHandle PassHandle(); |
// Raises an error on the underlying message pipe. It disconnects the pipe |
// and notifies all interfaces running on this pipe. |
- void RaiseError(); |
+ void RaiseError(Error error); |
// MessageReceiverWithResponder implementation: |
- bool Accept(Message* message) override; |
+ bool Accept(Message* message, Error* error) override; |
bool AcceptWithResponder(Message* message, |
- MessageReceiver* responder) override; |
+ MessageReceiver* responder, |
+ Error* error) override; |
// The following methods are called by the router. They must be called |
- // outside of the router's lock. |
+ // outside of the router's lock. If this returns false, |*error| contains more |
+ // information about the failure reason. |
// NOTE: |message| must have passed message header validation. |
- bool HandleIncomingMessage(Message* message); |
+ bool HandleIncomingMessage(Message* message, Error* error); |
void NotifyError(); |
private: |
@@ -116,7 +124,7 @@ class InterfaceEndpointClient : public MessageReceiverWithResponder { |
~HandleIncomingMessageThunk() override; |
// MessageReceiver implementation: |
- bool Accept(Message* message) override; |
+ bool Accept(Message* message, Error* error) override; |
private: |
InterfaceEndpointClient* const owner_; |
@@ -124,7 +132,7 @@ class InterfaceEndpointClient : public MessageReceiverWithResponder { |
DISALLOW_COPY_AND_ASSIGN(HandleIncomingMessageThunk); |
}; |
- bool HandleValidatedMessage(Message* message); |
+ bool HandleValidatedMessage(Message* message, Error* error); |
ScopedInterfaceEndpointHandle handle_; |
std::unique_ptr<AssociatedGroup> associated_group_; |
@@ -142,6 +150,10 @@ class InterfaceEndpointClient : public MessageReceiverWithResponder { |
Closure error_handler_; |
bool encountered_error_; |
+ // The name of the interface which is bound by this client. Used only for |
+ // debugging purposes. |
+ std::string interface_name_; |
+ |
scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
base::ThreadChecker thread_checker_; |