| 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 10 matching lines...) Expand all Loading... |
| 21 #include "mojo/edk/system/memory.h" | 21 #include "mojo/edk/system/memory.h" |
| 22 #include "mojo/edk/system/message_in_transit.h" | 22 #include "mojo/edk/system/message_in_transit.h" |
| 23 #include "mojo/edk/system/message_pipe_endpoint.h" | 23 #include "mojo/edk/system/message_pipe_endpoint.h" |
| 24 #include "mojo/edk/system/system_impl_export.h" | 24 #include "mojo/edk/system/system_impl_export.h" |
| 25 #include "mojo/public/c/system/message_pipe.h" | 25 #include "mojo/public/c/system/message_pipe.h" |
| 26 #include "mojo/public/c/system/types.h" | 26 #include "mojo/public/c/system/types.h" |
| 27 | 27 |
| 28 namespace mojo { | 28 namespace mojo { |
| 29 namespace system { | 29 namespace system { |
| 30 | 30 |
| 31 class Awakable; |
| 31 class Channel; | 32 class Channel; |
| 32 class ChannelEndpoint; | 33 class ChannelEndpoint; |
| 33 class Waiter; | |
| 34 | 34 |
| 35 // |MessagePipe| is the secondary object implementing a message pipe (see the | 35 // |MessagePipe| is the secondary object implementing a message pipe (see the |
| 36 // explanatory comment in core.cc). It is typically owned by the dispatcher(s) | 36 // explanatory comment in core.cc). It is typically owned by the dispatcher(s) |
| 37 // corresponding to the local endpoints. This class is thread-safe. | 37 // corresponding to the local endpoints. This class is thread-safe. |
| 38 class MOJO_SYSTEM_IMPL_EXPORT MessagePipe : public ChannelEndpointClient { | 38 class MOJO_SYSTEM_IMPL_EXPORT MessagePipe : public ChannelEndpointClient { |
| 39 public: | 39 public: |
| 40 // Creates a |MessagePipe| with two new |LocalMessagePipeEndpoint|s. | 40 // Creates a |MessagePipe| with two new |LocalMessagePipeEndpoint|s. |
| 41 static MessagePipe* CreateLocalLocal(); | 41 static MessagePipe* CreateLocalLocal(); |
| 42 | 42 |
| 43 // Creates a |MessagePipe| with a |LocalMessagePipeEndpoint| on port 0 and a | 43 // Creates a |MessagePipe| with a |LocalMessagePipeEndpoint| on port 0 and a |
| (...skipping 21 matching lines...) Expand all Loading... |
| 65 const void* source, | 65 const void* source, |
| 66 size_t size, | 66 size_t size, |
| 67 scoped_refptr<MessagePipe>* message_pipe, | 67 scoped_refptr<MessagePipe>* message_pipe, |
| 68 unsigned* port); | 68 unsigned* port); |
| 69 | 69 |
| 70 // Gets the type of the endpoint (used for assertions, etc.). | 70 // Gets the type of the endpoint (used for assertions, etc.). |
| 71 MessagePipeEndpoint::Type GetType(unsigned port); | 71 MessagePipeEndpoint::Type GetType(unsigned port); |
| 72 | 72 |
| 73 // These are called by the dispatcher to implement its methods of | 73 // These are called by the dispatcher to implement its methods of |
| 74 // corresponding names. In all cases, the port |port| must be open. | 74 // corresponding names. In all cases, the port |port| must be open. |
| 75 void CancelAllWaiters(unsigned port); | 75 void CancelAllAwakables(unsigned port); |
| 76 void Close(unsigned port); | 76 void Close(unsigned port); |
| 77 // Unlike |MessagePipeDispatcher::WriteMessage()|, this does not validate its | 77 // Unlike |MessagePipeDispatcher::WriteMessage()|, this does not validate its |
| 78 // arguments. | 78 // arguments. |
| 79 MojoResult WriteMessage(unsigned port, | 79 MojoResult WriteMessage(unsigned port, |
| 80 UserPointer<const void> bytes, | 80 UserPointer<const void> bytes, |
| 81 uint32_t num_bytes, | 81 uint32_t num_bytes, |
| 82 std::vector<DispatcherTransport>* transports, | 82 std::vector<DispatcherTransport>* transports, |
| 83 MojoWriteMessageFlags flags); | 83 MojoWriteMessageFlags flags); |
| 84 MojoResult ReadMessage(unsigned port, | 84 MojoResult ReadMessage(unsigned port, |
| 85 UserPointer<void> bytes, | 85 UserPointer<void> bytes, |
| 86 UserPointer<uint32_t> num_bytes, | 86 UserPointer<uint32_t> num_bytes, |
| 87 DispatcherVector* dispatchers, | 87 DispatcherVector* dispatchers, |
| 88 uint32_t* num_dispatchers, | 88 uint32_t* num_dispatchers, |
| 89 MojoReadMessageFlags flags); | 89 MojoReadMessageFlags flags); |
| 90 HandleSignalsState GetHandleSignalsState(unsigned port) const; | 90 HandleSignalsState GetHandleSignalsState(unsigned port) const; |
| 91 MojoResult AddWaiter(unsigned port, | 91 MojoResult AddAwakable(unsigned port, |
| 92 Waiter* waiter, | 92 Awakable* awakable, |
| 93 MojoHandleSignals signals, | 93 MojoHandleSignals signals, |
| 94 uint32_t context, | 94 uint32_t context, |
| 95 HandleSignalsState* signals_state); | 95 HandleSignalsState* signals_state); |
| 96 void RemoveWaiter(unsigned port, | 96 void RemoveAwakable(unsigned port, |
| 97 Waiter* waiter, | 97 Awakable* awakable, |
| 98 HandleSignalsState* signals_state); | 98 HandleSignalsState* signals_state); |
| 99 void StartSerialize(unsigned port, | 99 void StartSerialize(unsigned port, |
| 100 Channel* channel, | 100 Channel* channel, |
| 101 size_t* max_size, | 101 size_t* max_size, |
| 102 size_t* max_platform_handles); | 102 size_t* max_platform_handles); |
| 103 bool EndSerialize(unsigned port, | 103 bool EndSerialize(unsigned port, |
| 104 Channel* channel, | 104 Channel* channel, |
| 105 void* destination, | 105 void* destination, |
| 106 size_t* actual_size, | 106 size_t* actual_size, |
| 107 embedder::PlatformHandleVector* platform_handles); | 107 embedder::PlatformHandleVector* platform_handles); |
| 108 | 108 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 131 base::Lock lock_; // Protects the following members. | 131 base::Lock lock_; // Protects the following members. |
| 132 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; | 132 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; |
| 133 | 133 |
| 134 DISALLOW_COPY_AND_ASSIGN(MessagePipe); | 134 DISALLOW_COPY_AND_ASSIGN(MessagePipe); |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 } // namespace system | 137 } // namespace system |
| 138 } // namespace mojo | 138 } // namespace mojo |
| 139 | 139 |
| 140 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ | 140 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_H_ |
| OLD | NEW |