| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // prevents the various |...ImplNoLock()|s from releasing the lock as soon as | 35 // prevents the various |...ImplNoLock()|s from releasing the lock as soon as |
| 36 // possible. If this becomes an issue, we can rethink this. | 36 // possible. If this becomes an issue, we can rethink this. |
| 37 MojoResult Close(); | 37 MojoResult Close(); |
| 38 // |dispatchers| may be non-null if and only if there are handles to be | 38 // |dispatchers| may be non-null if and only if there are handles to be |
| 39 // written, in which case this will be called with all the dispatchers' locks | 39 // written, in which case this will be called with all the dispatchers' locks |
| 40 // held. On success, all the dispatchers must have been moved to a closed | 40 // held. On success, all the dispatchers must have been moved to a closed |
| 41 // state; on failure, they should remain in their original state. | 41 // state; on failure, they should remain in their original state. |
| 42 MojoResult WriteMessage(const void* bytes, uint32_t num_bytes, | 42 MojoResult WriteMessage(const void* bytes, uint32_t num_bytes, |
| 43 const std::vector<Dispatcher*>* dispatchers, | 43 const std::vector<Dispatcher*>* dispatchers, |
| 44 MojoWriteMessageFlags flags); | 44 MojoWriteMessageFlags flags); |
| 45 // |dispatchers| must be non-null if |max_num_dispatchers| is nonzero. On | 45 // |dispatchers| must be non-null but empty, if |max_num_dispatchers| is |
| 46 // success, it will be set to the dispatchers to be received (and assigned | 46 // nonzero. On success, it will be set to the dispatchers to be received (and |
| 47 // handles) as part of the message. | 47 // assigned handles) as part of the message. |
| 48 MojoResult ReadMessage( | 48 MojoResult ReadMessage( |
| 49 void* bytes, uint32_t* num_bytes, | 49 void* bytes, uint32_t* num_bytes, |
| 50 uint32_t max_num_dispatchers, | 50 uint32_t max_num_dispatchers, |
| 51 std::vector<scoped_refptr<Dispatcher> >* dispatchers, | 51 std::vector<scoped_refptr<Dispatcher> >* dispatchers, |
| 52 MojoReadMessageFlags flags); | 52 MojoReadMessageFlags flags); |
| 53 | 53 |
| 54 // Adds a waiter to this dispatcher. The waiter will be woken up when this | 54 // Adds a waiter to this dispatcher. The waiter will be woken up when this |
| 55 // object changes state to satisfy |flags| with result |wake_result| (which | 55 // object changes state to satisfy |flags| with result |wake_result| (which |
| 56 // must be >= 0, i.e., a success status). It will also be woken up when it | 56 // must be >= 0, i.e., a success status). It will also be woken up when it |
| 57 // becomes impossible for the object to ever satisfy |flags| with a suitable | 57 // becomes impossible for the object to ever satisfy |flags| with a suitable |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 mutable base::Lock lock_; | 111 mutable base::Lock lock_; |
| 112 bool is_closed_; | 112 bool is_closed_; |
| 113 | 113 |
| 114 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 114 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 } // namespace system | 117 } // namespace system |
| 118 } // namespace mojo | 118 } // namespace mojo |
| 119 | 119 |
| 120 #endif // MOJO_SYSTEM_DISPATCHER_H_ | 120 #endif // MOJO_SYSTEM_DISPATCHER_H_ |
| OLD | NEW |