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

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

Issue 798993003: Add embedder::AsyncWait() (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 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
« mojo/edk/system/async_waiter.cc ('K') | « mojo/edk/system/core.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/core.cc
diff --git a/mojo/edk/system/core.cc b/mojo/edk/system/core.cc
index 3843d9714a7702c36e2290e382976eaf0c08388b..c40897e523874e631871b0d428060ed806dde765 100644
--- a/mojo/edk/system/core.cc
+++ b/mojo/edk/system/core.cc
@@ -10,6 +10,7 @@
#include "base/time/time.h"
#include "mojo/edk/embedder/platform_shared_buffer.h"
#include "mojo/edk/embedder/platform_support.h"
+#include "mojo/edk/system/async_waiter.h"
#include "mojo/edk/system/configuration.h"
#include "mojo/edk/system/data_pipe.h"
#include "mojo/edk/system/data_pipe_consumer_dispatcher.h"
@@ -97,6 +98,21 @@ scoped_refptr<Dispatcher> Core::GetDispatcher(MojoHandle handle) {
return handle_table_.GetDispatcher(handle);
}
+MojoResult Core::AsyncWait(MojoHandle handle,
viettrungluu 2014/12/12 21:39:31 You should add a test in core_unittest.cc for this
+ MojoHandleSignals signals,
+ base::Callback<void(MojoResult)> callback) {
+ scoped_refptr<Dispatcher> dispatcher = GetDispatcher(handle);
+ DCHECK(dispatcher);
+
+ scoped_ptr<AsyncWaiter> waiter = make_scoped_ptr(new AsyncWaiter(callback));
+ MojoResult rv = dispatcher->AddAwakable(waiter.get(), signals, 0, nullptr);
+ if (rv != MOJO_RESULT_OK)
viettrungluu 2014/12/12 21:39:31 Probably: if (rv == MOJO_RESULT_OK) ignore_resu
gmorrita 2014/12/12 22:56:28 Done.
+ return rv;
+
+ ignore_result(waiter.release());
+ return MOJO_RESULT_OK;
+}
+
MojoTimeTicks Core::GetTimeTicksNow() {
return base::TimeTicks::Now().ToInternalValue();
}
« mojo/edk/system/async_waiter.cc ('K') | « mojo/edk/system/core.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698