Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: mojo/public/cpp/bindings/lib/multiplex_router.h

Issue 2363503002: Mojo C++ bindings: Add a SINGLE_INTERFACE_WITH_SYNC_REQUESTS mode for MultiplexRouter. (Closed)
Patch Set: .. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/multiplex_router.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_MULTIPLEX_ROUTER_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MULTIPLEX_ROUTER_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_MULTIPLEX_ROUTER_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_MULTIPLEX_ROUTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <deque> 10 #include <deque>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 public AssociatedGroupController, 56 public AssociatedGroupController,
57 public PipeControlMessageHandlerDelegate { 57 public PipeControlMessageHandlerDelegate {
58 public: 58 public:
59 enum Config { 59 enum Config {
60 // There is only the master interface running on this router. Please note 60 // There is only the master interface running on this router. Please note
61 // that because of interface versioning, the other side of the message pipe 61 // that because of interface versioning, the other side of the message pipe
62 // may use a newer master interface definition which passes associated 62 // may use a newer master interface definition which passes associated
63 // interfaces. In that case, this router may still receive pipe control 63 // interfaces. In that case, this router may still receive pipe control
64 // messages or messages targetting associated interfaces. 64 // messages or messages targetting associated interfaces.
65 SINGLE_INTERFACE, 65 SINGLE_INTERFACE,
66 // Similar to the mode above, there is only the master interface running on
67 // this router. Besides, the master interface has sync methods.
68 SINGLE_INTERFACE_WITH_SYNC_METHODS,
66 // There may be associated interfaces running on this router. 69 // There may be associated interfaces running on this router.
67 MULTI_INTERFACE 70 MULTI_INTERFACE
68 }; 71 };
69 72
70 // If |set_interface_id_namespace_bit| is true, the interface IDs generated by 73 // If |set_interface_id_namespace_bit| is true, the interface IDs generated by
71 // this router will have the highest bit set. 74 // this router will have the highest bit set.
72 MultiplexRouter(ScopedMessagePipeHandle message_pipe, 75 MultiplexRouter(ScopedMessagePipeHandle message_pipe,
73 Config config, 76 Config config,
74 bool set_interface_id_namespace_bit, 77 bool set_interface_id_namespace_bit,
75 scoped_refptr<base::SingleThreadTaskRunner> runner); 78 scoped_refptr<base::SingleThreadTaskRunner> runner);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 230
228 // Owned by |filters_| below. 231 // Owned by |filters_| below.
229 MessageHeaderValidator* header_validator_; 232 MessageHeaderValidator* header_validator_;
230 233
231 FilterChain filters_; 234 FilterChain filters_;
232 Connector connector_; 235 Connector connector_;
233 236
234 base::ThreadChecker thread_checker_; 237 base::ThreadChecker thread_checker_;
235 238
236 // Protects the following members. 239 // Protects the following members.
237 // Sets to nullptr in Config::SINGLE_INTERFACE mode. 240 // Sets to nullptr in Config::SINGLE_INTERFACE* mode.
238 std::unique_ptr<base::Lock> lock_; 241 std::unique_ptr<base::Lock> lock_;
239 PipeControlMessageHandler control_message_handler_; 242 PipeControlMessageHandler control_message_handler_;
240 PipeControlMessageProxy control_message_proxy_; 243 PipeControlMessageProxy control_message_proxy_;
241 244
242 std::map<InterfaceId, scoped_refptr<InterfaceEndpoint>> endpoints_; 245 std::map<InterfaceId, scoped_refptr<InterfaceEndpoint>> endpoints_;
243 uint32_t next_interface_id_value_; 246 uint32_t next_interface_id_value_;
244 247
245 std::deque<std::unique_ptr<Task>> tasks_; 248 std::deque<std::unique_ptr<Task>> tasks_;
246 // It refers to tasks in |tasks_| and doesn't own any of them. 249 // It refers to tasks in |tasks_| and doesn't own any of them.
247 std::map<InterfaceId, std::deque<Task*>> sync_message_tasks_; 250 std::map<InterfaceId, std::deque<Task*>> sync_message_tasks_;
248 251
249 bool posted_to_process_tasks_; 252 bool posted_to_process_tasks_;
250 scoped_refptr<base::SingleThreadTaskRunner> posted_to_task_runner_; 253 scoped_refptr<base::SingleThreadTaskRunner> posted_to_task_runner_;
251 254
252 bool encountered_error_; 255 bool encountered_error_;
253 256
254 bool paused_; 257 bool paused_;
255 258
256 bool testing_mode_; 259 bool testing_mode_;
257 260
258 DISALLOW_COPY_AND_ASSIGN(MultiplexRouter); 261 DISALLOW_COPY_AND_ASSIGN(MultiplexRouter);
259 }; 262 };
260 263
261 } // namespace internal 264 } // namespace internal
262 } // namespace mojo 265 } // namespace mojo
263 266
264 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MULTIPLEX_ROUTER_H_ 267 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MULTIPLEX_ROUTER_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/multiplex_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698