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

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

Issue 120043008: Add a simple one shot and repeating timer API for Mojo.js. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win build 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/module.h ('k') | mojo/apps/js/bindings/support.h » ('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/module.h" 5 #include "mojo/apps/js/bindings/gl/module.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 13 matching lines...) Expand all
24 24
25 gin::WrapperInfo kWrapperInfo = { gin::kEmbedderNativeGin }; 25 gin::WrapperInfo kWrapperInfo = { gin::kEmbedderNativeGin };
26 26
27 gin::Handle<Context> CreateContext(const gin::Arguments& args, uint64_t encoded, 27 gin::Handle<Context> CreateContext(const gin::Arguments& args, uint64_t encoded,
28 int width, int height) { 28 int width, int height) {
29 return Context::Create(args.isolate(), encoded, width, height); 29 return Context::Create(args.isolate(), encoded, width, height);
30 } 30 }
31 31
32 } // namespace 32 } // namespace
33 33
34 v8::Local<v8::ObjectTemplate> GetModuleTemplate(v8::Isolate* isolate) { 34 v8::Local<v8::Value> GetModule(v8::Isolate* isolate) {
35 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); 35 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
36 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate(&kWrapperInfo); 36 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate(&kWrapperInfo);
37 37
38 if (templ.IsEmpty()) { 38 if (templ.IsEmpty()) {
39 templ = gin::ObjectTemplateBuilder(isolate) 39 templ = gin::ObjectTemplateBuilder(isolate)
40 .SetMethod("Context", CreateContext) 40 .SetMethod("Context", CreateContext)
41 .Build(); 41 .Build();
42 data->SetObjectTemplate(&kWrapperInfo, templ); 42 data->SetObjectTemplate(&kWrapperInfo, templ);
43 } 43 }
44 44
45 return templ; 45 return templ->NewInstance();
46 } 46 }
47 47
48 } // namespace gl 48 } // namespace gl
49 } // namespace js 49 } // namespace js
50 } // namespace mojo 50 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/apps/js/bindings/gl/module.h ('k') | mojo/apps/js/bindings/support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698