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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // Returns true if this Router has any pending callbacks. | 125 // Returns true if this Router has any pending callbacks. |
126 bool has_pending_responders() const { | 126 bool has_pending_responders() const { |
127 DCHECK(thread_checker_.CalledOnValidThread()); | 127 DCHECK(thread_checker_.CalledOnValidThread()); |
128 return !async_responders_.empty() || !sync_responses_.empty(); | 128 return !async_responders_.empty() || !sync_responses_.empty(); |
129 } | 129 } |
130 | 130 |
131 ControlMessageProxy* control_message_proxy() { | 131 ControlMessageProxy* control_message_proxy() { |
132 return &control_message_proxy_; | 132 return &control_message_proxy_; |
133 } | 133 } |
134 | 134 |
| 135 bool SimulateReceivingMessageForTesting(Message* message) { |
| 136 return filters_.Accept(message); |
| 137 } |
| 138 |
135 private: | 139 private: |
136 // Maps from the id of a response to the MessageReceiver that handles the | 140 // Maps from the id of a response to the MessageReceiver that handles the |
137 // response. | 141 // response. |
138 using AsyncResponderMap = | 142 using AsyncResponderMap = |
139 std::map<uint64_t, std::unique_ptr<MessageReceiver>>; | 143 std::map<uint64_t, std::unique_ptr<MessageReceiver>>; |
140 | 144 |
141 struct SyncResponseInfo { | 145 struct SyncResponseInfo { |
142 public: | 146 public: |
143 explicit SyncResponseInfo(bool* in_response_received); | 147 explicit SyncResponseInfo(bool* in_response_received); |
144 ~SyncResponseInfo(); | 148 ~SyncResponseInfo(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 ControlMessageProxy control_message_proxy_; | 194 ControlMessageProxy control_message_proxy_; |
191 ControlMessageHandler control_message_handler_; | 195 ControlMessageHandler control_message_handler_; |
192 base::ThreadChecker thread_checker_; | 196 base::ThreadChecker thread_checker_; |
193 base::WeakPtrFactory<Router> weak_factory_; | 197 base::WeakPtrFactory<Router> weak_factory_; |
194 }; | 198 }; |
195 | 199 |
196 } // namespace internal | 200 } // namespace internal |
197 } // namespace mojo | 201 } // namespace mojo |
198 | 202 |
199 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ | 203 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ |
OLD | NEW |