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

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

Issue 214183003: Change mojo JS bindings to expose a handle object, which is Closed when garbage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm.extra.gc Created 6 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
« mojo/bindings/js/core.cc ('K') | « mojo/bindings/js/handle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« mojo/bindings/js/core.cc ('K') | « mojo/bindings/js/handle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698