From 13c977e698996af379fad9a1b5015c6783d3465c Mon Sep 17 00:00:00 2001 From: "aa@chromium.org" Date: Thu, 19 Dec 2013 00:52:44 +0000 Subject: Add support for wrapping classes indirectly inherited from gin::Wrappable This is needed for: https://codereview.chromium.org/116163008/ Review URL: https://codereview.chromium.org/118423004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241730 0039d316-1c4b-4281-b951-d872f2087c98 --- mojo/apps/js/bindings/gl/context.cc | 19 +++++++++---------- mojo/apps/js/bindings/gl/context.h | 5 +++-- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'mojo/apps') diff --git a/mojo/apps/js/bindings/gl/context.cc b/mojo/apps/js/bindings/gl/context.cc index efba8e5..c0bb74a 100644 --- a/mojo/apps/js/bindings/gl/context.cc +++ b/mojo/apps/js/bindings/gl/context.cc @@ -21,16 +21,6 @@ gin::Handle Context::Create(v8::Isolate* isolate, uint64_t encoded, return gin::CreateHandle(isolate, new Context(encoded, width, height)); } -v8::Local Context::GetObjectTemplate( - v8::Isolate* isolate) { - return gin::ObjectTemplateBuilder(isolate) - .SetValue("VERTEX_SHADER", GL_VERTEX_SHADER) - .SetMethod("createShader", CreateShader) - .SetMethod("shaderSource", ShaderSource) - .SetMethod("compileShader", CompileShader) - .Build(); -} - gin::Handle Context::CreateShader(const gin::Arguments& args, GLenum type) { gin::Handle result; @@ -60,6 +50,15 @@ void Context::CompileShader(const gin::Arguments& args, } } +gin::ObjectTemplateBuilder Context::GetObjectTemplateBuilder( + v8::Isolate* isolate) { + return gin::Wrappable::GetObjectTemplateBuilder(isolate) + .SetValue("VERTEX_SHADER", GL_VERTEX_SHADER) + .SetMethod("createShader", CreateShader) + .SetMethod("shaderSource", ShaderSource) + .SetMethod("compileShader", CompileShader); +} + Context::Context(uint64_t encoded, int width, int height) : encoded_(encoded) { // TODO(aa): When we want to support multiple contexts, we should add diff --git a/mojo/apps/js/bindings/gl/context.h b/mojo/apps/js/bindings/gl/context.h index 11f1753..a5a3ca1 100644 --- a/mojo/apps/js/bindings/gl/context.h +++ b/mojo/apps/js/bindings/gl/context.h @@ -28,8 +28,6 @@ class Context : public gin::Wrappable { public: static gin::WrapperInfo kWrapperInfo; - static v8::Local GetObjectTemplate(v8::Isolate* isolate); - static gin::Handle Create(v8::Isolate* isolate, uint64_t encoded, int width, int height); static gin::Handle CreateShader(const gin::Arguments& arguments, @@ -40,6 +38,9 @@ class Context : public gin::Wrappable { gin::Handle shader); private: + virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( + v8::Isolate* isolate) OVERRIDE; + Context(uint64_t encoded, int width, int height); uint64_t encoded_; -- cgit v1.1