| OLD | NEW |
| 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 #ifndef MOJO_SERVICES_JS_MODULES_GL_CONTEXT_H_ | 5 #ifndef SERVICES_JS_MODULES_GL_CONTEXT_H_ |
| 6 #define MOJO_SERVICES_JS_MODULES_GL_CONTEXT_H_ | 6 #define SERVICES_JS_MODULES_GL_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <GLES2/gl2.h> | 8 #include <GLES2/gl2.h> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "gin/handle.h" | 11 #include "gin/handle.h" |
| 12 #include "gin/public/wrapper_info.h" | 12 #include "gin/public/wrapper_info.h" |
| 13 #include "gin/runner.h" | 13 #include "gin/runner.h" |
| 14 #include "gin/wrappable.h" | 14 #include "gin/wrappable.h" |
| 15 #include "mojo/edk/js/handle.h" | 15 #include "mojo/edk/js/handle.h" |
| 16 #include "mojo/public/c/gles2/gles2.h" | 16 #include "mojo/public/c/gles2/gles2.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 44 static GLint GetAttribLocation(GLuint program, const std::string& name); | 44 static GLint GetAttribLocation(GLuint program, const std::string& name); |
| 45 static std::string GetProgramInfoLog(GLuint program); | 45 static std::string GetProgramInfoLog(GLuint program); |
| 46 static std::string GetShaderInfoLog(GLuint shader); | 46 static std::string GetShaderInfoLog(GLuint shader); |
| 47 static GLint GetUniformLocation(GLuint program, const std::string& name); | 47 static GLint GetUniformLocation(GLuint program, const std::string& name); |
| 48 static void ShaderSource(GLuint shader, const std::string& source); | 48 static void ShaderSource(GLuint shader, const std::string& source); |
| 49 static void UniformMatrix4fv(GLint location, GLboolean transpose, | 49 static void UniformMatrix4fv(GLint location, GLboolean transpose, |
| 50 const gin::ArrayBufferView& buffer); | 50 const gin::ArrayBufferView& buffer); |
| 51 static void VertexAttribPointer(GLuint index, GLint size, GLenum type, | 51 static void VertexAttribPointer(GLuint index, GLint size, GLenum type, |
| 52 GLboolean normalized, GLsizei stride, | 52 GLboolean normalized, GLsizei stride, |
| 53 uint64_t offset); | 53 uint64_t offset); |
| 54 void Resize(GLuint width, GLuint height, GLfloat scale_factor); |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | 57 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
| 57 v8::Isolate* isolate) override; | 58 v8::Isolate* isolate) override; |
| 58 | 59 |
| 59 explicit Context(v8::Isolate* isolate, | 60 explicit Context(v8::Isolate* isolate, |
| 60 mojo::Handle handle, | 61 mojo::Handle handle, |
| 61 v8::Handle<v8::Function> context_lost_callback); | 62 v8::Handle<v8::Function> context_lost_callback); |
| 62 ~Context() override; | 63 ~Context() override; |
| 63 | 64 |
| 64 void ContextLost(); | 65 void ContextLost(); |
| 65 static void ContextLostThunk(void* closure); | 66 static void ContextLostThunk(void* closure); |
| 66 | 67 |
| 67 base::WeakPtr<gin::Runner> runner_; | 68 base::WeakPtr<gin::Runner> runner_; |
| 68 v8::Persistent<v8::Function> context_lost_callback_; | 69 v8::Persistent<v8::Function> context_lost_callback_; |
| 69 MojoGLES2Context context_; | 70 MojoGLES2Context context_; |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 } // namespace gl | 73 } // namespace gl |
| 73 } // namespace js | 74 } // namespace js |
| 74 | 75 |
| 75 #endif // MOJO_SERVICES_JS_MODULES_GL_CONTEXT_H_ | 76 #endif // SERVICES_JS_MODULES_GL_CONTEXT_H_ |
| OLD | NEW |