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 <memory> |
10 #include <queue> | 11 #include <queue> |
11 | 12 |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "mojo/edk/system/atomic_flag.h" | 15 #include "mojo/edk/system/atomic_flag.h" |
15 #include "mojo/edk/system/awakable_list.h" | 16 #include "mojo/edk/system/awakable_list.h" |
16 #include "mojo/edk/system/dispatcher.h" | 17 #include "mojo/edk/system/dispatcher.h" |
| 18 #include "mojo/edk/system/message_for_transit.h" |
17 #include "mojo/edk/system/ports/port_ref.h" | 19 #include "mojo/edk/system/ports/port_ref.h" |
18 | 20 |
19 namespace mojo { | 21 namespace mojo { |
20 namespace edk { | 22 namespace edk { |
21 | 23 |
22 class NodeController; | 24 class NodeController; |
23 class PortsMessage; | 25 class PortsMessage; |
24 | 26 |
25 class MessagePipeDispatcher : public Dispatcher { | 27 class MessagePipeDispatcher : public Dispatcher { |
26 public: | 28 public: |
(...skipping 18 matching lines...) Expand all Loading... |
45 // this call. | 47 // this call. |
46 bool Fuse(MessagePipeDispatcher* other); | 48 bool Fuse(MessagePipeDispatcher* other); |
47 | 49 |
48 // Dispatcher: | 50 // Dispatcher: |
49 Type GetType() const override; | 51 Type GetType() const override; |
50 MojoResult Close() override; | 52 MojoResult Close() override; |
51 MojoResult Watch(MojoHandleSignals signals, | 53 MojoResult Watch(MojoHandleSignals signals, |
52 const Watcher::WatchCallback& callback, | 54 const Watcher::WatchCallback& callback, |
53 uintptr_t context) override; | 55 uintptr_t context) override; |
54 MojoResult CancelWatch(uintptr_t context) override; | 56 MojoResult CancelWatch(uintptr_t context) override; |
55 MojoResult WriteMessage(const void* bytes, | 57 MojoResult WriteMessage(std::unique_ptr<MessageForTransit> message, |
56 uint32_t num_bytes, | |
57 const DispatcherInTransit* dispatchers, | |
58 uint32_t num_dispatchers, | |
59 MojoWriteMessageFlags flags) override; | 58 MojoWriteMessageFlags flags) override; |
60 MojoResult ReadMessage(void* bytes, | 59 MojoResult ReadMessage(std::unique_ptr<MessageForTransit>* message, |
61 uint32_t* num_bytes, | 60 uint32_t* num_bytes, |
62 MojoHandle* handles, | 61 MojoHandle* handles, |
63 uint32_t* num_handles, | 62 uint32_t* num_handles, |
64 MojoReadMessageFlags flags) override; | 63 MojoReadMessageFlags flags, |
| 64 bool read_any_size) override; |
65 HandleSignalsState GetHandleSignalsState() const override; | 65 HandleSignalsState GetHandleSignalsState() const override; |
66 MojoResult AddAwakable(Awakable* awakable, | 66 MojoResult AddAwakable(Awakable* awakable, |
67 MojoHandleSignals signals, | 67 MojoHandleSignals signals, |
68 uintptr_t context, | 68 uintptr_t context, |
69 HandleSignalsState* signals_state) override; | 69 HandleSignalsState* signals_state) override; |
70 void RemoveAwakable(Awakable* awakable, | 70 void RemoveAwakable(Awakable* awakable, |
71 HandleSignalsState* signals_state) override; | 71 HandleSignalsState* signals_state) override; |
72 void StartSerialize(uint32_t* num_bytes, | 72 void StartSerialize(uint32_t* num_bytes, |
73 uint32_t* num_ports, | 73 uint32_t* num_ports, |
74 uint32_t* num_handles) override; | 74 uint32_t* num_handles) override; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 AtomicFlag port_closed_; | 114 AtomicFlag port_closed_; |
115 AwakableList awakables_; | 115 AwakableList awakables_; |
116 | 116 |
117 DISALLOW_COPY_AND_ASSIGN(MessagePipeDispatcher); | 117 DISALLOW_COPY_AND_ASSIGN(MessagePipeDispatcher); |
118 }; | 118 }; |
119 | 119 |
120 } // namespace edk | 120 } // namespace edk |
121 } // namespace mojo | 121 } // namespace mojo |
122 | 122 |
123 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ | 123 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ |
OLD | NEW |