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

Unified Diff: mojo/apps/js/bindings/gl/module.cc

Issue 111083005: Beginning of JS Mojo API to GL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 7 years 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/apps/js/bindings/gl/module.cc
diff --git a/mojo/apps/js/bindings/gl/module.cc b/mojo/apps/js/bindings/gl/module.cc
new file mode 100644
index 0000000000000000000000000000000000000000..83245d18cdbe08093df314a75114423bafa43a60
--- /dev/null
+++ b/mojo/apps/js/bindings/gl/module.cc
@@ -0,0 +1,54 @@
+// 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/apps/js/bindings/gl/module.h"
+
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include "base/logging.h"
+#include "gin/arguments.h"
+#include "gin/object_template_builder.h"
+#include "gin/per_isolate_data.h"
+#include "gin/wrappable.h"
+#include "mojo/apps/js/bindings/gl/context.h"
+
+namespace mojo {
+namespace js {
+namespace gl {
+
+const char* kModuleName = "mojo/apps/js/bindings/gljs";
abarth-chromium 2013/12/11 06:24:22 mojo/apps/js/bindings/gljs -> mojo/apps/js/bindi
Aaron Boodman 2013/12/12 19:30:30 Whoops, I initially had named all the code 'gljs',
+
+namespace {
+
+gin::WrapperInfo kWrapperInfo = { gin::kEmbedderNativeGin };
+
+gin::Handle<Context> CreateContext(const gin::Arguments& args, uint64_t encoded,
+ int width, int height) {
+ return Context::Create(args.isolate(), encoded, width, height);
+}
+
+} // namespace
+
+v8::Local<v8::ObjectTemplate> GetModuleTemplate(v8::Isolate* isolate) {
+ gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
+ v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate(&kWrapperInfo);
+
+ if (templ.IsEmpty()) {
+ templ = gin::ObjectTemplateBuilder(isolate)
+ .SetMethod("Context", CreateContext)
+ .Build();
+ templ->SetInternalFieldCount(gin::kNumberOfInternalFields);
+ data->SetObjectTemplate(&kWrapperInfo, templ);
+ }
+
+ Context::GetObjectTemplate(isolate);
+ Opaque::GetObjectTemplate(isolate);
+
+ return templ;
+}
+
+} // namespace gl
+} // namespace js
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698