| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "mojo/public/cpp/bindings/lib/connector.h" | 10 #include "mojo/public/cpp/bindings/lib/connector.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // error state, where no more messages will be processed. This method is used | 36 // error state, where no more messages will be processed. This method is used |
| 37 // during testing to prevent that from happening. | 37 // during testing to prevent that from happening. |
| 38 void set_enforce_errors_from_incoming_receiver(bool enforce) { | 38 void set_enforce_errors_from_incoming_receiver(bool enforce) { |
| 39 connector_.set_enforce_errors_from_incoming_receiver(enforce); | 39 connector_.set_enforce_errors_from_incoming_receiver(enforce); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Returns true if an error was encountered while reading from the pipe or | 42 // Returns true if an error was encountered while reading from the pipe or |
| 43 // waiting to read from the pipe. | 43 // waiting to read from the pipe. |
| 44 bool encountered_error() const { return connector_.encountered_error(); } | 44 bool encountered_error() const { return connector_.encountered_error(); } |
| 45 | 45 |
| 46 void CloseMessagePipe() { |
| 47 connector_.CloseMessagePipe(); |
| 48 } |
| 49 |
| 50 ScopedMessagePipeHandle ReleaseMessagePipe() { |
| 51 return connector_.ReleaseMessagePipe(); |
| 52 } |
| 53 |
| 46 // MessageReceiver implementation: | 54 // MessageReceiver implementation: |
| 47 virtual bool Accept(Message* message) MOJO_OVERRIDE; | 55 virtual bool Accept(Message* message) MOJO_OVERRIDE; |
| 48 virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder) | 56 virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder) |
| 49 MOJO_OVERRIDE; | 57 MOJO_OVERRIDE; |
| 50 | 58 |
| 51 private: | 59 private: |
| 52 typedef std::map<uint64_t, MessageReceiver*> ResponderMap; | 60 typedef std::map<uint64_t, MessageReceiver*> ResponderMap; |
| 53 | 61 |
| 54 class HandleIncomingMessageThunk : public MessageReceiver { | 62 class HandleIncomingMessageThunk : public MessageReceiver { |
| 55 public: | 63 public: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 71 MessageReceiver* incoming_receiver_; | 79 MessageReceiver* incoming_receiver_; |
| 72 HandleIncomingMessageThunk thunk_; | 80 HandleIncomingMessageThunk thunk_; |
| 73 ResponderMap responders_; | 81 ResponderMap responders_; |
| 74 uint64_t next_request_id_; | 82 uint64_t next_request_id_; |
| 75 }; | 83 }; |
| 76 | 84 |
| 77 } // namespace internal | 85 } // namespace internal |
| 78 } // namespace mojo | 86 } // namespace mojo |
| 79 | 87 |
| 80 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ | 88 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ |
| OLD | NEW |