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

Side by Side Diff: mojo/apps/js/bindings/gl/opaque.cc

Issue 113893005: [gin] Introduce Wrappable::GetObjectTemplate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/apps/js/bindings/gl/opaque.h ('k') | mojo/apps/js/bindings/support.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/apps/js/bindings/gl/opaque.h" 5 #include "mojo/apps/js/bindings/gl/opaque.h"
6 6
7 #include "gin/object_template_builder.h" 7 #include "gin/object_template_builder.h"
8 #include "gin/per_isolate_data.h"
9 8
10 namespace mojo { 9 namespace mojo {
11 namespace js { 10 namespace js {
12 namespace gl { 11 namespace gl {
13 12
14 gin::WrapperInfo Opaque::kWrapperInfo = { gin::kEmbedderNativeGin }; 13 gin::WrapperInfo Opaque::kWrapperInfo = { gin::kEmbedderNativeGin };
15 14
16 gin::Handle<Opaque> Opaque::Create(v8::Isolate* isolate, GLuint value) { 15 gin::Handle<Opaque> Opaque::Create(v8::Isolate* isolate, GLuint value) {
17 return gin::CreateHandle(isolate, new Opaque(value)); 16 return gin::CreateHandle(isolate, new Opaque(value));
18 } 17 }
19 18
20 v8::Handle<v8::ObjectTemplate> Opaque::GetObjectTemplate(v8::Isolate* isolate) {
21 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
22 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate(&kWrapperInfo);
23 if (templ.IsEmpty()) {
24 templ = gin::ObjectTemplateBuilder(isolate)
25 .Build();
26 templ->SetInternalFieldCount(gin::kNumberOfInternalFields);
27 data->SetObjectTemplate(&kWrapperInfo, templ);
28 }
29 return templ;
30 }
31
32 Opaque::Opaque(GLuint value) : value_(value) { 19 Opaque::Opaque(GLuint value) : value_(value) {
33 } 20 }
34 21
35 } // namespace gl 22 } // namespace gl
36 } // namespace js 23 } // namespace js
37 } // namespace mojo 24 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/apps/js/bindings/gl/opaque.h ('k') | mojo/apps/js/bindings/support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698