| Index: third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h
|
| diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h
|
| index d7e5a68d6e25c837c9bfd778ddba412586a4d00b..1999947e0420961de172f70572aae381e85a6050 100644
|
| --- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h
|
| +++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/router.h
|
| @@ -11,7 +11,9 @@
|
| #include "mojo/public/cpp/bindings/lib/connector.h"
|
| #include "mojo/public/cpp/bindings/lib/filter_chain.h"
|
| #include "mojo/public/cpp/bindings/lib/shared_data.h"
|
| +#include "mojo/public/cpp/bindings/lib/thread_checker.h"
|
| #include "mojo/public/cpp/environment/environment.h"
|
| +#include "mojo/public/cpp/environment/logging.h"
|
|
|
| namespace mojo {
|
| namespace internal {
|
| @@ -37,14 +39,24 @@ class Router : public MessageReceiverWithResponder {
|
|
|
| // Returns true if an error was encountered while reading from the pipe or
|
| // waiting to read from the pipe.
|
| - bool encountered_error() const { return connector_.encountered_error(); }
|
| + bool encountered_error() const {
|
| + MOJO_DCHECK(thread_checker_.CalledOnValidThread());
|
| + return connector_.encountered_error();
|
| + }
|
|
|
| // Is the router bound to a MessagePipe handle?
|
| - bool is_valid() const { return connector_.is_valid(); }
|
| + bool is_valid() const {
|
| + MOJO_DCHECK(thread_checker_.CalledOnValidThread());
|
| + return connector_.is_valid();
|
| + }
|
|
|
| - void CloseMessagePipe() { connector_.CloseMessagePipe(); }
|
| + void CloseMessagePipe() {
|
| + MOJO_DCHECK(thread_checker_.CalledOnValidThread());
|
| + connector_.CloseMessagePipe();
|
| + }
|
|
|
| ScopedMessagePipeHandle PassMessagePipe() {
|
| + MOJO_DCHECK(thread_checker_.CalledOnValidThread());
|
| return connector_.PassMessagePipe();
|
| }
|
|
|
| @@ -56,14 +68,17 @@ class Router : public MessageReceiverWithResponder {
|
| // 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|.
|
| bool WaitForIncomingMessage(MojoDeadline deadline) {
|
| + MOJO_DCHECK(thread_checker_.CalledOnValidThread());
|
| return connector_.WaitForIncomingMessage(deadline);
|
| }
|
|
|
| // See Binding for details of pause/resume.
|
| void PauseIncomingMethodCallProcessing() {
|
| + MOJO_DCHECK(thread_checker_.CalledOnValidThread());
|
| connector_.PauseIncomingMethodCallProcessing();
|
| }
|
| void ResumeIncomingMethodCallProcessing() {
|
| + MOJO_DCHECK(thread_checker_.CalledOnValidThread());
|
| connector_.ResumeIncomingMethodCallProcessing();
|
| }
|
|
|
| @@ -77,7 +92,10 @@ class Router : public MessageReceiverWithResponder {
|
| MessagePipeHandle handle() const { return connector_.handle(); }
|
|
|
| // Returns true if this Router has any pending callbacks.
|
| - bool has_pending_responders() const { return !responders_.empty(); }
|
| + bool has_pending_responders() const {
|
| + MOJO_DCHECK(thread_checker_.CalledOnValidThread());
|
| + return !responders_.empty();
|
| + }
|
|
|
| private:
|
| typedef std::map<uint64_t, MessageReceiver*> ResponderMap;
|
| @@ -106,6 +124,7 @@ class Router : public MessageReceiverWithResponder {
|
| ResponderMap responders_;
|
| uint64_t next_request_id_;
|
| bool testing_mode_;
|
| + ThreadChecker thread_checker_;
|
| };
|
|
|
| } // namespace internal
|
|
|