Index: mojo/bindings/js/handle.cc |
diff --git a/mojo/bindings/js/handle.cc b/mojo/bindings/js/handle.cc |
index a6c229b0dcd0ef68c5167a1120592d41ec01cc6e..36a49886db4b39693d26fa66b9298b254007a77d 100644 |
--- a/mojo/bindings/js/handle.cc |
+++ b/mojo/bindings/js/handle.cc |
@@ -6,15 +6,29 @@ |
namespace gin { |
+gin::WrapperInfo HandleWrapper::kWrapperInfo = { gin::kEmbedderNativeGin }; |
+ |
+HandleWrapper::HandleWrapper(MojoHandle handle) |
+ : handle_(mojo::Handle(handle)) { |
+} |
+ |
+HandleWrapper::~HandleWrapper() { |
+} |
+ |
v8::Handle<v8::Value> Converter<mojo::Handle>::ToV8(v8::Isolate* isolate, |
const mojo::Handle& val) { |
- return Converter<MojoHandle>::ToV8(isolate, val.value()); |
+ return HandleWrapper::Create(isolate, val.value()).ToV8(); |
} |
bool Converter<mojo::Handle>::FromV8(v8::Isolate* isolate, |
v8::Handle<v8::Value> val, |
mojo::Handle* out) { |
- return Converter<MojoHandle>::FromV8(isolate, val, out->mutable_value()); |
+ gin::Handle<HandleWrapper> handle; |
+ if (!Converter<gin::Handle<HandleWrapper> >::FromV8(isolate, val, &handle)) |
+ return false; |
+ |
+ *out = handle->get(); |
+ return true; |
} |
} // namespace gin |