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

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

Issue 1504733002: Implementation of WaitSet for new EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-waitset-implementation
Patch Set: Add gyp rules. 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
« no previous file with comments | « mojo/edk/system/dispatcher.h ('k') | mojo/edk/system/wait_set_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « mojo/edk/system/dispatcher.h ('k') | mojo/edk/system/wait_set_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698