| 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 | 14 |
| 14 #include "base/logging.h" | 15 #include "base/logging.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/ref_counted_delete_on_message_loop.h" | 18 #include "base/memory/ref_counted_delete_on_message_loop.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/callback.h" | 23 #include "mojo/public/cpp/bindings/callback.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 : public MessageReceiver, | 55 : public MessageReceiver, |
| 55 public base::RefCountedDeleteOnMessageLoop<MultiplexRouter>, | 56 public base::RefCountedDeleteOnMessageLoop<MultiplexRouter>, |
| 56 public PipeControlMessageHandlerDelegate { | 57 public PipeControlMessageHandlerDelegate { |
| 57 public: | 58 public: |
| 58 // If |set_interface_id_namespace_bit| is true, the interface IDs generated by | 59 // If |set_interface_id_namespace_bit| is true, the interface IDs generated by |
| 59 // this router will have the highest bit set. | 60 // this router will have the highest bit set. |
| 60 MultiplexRouter(bool set_interface_id_namespace_bit, | 61 MultiplexRouter(bool set_interface_id_namespace_bit, |
| 61 ScopedMessagePipeHandle message_pipe, | 62 ScopedMessagePipeHandle message_pipe, |
| 62 scoped_refptr<base::SingleThreadTaskRunner> runner); | 63 scoped_refptr<base::SingleThreadTaskRunner> runner); |
| 63 | 64 |
| 65 // Sets the master interface name for this router. Only used when reporting |
| 66 // message header or control message validation errors. |
| 67 void SetMasterInterfaceName(const std::string& name); |
| 68 |
| 64 // --------------------------------------------------------------------------- | 69 // --------------------------------------------------------------------------- |
| 65 // The following public methods are safe to call from any threads. | 70 // The following public methods are safe to call from any threads. |
| 66 | 71 |
| 67 // Creates a pair of interface endpoint handles. The method generates a new | 72 // Creates a pair of interface endpoint handles. The method generates a new |
| 68 // interface ID and assigns it to the two handles. |local_endpoint| is used | 73 // interface ID and assigns it to the two handles. |local_endpoint| is used |
| 69 // locally; while |remote_endpoint| is sent over the message pipe. | 74 // locally; while |remote_endpoint| is sent over the message pipe. |
| 70 void CreateEndpointHandlePair(ScopedInterfaceEndpointHandle* local_endpoint, | 75 void CreateEndpointHandlePair(ScopedInterfaceEndpointHandle* local_endpoint, |
| 71 ScopedInterfaceEndpointHandle* remote_endpoint); | 76 ScopedInterfaceEndpointHandle* remote_endpoint); |
| 72 | 77 |
| 73 // Creates an interface endpoint handle from a given interface ID. The handle | 78 // Creates an interface endpoint handle from a given interface ID. The handle |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 | 260 |
| 256 bool testing_mode_; | 261 bool testing_mode_; |
| 257 | 262 |
| 258 DISALLOW_COPY_AND_ASSIGN(MultiplexRouter); | 263 DISALLOW_COPY_AND_ASSIGN(MultiplexRouter); |
| 259 }; | 264 }; |
| 260 | 265 |
| 261 } // namespace internal | 266 } // namespace internal |
| 262 } // namespace mojo | 267 } // namespace mojo |
| 263 | 268 |
| 264 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MULTIPLEX_ROUTER_H_ | 269 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MULTIPLEX_ROUTER_H_ |
| OLD | NEW |