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_DISPATCHER_H_ | 5 #ifndef MOJO_SYSTEM_DISPATCHER_H_ |
6 #define MOJO_SYSTEM_DISPATCHER_H_ | 6 #define MOJO_SYSTEM_DISPATCHER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 uint32_t* buffer_num_bytes, | 84 uint32_t* buffer_num_bytes, |
85 MojoWriteDataFlags flags); | 85 MojoWriteDataFlags flags); |
86 MojoResult EndWriteData(uint32_t num_bytes_written); | 86 MojoResult EndWriteData(uint32_t num_bytes_written); |
87 MojoResult ReadData(void* elements, | 87 MojoResult ReadData(void* elements, |
88 uint32_t* num_bytes, | 88 uint32_t* num_bytes, |
89 MojoReadDataFlags flags); | 89 MojoReadDataFlags flags); |
90 MojoResult BeginReadData(const void** buffer, | 90 MojoResult BeginReadData(const void** buffer, |
91 uint32_t* buffer_num_bytes, | 91 uint32_t* buffer_num_bytes, |
92 MojoReadDataFlags flags); | 92 MojoReadDataFlags flags); |
93 MojoResult EndReadData(uint32_t num_bytes_read); | 93 MojoResult EndReadData(uint32_t num_bytes_read); |
| 94 // |options| may be null. |new_dispatcher| must not be null, but |
| 95 // |*new_dispatcher| should be null (and will contain the dispatcher for the |
| 96 // new handle on success). |
| 97 MojoResult DuplicateBufferHandle( |
| 98 const MojoDuplicateBufferHandleOptions* options, |
| 99 scoped_refptr<Dispatcher>* new_dispatcher); |
| 100 MojoResult MapBuffer(uint64_t offset, |
| 101 uint64_t num_bytes, |
| 102 void** buffer, |
| 103 MojoMapBufferFlags flags); |
94 | 104 |
95 // Adds a waiter to this dispatcher. The waiter will be woken up when this | 105 // Adds a waiter to this dispatcher. The waiter will be woken up when this |
96 // object changes state to satisfy |flags| with result |wake_result| (which | 106 // object changes state to satisfy |flags| with result |wake_result| (which |
97 // must be >= 0, i.e., a success status). It will also be woken up when it | 107 // must be >= 0, i.e., a success status). It will also be woken up when it |
98 // becomes impossible for the object to ever satisfy |flags| with a suitable | 108 // becomes impossible for the object to ever satisfy |flags| with a suitable |
99 // error status. | 109 // error status. |
100 // | 110 // |
101 // Returns: | 111 // Returns: |
102 // - |MOJO_RESULT_OK| if the waiter was added; | 112 // - |MOJO_RESULT_OK| if the waiter was added; |
103 // - |MOJO_RESULT_ALREADY_EXISTS| if |flags| is already satisfied; | 113 // - |MOJO_RESULT_ALREADY_EXISTS| if |flags| is already satisfied; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 uint32_t* buffer_num_bytes, | 175 uint32_t* buffer_num_bytes, |
166 MojoWriteDataFlags flags); | 176 MojoWriteDataFlags flags); |
167 virtual MojoResult EndWriteDataImplNoLock(uint32_t num_bytes_written); | 177 virtual MojoResult EndWriteDataImplNoLock(uint32_t num_bytes_written); |
168 virtual MojoResult ReadDataImplNoLock(void* elements, | 178 virtual MojoResult ReadDataImplNoLock(void* elements, |
169 uint32_t* num_bytes, | 179 uint32_t* num_bytes, |
170 MojoReadDataFlags flags); | 180 MojoReadDataFlags flags); |
171 virtual MojoResult BeginReadDataImplNoLock(const void** buffer, | 181 virtual MojoResult BeginReadDataImplNoLock(const void** buffer, |
172 uint32_t* buffer_num_bytes, | 182 uint32_t* buffer_num_bytes, |
173 MojoReadDataFlags flags); | 183 MojoReadDataFlags flags); |
174 virtual MojoResult EndReadDataImplNoLock(uint32_t num_bytes_read); | 184 virtual MojoResult EndReadDataImplNoLock(uint32_t num_bytes_read); |
| 185 virtual MojoResult DuplicateBufferHandleImplNoLock( |
| 186 const MojoDuplicateBufferHandleOptions* options, |
| 187 scoped_refptr<Dispatcher>* new_dispatcher); |
| 188 virtual MojoResult MapBufferImplNoLock(uint64_t offset, |
| 189 uint64_t num_bytes, |
| 190 void** buffer, |
| 191 MojoMapBufferFlags flags); |
175 virtual MojoResult AddWaiterImplNoLock(Waiter* waiter, | 192 virtual MojoResult AddWaiterImplNoLock(Waiter* waiter, |
176 MojoWaitFlags flags, | 193 MojoWaitFlags flags, |
177 MojoResult wake_result); | 194 MojoResult wake_result); |
178 virtual void RemoveWaiterImplNoLock(Waiter* waiter); | 195 virtual void RemoveWaiterImplNoLock(Waiter* waiter); |
179 | 196 |
180 // Available to subclasses. (Note: Returns a non-const reference, just like | 197 // Available to subclasses. (Note: Returns a non-const reference, just like |
181 // |base::AutoLock|'s constructor takes a non-const reference.) | 198 // |base::AutoLock|'s constructor takes a non-const reference.) |
182 base::Lock& lock() const { return lock_; } | 199 base::Lock& lock() const { return lock_; } |
183 | 200 |
184 private: | 201 private: |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 inline DispatcherTransport DispatcherTryStartTransport(Dispatcher* dispatcher) { | 267 inline DispatcherTransport DispatcherTryStartTransport(Dispatcher* dispatcher) { |
251 return Dispatcher::CoreImplAccess::TryStartTransport(dispatcher); | 268 return Dispatcher::CoreImplAccess::TryStartTransport(dispatcher); |
252 } | 269 } |
253 | 270 |
254 } // namespace test | 271 } // namespace test |
255 | 272 |
256 } // namespace system | 273 } // namespace system |
257 } // namespace mojo | 274 } // namespace mojo |
258 | 275 |
259 #endif // MOJO_SYSTEM_DISPATCHER_H_ | 276 #endif // MOJO_SYSTEM_DISPATCHER_H_ |
OLD | NEW |