summaryrefslogtreecommitdiffstats
path: root/gin/converter.h
diff options
context:
space:
mode:
authorabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-24 19:10:11 +0000
committerabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-24 19:10:11 +0000
commitec95fdfdde2c5c0ca1b953143dd6f4a9144025fa (patch)
tree112b98f4ca12105ce9c32376d9268bc03af6e723 /gin/converter.h
parent8b4e19b1b01a00c12d62a778a92981ef18d10073 (diff)
downloadchromium_src-ec95fdfdde2c5c0ca1b953143dd6f4a9144025fa.zip
chromium_src-ec95fdfdde2c5c0ca1b953143dd6f4a9144025fa.tar.gz
chromium_src-ec95fdfdde2c5c0ca1b953143dd6f4a9144025fa.tar.bz2
[Mojo] Improve JavaScript API for MojoReadMessage
Originally, I tried to make the JavaScript bindings for the core Mojo APIs a literal translation of the C APIs, but that makes MojoReadMessage a bit awkward because C needs to worry much more about buffer allocation than JavaScript. In building towards using the hello_world_service, I found that it was much easier to push the MojoReadMessage pattern from connector.cc into C++ and make the JavaScript API a bit more idiomatic by just returning an ArrayBuffer for the message and an Array of handles. BUG=317398 Review URL: https://codereview.chromium.org/83143002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236999 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gin/converter.h')
-rw-r--r--gin/converter.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/gin/converter.h b/gin/converter.h
index 33af452..2279319 100644
--- a/gin/converter.h
+++ b/gin/converter.h
@@ -88,6 +88,14 @@ struct Converter<v8::Handle<v8::Object> > {
};
template<>
+struct Converter<v8::Handle<v8::ArrayBuffer> > {
+ static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
+ v8::Handle<v8::ArrayBuffer> val);
+ static bool FromV8(v8::Handle<v8::Value> val,
+ v8::Handle<v8::ArrayBuffer>* out);
+};
+
+template<>
struct Converter<v8::Handle<v8::External> > {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
v8::Handle<v8::External> val);