Chromium Code Reviews| 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(); |
| } |