Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: third_party/mojo/src/mojo/edk/system/dispatcher.cc

Issue 1461213002: WaitSet implementation for old EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-waitset-skeleton
Patch Set: Fix windows build and style issues. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
« no previous file with comments | « third_party/mojo/src/mojo/edk/system/dispatcher.h ('k') | third_party/mojo/src/mojo/edk/system/wait_set_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698