| 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_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ | 5 #ifndef MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ |
| 6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ | 6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // state, and one can never return to a disconnected once connected. | 32 // state, and one can never return to a disconnected once connected. |
| 33 // | 33 // |
| 34 // |pipe_id| is a unique identifier which can be used to track pipe endpoints | 34 // |pipe_id| is a unique identifier which can be used to track pipe endpoints |
| 35 // as they're passed around. |endpoint| is either 0 or 1 and again is only | 35 // as they're passed around. |endpoint| is either 0 or 1 and again is only |
| 36 // used for tracking pipes (one side is always 0, the other is always 1.) | 36 // used for tracking pipes (one side is always 0, the other is always 1.) |
| 37 MessagePipeDispatcher(NodeController* node_controller, | 37 MessagePipeDispatcher(NodeController* node_controller, |
| 38 const ports::PortRef& port, | 38 const ports::PortRef& port, |
| 39 uint64_t pipe_id, | 39 uint64_t pipe_id, |
| 40 int endpoint); | 40 int endpoint); |
| 41 | 41 |
| 42 // Fuses this pipe with |other|. Returns |true| on success or |false| on |
| 43 // failure. Regardless of the return value, both dispatchers are closed by |
| 44 // this call. |
| 45 bool Fuse(MessagePipeDispatcher* other); |
| 46 |
| 42 // Dispatcher: | 47 // Dispatcher: |
| 43 Type GetType() const override; | 48 Type GetType() const override; |
| 44 MojoResult Close() override; | 49 MojoResult Close() override; |
| 45 MojoResult Watch(MojoHandleSignals signals, | 50 MojoResult Watch(MojoHandleSignals signals, |
| 46 const Watcher::WatchCallback& callback, | 51 const Watcher::WatchCallback& callback, |
| 47 uintptr_t context) override; | 52 uintptr_t context) override; |
| 48 MojoResult CancelWatch(uintptr_t context) override; | 53 MojoResult CancelWatch(uintptr_t context) override; |
| 49 MojoResult WriteMessage(const void* bytes, | 54 MojoResult WriteMessage(const void* bytes, |
| 50 uint32_t num_bytes, | 55 uint32_t num_bytes, |
| 51 const DispatcherInTransit* dispatchers, | 56 const DispatcherInTransit* dispatchers, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 bool port_closed_ = false; | 113 bool port_closed_ = false; |
| 109 AwakableList awakables_; | 114 AwakableList awakables_; |
| 110 | 115 |
| 111 DISALLOW_COPY_AND_ASSIGN(MessagePipeDispatcher); | 116 DISALLOW_COPY_AND_ASSIGN(MessagePipeDispatcher); |
| 112 }; | 117 }; |
| 113 | 118 |
| 114 } // namespace edk | 119 } // namespace edk |
| 115 } // namespace mojo | 120 } // namespace mojo |
| 116 | 121 |
| 117 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ | 122 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ |
| OLD | NEW |