| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <queue> | 12 #include <queue> |
| 13 | 13 |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/compiler_specific.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 18 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
| 19 #include "base/threading/thread_checker.h" | 20 #include "base/threading/thread_checker.h" |
| 21 #include "mojo/public/cpp/bindings/bindings_export.h" |
| 20 #include "mojo/public/cpp/bindings/connection_error_callback.h" | 22 #include "mojo/public/cpp/bindings/connection_error_callback.h" |
| 21 #include "mojo/public/cpp/bindings/connector.h" | 23 #include "mojo/public/cpp/bindings/connector.h" |
| 22 #include "mojo/public/cpp/bindings/filter_chain.h" | 24 #include "mojo/public/cpp/bindings/filter_chain.h" |
| 23 #include "mojo/public/cpp/bindings/lib/control_message_handler.h" | 25 #include "mojo/public/cpp/bindings/lib/control_message_handler.h" |
| 24 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" | 26 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" |
| 25 #include "mojo/public/cpp/bindings/message.h" | 27 #include "mojo/public/cpp/bindings/message.h" |
| 26 | 28 |
| 27 namespace mojo { | 29 namespace mojo { |
| 28 namespace internal { | 30 namespace internal { |
| 29 | 31 |
| 30 // TODO(yzshen): Consider removing this class and use MultiplexRouter in all | 32 // TODO(yzshen): Consider removing this class and use MultiplexRouter in all |
| 31 // cases. crbug.com/594244 | 33 // cases. crbug.com/594244 |
| 32 class Router : public MessageReceiverWithResponder { | 34 class MOJO_CPP_BINDINGS_EXPORT Router |
| 35 : NON_EXPORTED_BASE(public MessageReceiverWithResponder) { |
| 33 public: | 36 public: |
| 34 Router(ScopedMessagePipeHandle message_pipe, | 37 Router(ScopedMessagePipeHandle message_pipe, |
| 35 FilterChain filters, | 38 FilterChain filters, |
| 36 bool expects_sync_requests, | 39 bool expects_sync_requests, |
| 37 scoped_refptr<base::SingleThreadTaskRunner> runner, | 40 scoped_refptr<base::SingleThreadTaskRunner> runner, |
| 38 int interface_version); | 41 int interface_version); |
| 39 ~Router() override; | 42 ~Router() override; |
| 40 | 43 |
| 41 // Sets the receiver to handle messages read from the message pipe that do | 44 // Sets the receiver to handle messages read from the message pipe that do |
| 42 // not have the Message::kFlagIsResponse flag set. | 45 // not have the Message::kFlagIsResponse flag set. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 ControlMessageProxy control_message_proxy_; | 197 ControlMessageProxy control_message_proxy_; |
| 195 ControlMessageHandler control_message_handler_; | 198 ControlMessageHandler control_message_handler_; |
| 196 base::ThreadChecker thread_checker_; | 199 base::ThreadChecker thread_checker_; |
| 197 base::WeakPtrFactory<Router> weak_factory_; | 200 base::WeakPtrFactory<Router> weak_factory_; |
| 198 }; | 201 }; |
| 199 | 202 |
| 200 } // namespace internal | 203 } // namespace internal |
| 201 } // namespace mojo | 204 } // namespace mojo |
| 202 | 205 |
| 203 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ | 206 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ROUTER_H_ |
| OLD | NEW |