| OLD | NEW |
| 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> |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/compiler_specific.h" |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 16 #include "base/macros.h" | 17 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 19 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
| 20 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
| 21 #include "base/threading/thread_checker.h" | 22 #include "base/threading/thread_checker.h" |
| 22 #include "mojo/public/cpp/bindings/associated_group_controller.h" | 23 #include "mojo/public/cpp/bindings/associated_group_controller.h" |
| 24 #include "mojo/public/cpp/bindings/bindings_export.h" |
| 23 #include "mojo/public/cpp/bindings/connector.h" | 25 #include "mojo/public/cpp/bindings/connector.h" |
| 24 #include "mojo/public/cpp/bindings/filter_chain.h" | 26 #include "mojo/public/cpp/bindings/filter_chain.h" |
| 25 #include "mojo/public/cpp/bindings/interface_id.h" | 27 #include "mojo/public/cpp/bindings/interface_id.h" |
| 26 #include "mojo/public/cpp/bindings/message_header_validator.h" | 28 #include "mojo/public/cpp/bindings/message_header_validator.h" |
| 27 #include "mojo/public/cpp/bindings/pipe_control_message_handler.h" | 29 #include "mojo/public/cpp/bindings/pipe_control_message_handler.h" |
| 28 #include "mojo/public/cpp/bindings/pipe_control_message_handler_delegate.h" | 30 #include "mojo/public/cpp/bindings/pipe_control_message_handler_delegate.h" |
| 29 #include "mojo/public/cpp/bindings/pipe_control_message_proxy.h" | 31 #include "mojo/public/cpp/bindings/pipe_control_message_proxy.h" |
| 30 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" | 32 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" |
| 31 | 33 |
| 32 namespace base { | 34 namespace base { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 44 // | 46 // |
| 45 // It is created on the thread where the master interface of the message pipe | 47 // It is created on the thread where the master interface of the message pipe |
| 46 // lives. Although it is ref-counted, it is guarateed to be destructed on the | 48 // lives. Although it is ref-counted, it is guarateed to be destructed on the |
| 47 // same thread. | 49 // same thread. |
| 48 // Some public methods are only allowed to be called on the creating thread; | 50 // Some public methods are only allowed to be called on the creating thread; |
| 49 // while the others are safe to call from any threads. Please see the method | 51 // while the others are safe to call from any threads. Please see the method |
| 50 // comments for more details. | 52 // comments for more details. |
| 51 // | 53 // |
| 52 // NOTE: CloseMessagePipe() or PassMessagePipe() MUST be called on |runner|'s | 54 // NOTE: CloseMessagePipe() or PassMessagePipe() MUST be called on |runner|'s |
| 53 // thread before this object is destroyed. | 55 // thread before this object is destroyed. |
| 54 class MultiplexRouter | 56 class MOJO_CPP_BINDINGS_EXPORT MultiplexRouter |
| 55 : public MessageReceiver, | 57 : NON_EXPORTED_BASE(public MessageReceiver), |
| 56 public AssociatedGroupController, | 58 public AssociatedGroupController, |
| 57 public PipeControlMessageHandlerDelegate { | 59 NON_EXPORTED_BASE(public PipeControlMessageHandlerDelegate) { |
| 58 public: | 60 public: |
| 59 enum Config { | 61 enum Config { |
| 60 // There is only the master interface running on this router. Please note | 62 // 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 | 63 // that because of interface versioning, the other side of the message pipe |
| 62 // may use a newer master interface definition which passes associated | 64 // may use a newer master interface definition which passes associated |
| 63 // interfaces. In that case, this router may still receive pipe control | 65 // interfaces. In that case, this router may still receive pipe control |
| 64 // messages or messages targetting associated interfaces. | 66 // messages or messages targetting associated interfaces. |
| 65 SINGLE_INTERFACE, | 67 SINGLE_INTERFACE, |
| 66 // There may be associated interfaces running on this router. | 68 // There may be associated interfaces running on this router. |
| 67 MULTI_INTERFACE | 69 MULTI_INTERFACE |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 | 257 |
| 256 bool testing_mode_; | 258 bool testing_mode_; |
| 257 | 259 |
| 258 DISALLOW_COPY_AND_ASSIGN(MultiplexRouter); | 260 DISALLOW_COPY_AND_ASSIGN(MultiplexRouter); |
| 259 }; | 261 }; |
| 260 | 262 |
| 261 } // namespace internal | 263 } // namespace internal |
| 262 } // namespace mojo | 264 } // namespace mojo |
| 263 | 265 |
| 264 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MULTIPLEX_ROUTER_H_ | 266 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MULTIPLEX_ROUTER_H_ |
| OLD | NEW |