| 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 |
| 11 #include <memory> |
| 11 #include <ostream> | 12 #include <ostream> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 16 #include "mojo/edk/embedder/platform_handle_vector.h" | 17 #include "mojo/edk/embedder/platform_handle_vector.h" |
| 17 #include "mojo/edk/system/handle_signals_state.h" | 18 #include "mojo/edk/system/handle_signals_state.h" |
| 18 #include "mojo/edk/system/memory.h" | 19 #include "mojo/edk/system/memory.h" |
| 19 #include "mojo/edk/system/mutex.h" | 20 #include "mojo/edk/system/mutex.h" |
| 20 #include "mojo/edk/system/system_impl_export.h" | 21 #include "mojo/edk/system/system_impl_export.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // |options| may be null. |new_dispatcher| must not be null, but | 115 // |options| may be null. |new_dispatcher| must not be null, but |
| 115 // |*new_dispatcher| should be null (and will contain the dispatcher for the | 116 // |*new_dispatcher| should be null (and will contain the dispatcher for the |
| 116 // new handle on success). | 117 // new handle on success). |
| 117 MojoResult DuplicateBufferHandle( | 118 MojoResult DuplicateBufferHandle( |
| 118 UserPointer<const MojoDuplicateBufferHandleOptions> options, | 119 UserPointer<const MojoDuplicateBufferHandleOptions> options, |
| 119 scoped_refptr<Dispatcher>* new_dispatcher); | 120 scoped_refptr<Dispatcher>* new_dispatcher); |
| 120 MojoResult MapBuffer( | 121 MojoResult MapBuffer( |
| 121 uint64_t offset, | 122 uint64_t offset, |
| 122 uint64_t num_bytes, | 123 uint64_t num_bytes, |
| 123 MojoMapBufferFlags flags, | 124 MojoMapBufferFlags flags, |
| 124 scoped_ptr<embedder::PlatformSharedBufferMapping>* mapping); | 125 std::unique_ptr<embedder::PlatformSharedBufferMapping>* mapping); |
| 125 | 126 |
| 126 // Gets the current handle signals state. (The default implementation simply | 127 // Gets the current handle signals state. (The default implementation simply |
| 127 // returns a default-constructed |HandleSignalsState|, i.e., no signals | 128 // returns a default-constructed |HandleSignalsState|, i.e., no signals |
| 128 // satisfied or satisfiable.) Note: The state is subject to change from other | 129 // satisfied or satisfiable.) Note: The state is subject to change from other |
| 129 // threads. | 130 // threads. |
| 130 HandleSignalsState GetHandleSignalsState() const; | 131 HandleSignalsState GetHandleSignalsState() const; |
| 131 | 132 |
| 132 // Adds an awakable to this dispatcher, which will be woken up when this | 133 // Adds an awakable to this dispatcher, which will be woken up when this |
| 133 // object changes state to satisfy |signals| with context |context|. It will | 134 // object changes state to satisfy |signals| with context |context|. It will |
| 134 // also be woken up when it becomes impossible for the object to ever satisfy | 135 // also be woken up when it becomes impossible for the object to ever satisfy |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 virtual MojoResult EndReadDataImplNoLock(uint32_t num_bytes_read) | 266 virtual MojoResult EndReadDataImplNoLock(uint32_t num_bytes_read) |
| 266 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); | 267 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); |
| 267 virtual MojoResult DuplicateBufferHandleImplNoLock( | 268 virtual MojoResult DuplicateBufferHandleImplNoLock( |
| 268 UserPointer<const MojoDuplicateBufferHandleOptions> options, | 269 UserPointer<const MojoDuplicateBufferHandleOptions> options, |
| 269 scoped_refptr<Dispatcher>* new_dispatcher) | 270 scoped_refptr<Dispatcher>* new_dispatcher) |
| 270 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); | 271 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); |
| 271 virtual MojoResult MapBufferImplNoLock( | 272 virtual MojoResult MapBufferImplNoLock( |
| 272 uint64_t offset, | 273 uint64_t offset, |
| 273 uint64_t num_bytes, | 274 uint64_t num_bytes, |
| 274 MojoMapBufferFlags flags, | 275 MojoMapBufferFlags flags, |
| 275 scoped_ptr<embedder::PlatformSharedBufferMapping>* mapping) | 276 std::unique_ptr<embedder::PlatformSharedBufferMapping>* mapping) |
| 276 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); | 277 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); |
| 277 virtual HandleSignalsState GetHandleSignalsStateImplNoLock() const | 278 virtual HandleSignalsState GetHandleSignalsStateImplNoLock() const |
| 278 MOJO_SHARED_LOCKS_REQUIRED(mutex_); | 279 MOJO_SHARED_LOCKS_REQUIRED(mutex_); |
| 279 virtual MojoResult AddAwakableImplNoLock(Awakable* awakable, | 280 virtual MojoResult AddAwakableImplNoLock(Awakable* awakable, |
| 280 MojoHandleSignals signals, | 281 MojoHandleSignals signals, |
| 281 uint32_t context, | 282 uint32_t context, |
| 282 HandleSignalsState* signals_state) | 283 HandleSignalsState* signals_state) |
| 283 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); | 284 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_); |
| 284 virtual void RemoveAwakableImplNoLock(Awakable* awakable, | 285 virtual void RemoveAwakableImplNoLock(Awakable* awakable, |
| 285 HandleSignalsState* signals_state) | 286 HandleSignalsState* signals_state) |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 // So logging macros and |DCHECK_EQ()|, etc. work. | 426 // So logging macros and |DCHECK_EQ()|, etc. work. |
| 426 MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<(std::ostream& out, | 427 MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<(std::ostream& out, |
| 427 Dispatcher::Type type) { | 428 Dispatcher::Type type) { |
| 428 return out << static_cast<int>(type); | 429 return out << static_cast<int>(type); |
| 429 } | 430 } |
| 430 | 431 |
| 431 } // namespace system | 432 } // namespace system |
| 432 } // namespace mojo | 433 } // namespace mojo |
| 433 | 434 |
| 434 #endif // MOJO_EDK_SYSTEM_DISPATCHER_H_ | 435 #endif // MOJO_EDK_SYSTEM_DISPATCHER_H_ |
| OLD | NEW |