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

Unified Diff: mojo/bindings/js/handle.cc

Issue 686203004: Mojo JS Bindings: Simplify sharing services for content-provided JS applications (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 2 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
Index: mojo/bindings/js/handle.cc
diff --git a/mojo/bindings/js/handle.cc b/mojo/bindings/js/handle.cc
index 37384d6cbcb5222bece45ebf045ad3e312b54655..af2b4c28b0bda56d91308778e34bba89da4e90e1 100644
--- a/mojo/bindings/js/handle.cc
+++ b/mojo/bindings/js/handle.cc
@@ -86,4 +86,29 @@ bool Converter<mojo::Handle>::FromV8(v8::Isolate* isolate,
return true;
}
+v8::Handle<v8::Value> Converter<mojo::MessagePipeHandle>::ToV8(
Aaron Boodman 2014/10/29 23:06:29 You can just delegate to the converter for mojo::H
hansmuller 2014/10/30 00:23:38 Good point!
+ v8::Isolate* isolate, mojo::MessagePipeHandle val) {
+ if (!val.is_valid())
+ return v8::Null(isolate);
+ return mojo::js::HandleWrapper::Create(isolate, val.value()).ToV8();
+}
+
+bool Converter<mojo::MessagePipeHandle>::FromV8(v8::Isolate* isolate,
+ v8::Handle<v8::Value> val,
+ mojo::MessagePipeHandle* out) {
+ if (val->IsNull()) {
+ *out = mojo::MessagePipeHandle();
+ return true;
+ }
+
+ gin::Handle<mojo::js::HandleWrapper> handle;
+ if (!Converter<gin::Handle<mojo::js::HandleWrapper> >::FromV8(
+ isolate, val, &handle))
+ return false;
+
+ *out = mojo::MessagePipeHandle(handle->get().value());
+ return true;
+}
+
+
} // namespace gin

Powered by Google App Engine
This is Rietveld 408576698