| 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_EDK_SYSTEM_DISPATCHER_H_ | 5 #ifndef MOJO_EDK_SYSTEM_DISPATCHER_H_ |
| 6 #define MOJO_EDK_SYSTEM_DISPATCHER_H_ | 6 #define MOJO_EDK_SYSTEM_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // to the current handle signals state (on success, it is left untouched). | 182 // to the current handle signals state (on success, it is left untouched). |
| 183 // | 183 // |
| 184 // Returns: | 184 // Returns: |
| 185 // - |MOJO_RESULT_OK| if the awakable was added; | 185 // - |MOJO_RESULT_OK| if the awakable was added; |
| 186 // - |MOJO_RESULT_ALREADY_EXISTS| if |signals| is already satisfied; | 186 // - |MOJO_RESULT_ALREADY_EXISTS| if |signals| is already satisfied; |
| 187 // - |MOJO_RESULT_INVALID_ARGUMENT| if the dispatcher has been closed; and | 187 // - |MOJO_RESULT_INVALID_ARGUMENT| if the dispatcher has been closed; and |
| 188 // - |MOJO_RESULT_FAILED_PRECONDITION| if it is not (or no longer) possible | 188 // - |MOJO_RESULT_FAILED_PRECONDITION| if it is not (or no longer) possible |
| 189 // that |signals| will ever be satisfied. | 189 // that |signals| will ever be satisfied. |
| 190 MojoResult AddAwakable(Awakable* awakable, | 190 MojoResult AddAwakable(Awakable* awakable, |
| 191 MojoHandleSignals signals, | 191 MojoHandleSignals signals, |
| 192 uint32_t context, | 192 uint64_t context, |
| 193 HandleSignalsState* signals_state); | 193 HandleSignalsState* signals_state); |
| 194 // Removes an awakable from this dispatcher. (It is valid to call this | 194 // Removes an awakable from this dispatcher. (It is valid to call this |
| 195 // multiple times for the same |awakable| on the same object, so long as | 195 // multiple times for the same |awakable| on the same object, so long as |
| 196 // |AddAwakable()| was called at most once.) If |signals_state| is non-null, | 196 // |AddAwakable()| was called at most once.) If |signals_state| is non-null, |
| 197 // |*signals_state| will be set to the current handle signals state. | 197 // |*signals_state| will be set to the current handle signals state. |
| 198 void RemoveAwakable(Awakable* awakable, HandleSignalsState* signals_state); | 198 void RemoveAwakable(Awakable* awakable, HandleSignalsState* signals_state); |
| 199 | 199 |
| 200 // A dispatcher must be put into a special state in order to be sent across a | 200 // A dispatcher must be put into a special state in order to be sent across a |
| 201 // message pipe. Outside of tests, only |HandleTableAccess| is allowed to do | 201 // message pipe. Outside of tests, only |HandleTableAccess| is allowed to do |
| 202 // this, since there are requirements on the handle table (see below). | 202 // this, since there are requirements on the handle table (see below). |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 virtual MojoResult MapBufferImplNoLock( | 346 virtual MojoResult MapBufferImplNoLock( |
| 347 uint64_t offset, | 347 uint64_t offset, |
| 348 uint64_t num_bytes, | 348 uint64_t num_bytes, |
| 349 MojoMapBufferFlags flags, | 349 MojoMapBufferFlags flags, |
| 350 std::unique_ptr<platform::PlatformSharedBufferMapping>* mapping) | 350 std::unique_ptr<platform::PlatformSharedBufferMapping>* mapping) |
| 351 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); | 351 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); |
| 352 virtual HandleSignalsState GetHandleSignalsStateImplNoLock() const | 352 virtual HandleSignalsState GetHandleSignalsStateImplNoLock() const |
| 353 MOJO_SHARED_LOCKS_REQUIRED(mutex_); | 353 MOJO_SHARED_LOCKS_REQUIRED(mutex_); |
| 354 virtual MojoResult AddAwakableImplNoLock(Awakable* awakable, | 354 virtual MojoResult AddAwakableImplNoLock(Awakable* awakable, |
| 355 MojoHandleSignals signals, | 355 MojoHandleSignals signals, |
| 356 uint32_t context, | 356 uint64_t context, |
| 357 HandleSignalsState* signals_state) | 357 HandleSignalsState* signals_state) |
| 358 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); | 358 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); |
| 359 virtual void RemoveAwakableImplNoLock(Awakable* awakable, | 359 virtual void RemoveAwakableImplNoLock(Awakable* awakable, |
| 360 HandleSignalsState* signals_state) | 360 HandleSignalsState* signals_state) |
| 361 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); | 361 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); |
| 362 | 362 |
| 363 // These implement the API used to serialize dispatchers to a |Channel| | 363 // These implement the API used to serialize dispatchers to a |Channel| |
| 364 // (described below). They will only be called on a dispatcher that's attached | 364 // (described below). They will only be called on a dispatcher that's attached |
| 365 // to and "owned" by a |MessageInTransit|. See the non-"impl" versions for | 365 // to and "owned" by a |MessageInTransit|. See the non-"impl" versions for |
| 366 // more information. | 366 // more information. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 460 |
| 461 // So logging macros and |DCHECK_EQ()|, etc. work. | 461 // So logging macros and |DCHECK_EQ()|, etc. work. |
| 462 inline std::ostream& operator<<(std::ostream& out, Dispatcher::Type type) { | 462 inline std::ostream& operator<<(std::ostream& out, Dispatcher::Type type) { |
| 463 return out << static_cast<int>(type); | 463 return out << static_cast<int>(type); |
| 464 } | 464 } |
| 465 | 465 |
| 466 } // namespace system | 466 } // namespace system |
| 467 } // namespace mojo | 467 } // namespace mojo |
| 468 | 468 |
| 469 #endif // MOJO_EDK_SYSTEM_DISPATCHER_H_ | 469 #endif // MOJO_EDK_SYSTEM_DISPATCHER_H_ |
| OLD | NEW |