Index: third_party/mojo/src/mojo/edk/system/dispatcher.cc |
diff --git a/third_party/mojo/src/mojo/edk/system/dispatcher.cc b/third_party/mojo/src/mojo/edk/system/dispatcher.cc |
index 2c11407292bc7360fc8f46daf6f47cff91224c15..ba4fe18ad54ea890e9aae6cea5a5af2e2be1a7c6 100644 |
--- a/third_party/mojo/src/mojo/edk/system/dispatcher.cc |
+++ b/third_party/mojo/src/mojo/edk/system/dispatcher.cc |
@@ -74,6 +74,7 @@ scoped_refptr<Dispatcher> Dispatcher::TransportDataAccess::Deserialize( |
size_t size, |
embedder::PlatformHandleVector* platform_handles) { |
switch (static_cast<Dispatcher::Type>(type)) { |
+ case Type::WAIT_SET: |
case Type::UNKNOWN: |
DVLOG(2) << "Deserializing invalid handle"; |
return nullptr; |
@@ -250,6 +251,37 @@ void Dispatcher::RemoveAwakable(Awakable* awakable, |
RemoveAwakableImplNoLock(awakable, handle_signals_state); |
} |
+MojoResult Dispatcher::AddWaitingDispatcher( |
+ const scoped_refptr<Dispatcher>& dispatcher, |
+ MojoHandleSignals signals, |
+ uintptr_t context) { |
+ MutexLocker locker(&mutex_); |
+ if (is_closed_) |
+ return MOJO_RESULT_INVALID_ARGUMENT; |
+ |
+ return AddWaitingDispatcherImplNoLock(dispatcher, signals, context); |
+} |
+ |
+MojoResult Dispatcher::RemoveWaitingDispatcher( |
+ const scoped_refptr<Dispatcher>& dispatcher) { |
+ MutexLocker locker(&mutex_); |
+ if (is_closed_) |
+ return MOJO_RESULT_INVALID_ARGUMENT; |
+ |
+ return RemoveWaitingDispatcherImplNoLock(dispatcher); |
+} |
+ |
+MojoResult Dispatcher::GetReadyDispatchers(UserPointer<uint32_t> count, |
+ DispatcherVector* dispatchers, |
+ UserPointer<MojoResult> results, |
+ UserPointer<uintptr_t> contexts) { |
+ MutexLocker locker(&mutex_); |
+ if (is_closed_) |
+ return MOJO_RESULT_INVALID_ARGUMENT; |
+ |
+ return GetReadyDispatchersImplNoLock(count, dispatchers, results, contexts); |
+} |
+ |
Dispatcher::Dispatcher() : is_closed_(false) { |
} |
@@ -389,6 +421,35 @@ MojoResult Dispatcher::AddAwakableImplNoLock( |
return MOJO_RESULT_FAILED_PRECONDITION; |
} |
+MojoResult Dispatcher::AddWaitingDispatcherImplNoLock( |
+ const scoped_refptr<Dispatcher>& /*dispatcher*/, |
+ MojoHandleSignals /*signals*/, |
+ uintptr_t /*context*/) { |
+ mutex_.AssertHeld(); |
+ DCHECK(!is_closed_); |
+ // By default, not supported. Only needed for wait set dispatchers. |
+ return MOJO_RESULT_INVALID_ARGUMENT; |
+} |
+ |
+MojoResult Dispatcher::RemoveWaitingDispatcherImplNoLock( |
+ const scoped_refptr<Dispatcher>& /*dispatcher*/) { |
+ mutex_.AssertHeld(); |
+ DCHECK(!is_closed_); |
+ // By default, not supported. Only needed for wait set dispatchers. |
+ return MOJO_RESULT_INVALID_ARGUMENT; |
+} |
+ |
+MojoResult Dispatcher::GetReadyDispatchersImplNoLock( |
+ UserPointer<uint32_t> /*count*/, |
+ DispatcherVector* /*dispatchers*/, |
+ UserPointer<MojoResult> /*results*/, |
+ UserPointer<uintptr_t> /*contexts*/) { |
+ mutex_.AssertHeld(); |
+ DCHECK(!is_closed_); |
+ // By default, not supported. Only needed for wait set dispatchers. |
+ return MOJO_RESULT_INVALID_ARGUMENT; |
+} |
+ |
void Dispatcher::RemoveAwakableImplNoLock(Awakable* /*awakable*/, |
HandleSignalsState* signals_state) { |
mutex_.AssertHeld(); |