Index: mojo/edk/system/dispatcher.cc |
diff --git a/mojo/edk/system/dispatcher.cc b/mojo/edk/system/dispatcher.cc |
index 38994577e598e72a3766e460b26018091fb28ef0..2a1746a5253768c04be351648997f0cf63700971 100644 |
--- a/mojo/edk/system/dispatcher.cc |
+++ b/mojo/edk/system/dispatcher.cc |
@@ -76,6 +76,7 @@ scoped_refptr<Dispatcher> Dispatcher::TransportDataAccess::Deserialize( |
PlatformHandleVector* platform_handles) { |
switch (static_cast<Dispatcher::Type>(type)) { |
case Type::UNKNOWN: |
+ case Type::WAIT_SET: |
DVLOG(2) << "Deserializing invalid handle"; |
return nullptr; |
case Type::MESSAGE_PIPE: |
@@ -253,6 +254,37 @@ void Dispatcher::RemoveAwakable(Awakable* awakable, |
RemoveAwakableImplNoLock(awakable, handle_signals_state); |
} |
+MojoResult Dispatcher::AddWaitingDispatcher( |
+ const scoped_refptr<Dispatcher>& dispatcher, |
+ MojoHandleSignals signals, |
+ uintptr_t context) { |
+ base::AutoLock locker(lock_); |
+ if (is_closed_) |
+ return MOJO_RESULT_INVALID_ARGUMENT; |
+ |
+ return AddWaitingDispatcherImplNoLock(dispatcher, signals, context); |
+} |
+ |
+MojoResult Dispatcher::RemoveWaitingDispatcher( |
+ const scoped_refptr<Dispatcher>& dispatcher) { |
+ base::AutoLock locker(lock_); |
+ if (is_closed_) |
+ return MOJO_RESULT_INVALID_ARGUMENT; |
+ |
+ return RemoveWaitingDispatcherImplNoLock(dispatcher); |
+} |
+ |
+MojoResult Dispatcher::GetReadyDispatchers(uint32_t* count, |
+ DispatcherVector* dispatchers, |
+ MojoResult* results, |
+ uintptr_t* contexts) { |
+ base::AutoLock locker(lock_); |
+ if (is_closed_) |
+ return MOJO_RESULT_INVALID_ARGUMENT; |
+ |
+ return GetReadyDispatchersImplNoLock(count, dispatchers, results, contexts); |
+} |
+ |
Dispatcher::Dispatcher() : is_closed_(false) { |
} |
@@ -392,6 +424,35 @@ MojoResult Dispatcher::AddAwakableImplNoLock( |
return MOJO_RESULT_FAILED_PRECONDITION; |
} |
+MojoResult Dispatcher::AddWaitingDispatcherImplNoLock( |
+ const scoped_refptr<Dispatcher>& /*dispatcher*/, |
+ MojoHandleSignals /*signals*/, |
+ uintptr_t /*context*/) { |
+ lock_.AssertAcquired(); |
+ 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*/) { |
+ lock_.AssertAcquired(); |
+ DCHECK(!is_closed_); |
+ // By default, not supported. Only needed for wait set dispatchers. |
+ return MOJO_RESULT_INVALID_ARGUMENT; |
+} |
+ |
+MojoResult Dispatcher::GetReadyDispatchersImplNoLock( |
+ uint32_t* /*count*/, |
+ DispatcherVector* /*dispatchers*/, |
+ MojoResult* /*results*/, |
+ uintptr_t* /*contexts*/) { |
+ lock_.AssertAcquired(); |
+ 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) { |
lock_.AssertAcquired(); |