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