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

Side by Side Diff: services/js/modules/gl/context.cc

Issue 1258733003: Expose glResizeCHROMIUM() and remove some uses of MojoGLES2GetGLES2Interface(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: review comments Created 5 years, 4 months 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
« no previous file with comments | « services/js/modules/gl/BUILD.gn ('k') | shell/native_application_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 #ifndef GL_GLEXT_PROTOTYPES
6 #define GL_GLEXT_PROTOTYPES
7 #endif
8
5 #include "services/js/modules/gl/context.h" 9 #include "services/js/modules/gl/context.h"
6 10
7 #include <GLES2/gl2.h> 11 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 12 #include <GLES2/gl2ext.h>
13 #include <GLES2/gl2extchromium.h>
9 14
10 #include "base/bind.h" 15 #include "base/bind.h"
11 #include "gin/arguments.h" 16 #include "gin/arguments.h"
12 #include "gin/array_buffer.h" 17 #include "gin/array_buffer.h"
13 #include "gin/object_template_builder.h" 18 #include "gin/object_template_builder.h"
14 #include "gin/per_context_data.h" 19 #include "gin/per_context_data.h"
15 #include "gpu/command_buffer/client/gles2_interface.h"
16 #include "mojo/public/c/gles2/gles2.h" 20 #include "mojo/public/c/gles2/gles2.h"
17 #include "mojo/public/cpp/environment/environment.h" 21 #include "mojo/public/cpp/environment/environment.h"
18 #include "mojo/public/cpp/environment/logging.h" 22 #include "mojo/public/cpp/environment/logging.h"
19 23
20 namespace gin { 24 namespace gin {
21 template<> 25 template<>
22 struct Converter<GLboolean> { 26 struct Converter<GLboolean> {
23 static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val, 27 static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
24 GLboolean* out) { 28 GLboolean* out) {
25 bool bool_val = false; 29 bool bool_val = false;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 this, 182 this,
179 mojo::Environment::GetDefaultAsyncWaiter()); 183 mojo::Environment::GetDefaultAsyncWaiter());
180 MojoGLES2MakeCurrent(context_); 184 MojoGLES2MakeCurrent(context_);
181 } 185 }
182 186
183 Context::~Context() { 187 Context::~Context() {
184 MojoGLES2DestroyContext(context_); 188 MojoGLES2DestroyContext(context_);
185 } 189 }
186 190
187 void Context::Resize(GLuint width, GLuint height, GLfloat scale_factor) { 191 void Context::Resize(GLuint width, GLuint height, GLfloat scale_factor) {
188 static_cast<gpu::gles2::GLES2Interface*>( 192 glResizeCHROMIUM(width, height, scale_factor);
189 MojoGLES2GetGLES2Interface(context_))->ResizeCHROMIUM(width,
190 height,
191 scale_factor);
192 } 193 }
193 194
194 void Context::ContextLost() { 195 void Context::ContextLost() {
195 if (!runner_) 196 if (!runner_)
196 return; 197 return;
197 gin::Runner::Scope scope(runner_.get()); 198 gin::Runner::Scope scope(runner_.get());
198 v8::Isolate* isolate = runner_->GetContextHolder()->isolate(); 199 v8::Isolate* isolate = runner_->GetContextHolder()->isolate();
199 200
200 v8::Handle<v8::Function> callback = v8::Local<v8::Function>::New( 201 v8::Handle<v8::Function> callback = v8::Local<v8::Function>::New(
201 isolate, context_lost_callback_); 202 isolate, context_lost_callback_);
202 203
203 runner_->Call(callback, runner_->global(), 0, NULL); 204 runner_->Call(callback, runner_->global(), 0, NULL);
204 } 205 }
205 206
206 void Context::ContextLostThunk(void* closure) { 207 void Context::ContextLostThunk(void* closure) {
207 static_cast<Context*>(closure)->ContextLost(); 208 static_cast<Context*>(closure)->ContextLost();
208 } 209 }
209 210
210 } // namespace gl 211 } // namespace gl
211 } // namespace js 212 } // namespace js
OLDNEW
« no previous file with comments | « services/js/modules/gl/BUILD.gn ('k') | shell/native_application_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698