| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // implement the primitives. | 73 // implement the primitives. |
| 74 // NOTE(vtl): This puts a big lock around each dispatcher (i.e., handle), and | 74 // NOTE(vtl): This puts a big lock around each dispatcher (i.e., handle), and |
| 75 // prevents the various |...ImplNoLock()|s from releasing the lock as soon as | 75 // prevents the various |...ImplNoLock()|s from releasing the lock as soon as |
| 76 // possible. If this becomes an issue, we can rethink this. | 76 // possible. If this becomes an issue, we can rethink this. |
| 77 MojoResult Close(); | 77 MojoResult Close(); |
| 78 | 78 |
| 79 // |transports| may be non-null if and only if there are handles to be | 79 // |transports| may be non-null if and only if there are handles to be |
| 80 // written; not that |this| must not be in |transports|. On success, all the | 80 // written; not that |this| must not be in |transports|. On success, all the |
| 81 // dispatchers in |transports| must have been moved to a closed state; on | 81 // dispatchers in |transports| must have been moved to a closed state; on |
| 82 // failure, they should remain in their original state. | 82 // failure, they should remain in their original state. |
| 83 MojoResult WriteMessage(const void* bytes, | 83 MojoResult WriteMessage(UserPointer<const void> bytes, |
| 84 uint32_t num_bytes, | 84 uint32_t num_bytes, |
| 85 std::vector<DispatcherTransport>* transports, | 85 std::vector<DispatcherTransport>* transports, |
| 86 MojoWriteMessageFlags flags); | 86 MojoWriteMessageFlags flags); |
| 87 // |dispatchers| must be non-null but empty, if |num_dispatchers| is non-null | 87 // |dispatchers| must be non-null but empty, if |num_dispatchers| is non-null |
| 88 // and nonzero. On success, it will be set to the dispatchers to be received | 88 // and nonzero. On success, it will be set to the dispatchers to be received |
| 89 // (and assigned handles) as part of the message. | 89 // (and assigned handles) as part of the message. |
| 90 MojoResult ReadMessage(UserPointer<void> bytes, | 90 MojoResult ReadMessage(UserPointer<void> bytes, |
| 91 UserPointer<uint32_t> num_bytes, | 91 UserPointer<uint32_t> num_bytes, |
| 92 DispatcherVector* dispatchers, | 92 DispatcherVector* dispatchers, |
| 93 uint32_t* num_dispatchers, | 93 uint32_t* num_dispatchers, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 virtual void CancelAllWaitersNoLock(); | 206 virtual void CancelAllWaitersNoLock(); |
| 207 virtual void CloseImplNoLock(); | 207 virtual void CloseImplNoLock(); |
| 208 virtual scoped_refptr<Dispatcher> | 208 virtual scoped_refptr<Dispatcher> |
| 209 CreateEquivalentDispatcherAndCloseImplNoLock() = 0; | 209 CreateEquivalentDispatcherAndCloseImplNoLock() = 0; |
| 210 | 210 |
| 211 // These are to be overridden by subclasses (if necessary). They are never | 211 // These are to be overridden by subclasses (if necessary). They are never |
| 212 // called after the dispatcher has been closed. They are called under |lock_|. | 212 // called after the dispatcher has been closed. They are called under |lock_|. |
| 213 // See the descriptions of the methods without the "ImplNoLock" for more | 213 // See the descriptions of the methods without the "ImplNoLock" for more |
| 214 // information. | 214 // information. |
| 215 virtual MojoResult WriteMessageImplNoLock( | 215 virtual MojoResult WriteMessageImplNoLock( |
| 216 const void* bytes, | 216 UserPointer<const void> bytes, |
| 217 uint32_t num_bytes, | 217 uint32_t num_bytes, |
| 218 std::vector<DispatcherTransport>* transports, | 218 std::vector<DispatcherTransport>* transports, |
| 219 MojoWriteMessageFlags flags); | 219 MojoWriteMessageFlags flags); |
| 220 virtual MojoResult ReadMessageImplNoLock(UserPointer<void> bytes, | 220 virtual MojoResult ReadMessageImplNoLock(UserPointer<void> bytes, |
| 221 UserPointer<uint32_t> num_bytes, | 221 UserPointer<uint32_t> num_bytes, |
| 222 DispatcherVector* dispatchers, | 222 DispatcherVector* dispatchers, |
| 223 uint32_t* num_dispatchers, | 223 uint32_t* num_dispatchers, |
| 224 MojoReadMessageFlags flags); | 224 MojoReadMessageFlags flags); |
| 225 virtual MojoResult WriteDataImplNoLock(const void* elements, | 225 virtual MojoResult WriteDataImplNoLock(const void* elements, |
| 226 uint32_t* num_bytes, | 226 uint32_t* num_bytes, |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 373 |
| 374 Dispatcher* dispatcher_; | 374 Dispatcher* dispatcher_; |
| 375 | 375 |
| 376 // Copy and assign allowed. | 376 // Copy and assign allowed. |
| 377 }; | 377 }; |
| 378 | 378 |
| 379 } // namespace system | 379 } // namespace system |
| 380 } // namespace mojo | 380 } // namespace mojo |
| 381 | 381 |
| 382 #endif // MOJO_SYSTEM_DISPATCHER_H_ | 382 #endif // MOJO_SYSTEM_DISPATCHER_H_ |
| OLD | NEW |