| Index: mojo/public/cpp/bindings/lib/router.h
|
| diff --git a/mojo/public/cpp/bindings/lib/router.h b/mojo/public/cpp/bindings/lib/router.h
|
| index 2f5e8e2a971366c0ddc04895635be9d0565b29e5..648506607a0afa027a0fe730d53e70e046c877ae 100644
|
| --- a/mojo/public/cpp/bindings/lib/router.h
|
| +++ b/mojo/public/cpp/bindings/lib/router.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/lib/connector.h"
|
| #include "mojo/public/cpp/bindings/lib/filter_chain.h"
|
|
|
| @@ -39,6 +40,12 @@ class Router : public MessageReceiverWithResponder {
|
| incoming_receiver_ = receiver;
|
| }
|
|
|
| + // Sets the interface name for this Router. Used only for debugging.
|
| + void set_interface_name(const std::string& name) {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| + interface_name_ = name;
|
| + }
|
| +
|
| // Sets the error handler to receive notifications when an error is
|
| // encountered while reading from the pipe or waiting to read from the pipe.
|
| void set_connection_error_handler(const Closure& error_handler) {
|
| @@ -71,15 +78,16 @@ class Router : public MessageReceiverWithResponder {
|
| return connector_.PassMessagePipe();
|
| }
|
|
|
| - void RaiseError() {
|
| + void RaiseError(Error error) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| - connector_.RaiseError();
|
| + connector_.RaiseError(std::move(error));
|
| }
|
|
|
| // MessageReceiver 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;
|
|
|
| // Blocks the current thread until the first incoming method call, i.e.,
|
| // either a call to a client method or a callback method, or |deadline|.
|
| @@ -141,15 +149,15 @@ class Router : public MessageReceiverWithResponder {
|
| ~HandleIncomingMessageThunk() override;
|
|
|
| // MessageReceiver implementation:
|
| - bool Accept(Message* message) override;
|
| + bool Accept(Message* message, Error* error) override;
|
|
|
| private:
|
| Router* router_;
|
| };
|
|
|
| - bool HandleIncomingMessage(Message* message);
|
| + bool HandleIncomingMessage(Message* message, Error* error);
|
| void HandleQueuedMessages();
|
| - bool HandleMessageInternal(Message* message);
|
| + bool HandleMessageInternal(Message* message, Error* error);
|
|
|
| void OnConnectionError();
|
|
|
| @@ -161,6 +169,7 @@ class Router : public MessageReceiverWithResponder {
|
| SyncResponseMap sync_responses_;
|
| uint64_t next_request_id_;
|
| bool testing_mode_;
|
| + std::string interface_name_;
|
| std::queue<std::unique_ptr<Message>> pending_messages_;
|
| // Whether a task has been posted to trigger processing of
|
| // |pending_messages_|.
|
|
|