diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-17 17:46:07 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-17 17:46:07 +0000 |
commit | 97f21cad04bb80834a8cc84bfc3dd24a96531a16 (patch) | |
tree | 4e49aa68b49f90e4e68c220cc9d9b04be95a6a5d /gin/converter.h | |
parent | 00509a3ac0c1c11e97852d2331d116df6754eb5d (diff) | |
download | chromium_src-97f21cad04bb80834a8cc84bfc3dd24a96531a16.zip chromium_src-97f21cad04bb80834a8cc84bfc3dd24a96531a16.tar.gz chromium_src-97f21cad04bb80834a8cc84bfc3dd24a96531a16.tar.bz2 |
This CL implements the Asynchronous Module Definition (AMD)
API, which we plan to use for JavaScript in Mojo. We don't
yet implement every feature in the AMD spec
<https://github.com/amdjs/amdjs-api/wiki/AMD>, but we
implement the basic framework, which will let us get started
writing and testing JavaScript modules in Mojo.
The two other leading choices for a modules system are
CommonJS and ES6 modules. We decided not to use CommonJS,
despite its popularity, because it implies the ability to
load modules synchronously. That works well in server
environments like node.js, but it won't work well for Mojo
where modules might be loaded across a network.
I would really like to have used ES6 modules, but the spec
isn't finalized yet and V8 doesn't yet implement them. It's
likely that we'll replace this AMD module system with ES6
modules once ES6 modules are ready.
Structurally, I've implemented AMD in the ModuleRegistry
class in a new "modules" directory in Gin. Nothing else in
Gin (except the tests) depends on ModuleRegistry, which
means folks are free to use Gin without AMD. At the Mojo
layer, I've added a dependency on AMD.
BUG=317398
Review URL: https://codereview.chromium.org/62333018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235543 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gin/converter.h')
-rw-r--r-- | gin/converter.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gin/converter.h b/gin/converter.h index 551849b..33af452 100644 --- a/gin/converter.h +++ b/gin/converter.h @@ -87,6 +87,22 @@ struct Converter<v8::Handle<v8::Object> > { v8::Handle<v8::Object>* out); }; +template<> +struct Converter<v8::Handle<v8::External> > { + static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, + v8::Handle<v8::External> val); + static bool FromV8(v8::Handle<v8::Value> val, + v8::Handle<v8::External>* out); +}; + +template<> +struct Converter<v8::Handle<v8::Value> > { + static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, + v8::Handle<v8::Value> val); + static bool FromV8(v8::Handle<v8::Value> val, + v8::Handle<v8::Value>* out); +}; + template<typename T> struct Converter<std::vector<T> > { static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, |