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_SYSTEM_MESSAGE_PIPE_H_ | 5 #ifndef MOJO_SYSTEM_MESSAGE_PIPE_H_ |
6 #define MOJO_SYSTEM_MESSAGE_PIPE_H_ | 6 #define MOJO_SYSTEM_MESSAGE_PIPE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "mojo/public/c/system/message_pipe.h" | 16 #include "mojo/public/c/system/message_pipe.h" |
17 #include "mojo/public/c/system/types.h" | 17 #include "mojo/public/c/system/types.h" |
18 #include "mojo/system/dispatcher.h" | 18 #include "mojo/system/dispatcher.h" |
| 19 #include "mojo/system/memory.h" |
19 #include "mojo/system/message_in_transit.h" | 20 #include "mojo/system/message_in_transit.h" |
20 #include "mojo/system/message_pipe_endpoint.h" | 21 #include "mojo/system/message_pipe_endpoint.h" |
21 #include "mojo/system/system_impl_export.h" | 22 #include "mojo/system/system_impl_export.h" |
22 | 23 |
23 namespace mojo { | 24 namespace mojo { |
24 namespace system { | 25 namespace system { |
25 | 26 |
26 class Channel; | 27 class Channel; |
27 class Waiter; | 28 class Waiter; |
28 | 29 |
(...skipping 20 matching lines...) Expand all Loading... |
49 // corresponding names. In all cases, the port |port| must be open. | 50 // corresponding names. In all cases, the port |port| must be open. |
50 void CancelAllWaiters(unsigned port); | 51 void CancelAllWaiters(unsigned port); |
51 void Close(unsigned port); | 52 void Close(unsigned port); |
52 // Unlike |MessagePipeDispatcher::WriteMessage()|, this does not validate its | 53 // Unlike |MessagePipeDispatcher::WriteMessage()|, this does not validate its |
53 // arguments. | 54 // arguments. |
54 MojoResult WriteMessage(unsigned port, | 55 MojoResult WriteMessage(unsigned port, |
55 const void* bytes, | 56 const void* bytes, |
56 uint32_t num_bytes, | 57 uint32_t num_bytes, |
57 std::vector<DispatcherTransport>* transports, | 58 std::vector<DispatcherTransport>* transports, |
58 MojoWriteMessageFlags flags); | 59 MojoWriteMessageFlags flags); |
59 // Unlike |MessagePipeDispatcher::ReadMessage()|, this does not validate its | |
60 // arguments. | |
61 MojoResult ReadMessage(unsigned port, | 60 MojoResult ReadMessage(unsigned port, |
62 void* bytes, | 61 UserPointer<void> bytes, |
63 uint32_t* num_bytes, | 62 UserPointer<uint32_t> num_bytes, |
64 DispatcherVector* dispatchers, | 63 DispatcherVector* dispatchers, |
65 uint32_t* num_dispatchers, | 64 uint32_t* num_dispatchers, |
66 MojoReadMessageFlags flags); | 65 MojoReadMessageFlags flags); |
67 MojoResult AddWaiter(unsigned port, | 66 MojoResult AddWaiter(unsigned port, |
68 Waiter* waiter, | 67 Waiter* waiter, |
69 MojoHandleSignals signals, | 68 MojoHandleSignals signals, |
70 uint32_t context); | 69 uint32_t context); |
71 void RemoveWaiter(unsigned port, Waiter* waiter); | 70 void RemoveWaiter(unsigned port, Waiter* waiter); |
72 | 71 |
73 // This is called by the dispatcher to convert a local endpoint to a proxy | 72 // This is called by the dispatcher to convert a local endpoint to a proxy |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 base::Lock lock_; // Protects the following members. | 112 base::Lock lock_; // Protects the following members. |
114 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; | 113 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; |
115 | 114 |
116 DISALLOW_COPY_AND_ASSIGN(MessagePipe); | 115 DISALLOW_COPY_AND_ASSIGN(MessagePipe); |
117 }; | 116 }; |
118 | 117 |
119 } // namespace system | 118 } // namespace system |
120 } // namespace mojo | 119 } // namespace mojo |
121 | 120 |
122 #endif // MOJO_SYSTEM_MESSAGE_PIPE_H_ | 121 #endif // MOJO_SYSTEM_MESSAGE_PIPE_H_ |
OLD | NEW |