| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_H_ | 5 #ifndef MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ |
| 6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ | 6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 // These are called by the dispatcher to implement its methods of | 83 // These are called by the dispatcher to implement its methods of |
| 84 // corresponding names. In all cases, the port |port| must be open. | 84 // corresponding names. In all cases, the port |port| must be open. |
| 85 void CancelAllAwakables(unsigned port); | 85 void CancelAllAwakables(unsigned port); |
| 86 void Close(unsigned port); | 86 void Close(unsigned port); |
| 87 // Unlike |MessagePipeDispatcher::WriteMessage()|, this does not validate its | 87 // Unlike |MessagePipeDispatcher::WriteMessage()|, this does not validate its |
| 88 // arguments. | 88 // arguments. |
| 89 MojoResult WriteMessage(unsigned port, | 89 MojoResult WriteMessage(unsigned port, |
| 90 UserPointer<const void> bytes, | 90 UserPointer<const void> bytes, |
| 91 uint32_t num_bytes, | 91 uint32_t num_bytes, |
| 92 std::vector<DispatcherTransport>* transports, | 92 std::vector<HandleTransport>* transports, |
| 93 MojoWriteMessageFlags flags); | 93 MojoWriteMessageFlags flags); |
| 94 MojoResult ReadMessage(unsigned port, | 94 MojoResult ReadMessage(unsigned port, |
| 95 UserPointer<void> bytes, | 95 UserPointer<void> bytes, |
| 96 UserPointer<uint32_t> num_bytes, | 96 UserPointer<uint32_t> num_bytes, |
| 97 DispatcherVector* dispatchers, | 97 DispatcherVector* dispatchers, |
| 98 uint32_t* num_dispatchers, | 98 uint32_t* num_dispatchers, |
| 99 MojoReadMessageFlags flags); | 99 MojoReadMessageFlags flags); |
| 100 HandleSignalsState GetHandleSignalsState(unsigned port) const; | 100 HandleSignalsState GetHandleSignalsState(unsigned port) const; |
| 101 MojoResult AddAwakable(unsigned port, | 101 MojoResult AddAwakable(unsigned port, |
| 102 Awakable* awakable, | 102 Awakable* awakable, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 129 | 129 |
| 130 private: | 130 private: |
| 131 MessagePipe(); | 131 MessagePipe(); |
| 132 ~MessagePipe() override; | 132 ~MessagePipe() override; |
| 133 | 133 |
| 134 // This is used internally by |WriteMessage()| and by |OnReadMessage()|. | 134 // This is used internally by |WriteMessage()| and by |OnReadMessage()|. |
| 135 // |transports| may be non-null only if it's nonempty and |message| has no | 135 // |transports| may be non-null only if it's nonempty and |message| has no |
| 136 // dispatchers attached. Must be called with |lock_| held. | 136 // dispatchers attached. Must be called with |lock_| held. |
| 137 MojoResult EnqueueMessageNoLock(unsigned port, | 137 MojoResult EnqueueMessageNoLock(unsigned port, |
| 138 std::unique_ptr<MessageInTransit> message, | 138 std::unique_ptr<MessageInTransit> message, |
| 139 std::vector<DispatcherTransport>* transports) | 139 std::vector<HandleTransport>* transports) |
| 140 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); | 140 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); |
| 141 | 141 |
| 142 // Helper for |EnqueueMessageNoLock()|. | 142 // Helper for |EnqueueMessageNoLock()|. |
| 143 MojoResult AttachTransportsNoLock( | 143 MojoResult AttachTransportsNoLock(unsigned port, |
| 144 unsigned port, | 144 MessageInTransit* message, |
| 145 MessageInTransit* message, | 145 std::vector<HandleTransport>* transports) |
| 146 std::vector<DispatcherTransport>* transports) | |
| 147 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); | 146 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); |
| 148 | 147 |
| 149 mutable util::Mutex mutex_; | 148 mutable util::Mutex mutex_; |
| 150 std::unique_ptr<MessagePipeEndpoint> endpoints_[2] MOJO_GUARDED_BY(mutex_); | 149 std::unique_ptr<MessagePipeEndpoint> endpoints_[2] MOJO_GUARDED_BY(mutex_); |
| 151 | 150 |
| 152 MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipe); | 151 MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipe); |
| 153 }; | 152 }; |
| 154 | 153 |
| 155 } // namespace system | 154 } // namespace system |
| 156 } // namespace mojo | 155 } // namespace mojo |
| 157 | 156 |
| 158 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ | 157 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ |
| OLD | NEW |