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

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

Issue 59153005: Begin implementing V8 bindings for Mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moar copyright Created 7 years, 1 month 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/public/bindings/js/mojo.cc
diff --git a/mojo/public/bindings/js/mojo.cc b/mojo/public/bindings/js/mojo.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7bf21979de5c0aabcb0a769cc9f428abe1bb3753
--- /dev/null
+++ b/mojo/public/bindings/js/mojo.cc
@@ -0,0 +1,33 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/public/bindings/js/mojo.h"
+
+#include "gin/converter.h"
+#include "gin/per_isolate_data.h"
+#include "gin/wrapper_info.h"
+#include "mojo/public/bindings/js/core.h"
+
+namespace mojo {
+namespace js {
+
+namespace {
+
+gin::WrapperInfo g_mojo_wrapper_info = {};
+
+}
+
+v8::Local<v8::ObjectTemplate> MojoTemplate(v8::Isolate* isolate) {
+ gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
+ v8::Local<v8::ObjectTemplate> templ;
+ if (!data->GetObjectTemplate(&g_mojo_wrapper_info, &templ)) {
+ templ = v8::ObjectTemplate::New();
+ templ->Set(gin::StringToV8(isolate, "core"), CoreTemplate(isolate));
Aaron Boodman 2013/11/11 19:01:08 Do you want to use symbols for these static string
abarth-chromium 2013/11/11 20:17:42 Yes. I'll add a gin::StringToSymbol function.
+ data->RegisterObjectTemplate(&g_mojo_wrapper_info, templ);
+ }
+ return templ;
+}
+
+} // namespace js
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698