| 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" | |
| 16 #include "mojo/edk/system/dispatcher.h" | 15 #include "mojo/edk/system/dispatcher.h" |
| 17 #include "mojo/edk/system/message_for_transit.h" | 16 #include "mojo/edk/system/message_for_transit.h" |
| 18 #include "mojo/edk/system/ports/port_ref.h" | 17 #include "mojo/edk/system/ports/port_ref.h" |
| 19 #include "mojo/edk/system/watcher_set.h" | 18 #include "mojo/edk/system/watcher_set.h" |
| 20 | 19 |
| 21 namespace mojo { | 20 namespace mojo { |
| 22 namespace edk { | 21 namespace edk { |
| 23 | 22 |
| 24 class NodeController; | 23 class NodeController; |
| 25 | 24 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 55 uint32_t* num_bytes, | 54 uint32_t* num_bytes, |
| 56 MojoHandle* handles, | 55 MojoHandle* handles, |
| 57 uint32_t* num_handles, | 56 uint32_t* num_handles, |
| 58 MojoReadMessageFlags flags, | 57 MojoReadMessageFlags flags, |
| 59 bool read_any_size) override; | 58 bool read_any_size) override; |
| 60 HandleSignalsState GetHandleSignalsState() const override; | 59 HandleSignalsState GetHandleSignalsState() const override; |
| 61 MojoResult AddWatcherRef(const scoped_refptr<WatcherDispatcher>& watcher, | 60 MojoResult AddWatcherRef(const scoped_refptr<WatcherDispatcher>& watcher, |
| 62 uintptr_t context) override; | 61 uintptr_t context) override; |
| 63 MojoResult RemoveWatcherRef(WatcherDispatcher* watcher, | 62 MojoResult RemoveWatcherRef(WatcherDispatcher* watcher, |
| 64 uintptr_t context) override; | 63 uintptr_t context) override; |
| 65 MojoResult AddAwakable(Awakable* awakable, | |
| 66 MojoHandleSignals signals, | |
| 67 uintptr_t context, | |
| 68 HandleSignalsState* signals_state) override; | |
| 69 void RemoveAwakable(Awakable* awakable, | |
| 70 HandleSignalsState* signals_state) override; | |
| 71 void StartSerialize(uint32_t* num_bytes, | 64 void StartSerialize(uint32_t* num_bytes, |
| 72 uint32_t* num_ports, | 65 uint32_t* num_ports, |
| 73 uint32_t* num_handles) override; | 66 uint32_t* num_handles) override; |
| 74 bool EndSerialize(void* destination, | 67 bool EndSerialize(void* destination, |
| 75 ports::PortName* ports, | 68 ports::PortName* ports, |
| 76 PlatformHandle* handles) override; | 69 PlatformHandle* handles) override; |
| 77 bool BeginTransit() override; | 70 bool BeginTransit() override; |
| 78 void CompleteTransitAndClose() override; | 71 void CompleteTransitAndClose() override; |
| 79 void CancelTransit() override; | 72 void CancelTransit() override; |
| 80 | 73 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 104 | 97 |
| 105 // Guards access to all the fields below. | 98 // Guards access to all the fields below. |
| 106 mutable base::Lock signal_lock_; | 99 mutable base::Lock signal_lock_; |
| 107 | 100 |
| 108 // This is not the same is |port_transferred_|. It's only held true between | 101 // This is not the same is |port_transferred_|. It's only held true between |
| 109 // BeginTransit() and Complete/CancelTransit(). | 102 // BeginTransit() and Complete/CancelTransit(). |
| 110 AtomicFlag in_transit_; | 103 AtomicFlag in_transit_; |
| 111 | 104 |
| 112 bool port_transferred_ = false; | 105 bool port_transferred_ = false; |
| 113 AtomicFlag port_closed_; | 106 AtomicFlag port_closed_; |
| 114 AwakableList awakables_; | |
| 115 WatcherSet watchers_; | 107 WatcherSet watchers_; |
| 116 | 108 |
| 117 DISALLOW_COPY_AND_ASSIGN(MessagePipeDispatcher); | 109 DISALLOW_COPY_AND_ASSIGN(MessagePipeDispatcher); |
| 118 }; | 110 }; |
| 119 | 111 |
| 120 } // namespace edk | 112 } // namespace edk |
| 121 } // namespace mojo | 113 } // namespace mojo |
| 122 | 114 |
| 123 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ | 115 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ |
| OLD | NEW |