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

Unified Diff: mojo/apps/js/bindings/gl/opaque.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/opaque.cc
diff --git a/mojo/apps/js/bindings/gl/opaque.cc b/mojo/apps/js/bindings/gl/opaque.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3294db2cf2b2758d47ff4ce4f0985842e499560e
--- /dev/null
+++ b/mojo/apps/js/bindings/gl/opaque.cc
@@ -0,0 +1,37 @@
+// 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/opaque.h"
+
+#include "gin/object_template_builder.h"
+#include "gin/per_isolate_data.h"
+
+namespace mojo {
+namespace js {
+namespace gl {
+
+gin::WrapperInfo Opaque::kWrapperInfo = { gin::kEmbedderNativeGin };
+
+gin::Handle<Opaque> Opaque::Create(v8::Isolate* isolate, GLuint value) {
+ return CreateHandle(isolate, new Opaque(value));
+}
+
+v8::Handle<v8::ObjectTemplate> Opaque::GetObjectTemplate(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)
+ .Build();
+ templ->SetInternalFieldCount(gin::kNumberOfInternalFields);
+ data->SetObjectTemplate(&kWrapperInfo, templ);
+ }
+ return templ;
+}
abarth-chromium 2013/12/11 06:24:22 This boilerplate does seem ripe for factoring out.
+
+Opaque::Opaque(GLuint value) : value_(value) {
+}
+
+} // namespace gl
+} // namespace js
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698