| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // new handle on success). | 110 // new handle on success). |
| 111 MojoResult DuplicateBufferHandle( | 111 MojoResult DuplicateBufferHandle( |
| 112 const MojoDuplicateBufferHandleOptions* options, | 112 const MojoDuplicateBufferHandleOptions* options, |
| 113 scoped_refptr<Dispatcher>* new_dispatcher); | 113 scoped_refptr<Dispatcher>* new_dispatcher); |
| 114 MojoResult MapBuffer(uint64_t offset, | 114 MojoResult MapBuffer(uint64_t offset, |
| 115 uint64_t num_bytes, | 115 uint64_t num_bytes, |
| 116 MojoMapBufferFlags flags, | 116 MojoMapBufferFlags flags, |
| 117 scoped_ptr<RawSharedBufferMapping>* mapping); | 117 scoped_ptr<RawSharedBufferMapping>* mapping); |
| 118 | 118 |
| 119 // Adds a waiter to this dispatcher. The waiter will be woken up when this | 119 // Adds a waiter to this dispatcher. The waiter will be woken up when this |
| 120 // object changes state to satisfy |flags| with context |context|. It will | 120 // object changes state to satisfy |signals| with context |context|. It will |
| 121 // also be woken up when it becomes impossible for the object to ever satisfy | 121 // also be woken up when it becomes impossible for the object to ever satisfy |
| 122 // |flags| with a suitable error status. | 122 // |signals| with a suitable error status. |
| 123 // | 123 // |
| 124 // Returns: | 124 // Returns: |
| 125 // - |MOJO_RESULT_OK| if the waiter was added; | 125 // - |MOJO_RESULT_OK| if the waiter was added; |
| 126 // - |MOJO_RESULT_ALREADY_EXISTS| if |flags| is already satisfied; | 126 // - |MOJO_RESULT_ALREADY_EXISTS| if |signals| is already satisfied; |
| 127 // - |MOJO_RESULT_INVALID_ARGUMENT| if the dispatcher has been closed; and | 127 // - |MOJO_RESULT_INVALID_ARGUMENT| if the dispatcher has been closed; and |
| 128 // - |MOJO_RESULT_FAILED_PRECONDITION| if it is not (or no longer) possible | 128 // - |MOJO_RESULT_FAILED_PRECONDITION| if it is not (or no longer) possible |
| 129 // that |flags| will ever be satisfied. | 129 // that |signals| will ever be satisfied. |
| 130 MojoResult AddWaiter(Waiter* waiter, MojoWaitFlags flags, uint32_t context); | 130 MojoResult AddWaiter(Waiter* waiter, |
| 131 MojoHandleSignals signals, |
| 132 uint32_t context); |
| 131 void RemoveWaiter(Waiter* waiter); | 133 void RemoveWaiter(Waiter* waiter); |
| 132 | 134 |
| 133 // A dispatcher must be put into a special state in order to be sent across a | 135 // A dispatcher must be put into a special state in order to be sent across a |
| 134 // message pipe. Outside of tests, only |HandleTableAccess| is allowed to do | 136 // message pipe. Outside of tests, only |HandleTableAccess| is allowed to do |
| 135 // this, since there are requirements on the handle table (see below). | 137 // this, since there are requirements on the handle table (see below). |
| 136 // | 138 // |
| 137 // In this special state, only a restricted set of operations is allowed. | 139 // In this special state, only a restricted set of operations is allowed. |
| 138 // These are the ones available as |DispatcherTransport| methods. Other | 140 // These are the ones available as |DispatcherTransport| methods. Other |
| 139 // |Dispatcher| methods must not be called until |DispatcherTransport::End()| | 141 // |Dispatcher| methods must not be called until |DispatcherTransport::End()| |
| 140 // has been called. | 142 // has been called. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 virtual MojoResult EndReadDataImplNoLock(uint32_t num_bytes_read); | 237 virtual MojoResult EndReadDataImplNoLock(uint32_t num_bytes_read); |
| 236 virtual MojoResult DuplicateBufferHandleImplNoLock( | 238 virtual MojoResult DuplicateBufferHandleImplNoLock( |
| 237 const MojoDuplicateBufferHandleOptions* options, | 239 const MojoDuplicateBufferHandleOptions* options, |
| 238 scoped_refptr<Dispatcher>* new_dispatcher); | 240 scoped_refptr<Dispatcher>* new_dispatcher); |
| 239 virtual MojoResult MapBufferImplNoLock( | 241 virtual MojoResult MapBufferImplNoLock( |
| 240 uint64_t offset, | 242 uint64_t offset, |
| 241 uint64_t num_bytes, | 243 uint64_t num_bytes, |
| 242 MojoMapBufferFlags flags, | 244 MojoMapBufferFlags flags, |
| 243 scoped_ptr<RawSharedBufferMapping>* mapping); | 245 scoped_ptr<RawSharedBufferMapping>* mapping); |
| 244 virtual MojoResult AddWaiterImplNoLock(Waiter* waiter, | 246 virtual MojoResult AddWaiterImplNoLock(Waiter* waiter, |
| 245 MojoWaitFlags flags, | 247 MojoHandleSignals signals, |
| 246 uint32_t context); | 248 uint32_t context); |
| 247 virtual void RemoveWaiterImplNoLock(Waiter* waiter); | 249 virtual void RemoveWaiterImplNoLock(Waiter* waiter); |
| 248 | 250 |
| 249 // These implement the API used to serialize dispatchers to a |Channel| | 251 // These implement the API used to serialize dispatchers to a |Channel| |
| 250 // (described below). They will only be called on a dispatcher that's attached | 252 // (described below). They will only be called on a dispatcher that's attached |
| 251 // to and "owned" by a |MessageInTransit|. See the non-"impl" versions for | 253 // to and "owned" by a |MessageInTransit|. See the non-"impl" versions for |
| 252 // more information. | 254 // more information. |
| 253 // | 255 // |
| 254 // Note: |StartSerializeImplNoLock()| is actually called with |lock_| NOT | 256 // Note: |StartSerializeImplNoLock()| is actually called with |lock_| NOT |
| 255 // held, since the dispatcher should only be accessible to the calling thread. | 257 // held, since the dispatcher should only be accessible to the calling thread. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 370 |
| 369 Dispatcher* dispatcher_; | 371 Dispatcher* dispatcher_; |
| 370 | 372 |
| 371 // Copy and assign allowed. | 373 // Copy and assign allowed. |
| 372 }; | 374 }; |
| 373 | 375 |
| 374 } // namespace system | 376 } // namespace system |
| 375 } // namespace mojo | 377 } // namespace mojo |
| 376 | 378 |
| 377 #endif // MOJO_SYSTEM_DISPATCHER_H_ | 379 #endif // MOJO_SYSTEM_DISPATCHER_H_ |
| OLD | NEW |