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

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

Issue 2741033003: Mojo EDK: Introduce MojoQueryHandleSignalsState API (Closed)
Patch Set: fix stupid bad DCHECK Created 3 years, 9 months 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/embedder/entrypoints.cc ('k') | mojo/edk/system/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/js/core.cc
diff --git a/mojo/edk/js/core.cc b/mojo/edk/js/core.cc
index f3eec8cc8422ddf69ef0ba5f093a004e3b1d1d06..db9a395402c18022dbcd7fff83f428084361f6e2 100644
--- a/mojo/edk/js/core.cc
+++ b/mojo/edk/js/core.cc
@@ -35,6 +35,20 @@ MojoResult CloseHandle(gin::Handle<HandleWrapper> handle) {
return MOJO_RESULT_OK;
}
+gin::Dictionary QueryHandleSignalsState(const gin::Arguments& args,
+ mojo::Handle handle) {
+ gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(args.isolate());
+ if (!handle.is_valid()) {
+ dictionary.Set("result", MOJO_RESULT_INVALID_ARGUMENT);
+ } else {
+ HandleSignalsState state = handle.QuerySignalsState();
+ dictionary.Set("result", MOJO_RESULT_OK);
+ dictionary.Set("satisfiedSignals", state.satisfied_signals);
+ dictionary.Set("satisfiableSignals", state.satisfiable_signals);
+ }
+ return dictionary;
+}
+
gin::Dictionary WaitHandle(const gin::Arguments& args,
mojo::Handle handle,
MojoHandleSignals signals,
@@ -388,6 +402,7 @@ v8::Local<v8::Value> Core::GetModule(v8::Isolate* isolate) {
// TODO(mpcomplete): Should these just be methods on the JS Handle
// object?
.SetMethod("close", CloseHandle)
+ .SetMethod("queryHandleSignalsState", QueryHandleSignalsState)
.SetMethod("wait", WaitHandle)
.SetMethod("waitMany", WaitMany)
.SetMethod("createMessagePipe", CreateMessagePipe)
« no previous file with comments | « mojo/edk/embedder/entrypoints.cc ('k') | mojo/edk/system/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698