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

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

Issue 131153007: Send size to NativeViewportClient::OnCreated instead of GLES2Client::DidCreateContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, fix various issues Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « mojo/apps/js/bindings/gl/context.h ('k') | mojo/apps/js/main.js » ('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/context.h" 5 #include "mojo/apps/js/bindings/gl/context.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 8
9 #include "gin/arguments.h" 9 #include "gin/arguments.h"
10 #include "gin/array_buffer.h" 10 #include "gin/array_buffer.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 &DidCreateContextThunk, 159 &DidCreateContextThunk,
160 &ContextLostThunk, 160 &ContextLostThunk,
161 NULL, 161 NULL,
162 this); 162 this);
163 } 163 }
164 164
165 Context::~Context() { 165 Context::~Context() {
166 MojoGLES2DestroyContext(context_); 166 MojoGLES2DestroyContext(context_);
167 } 167 }
168 168
169 void Context::DidCreateContext(uint32_t width, uint32_t height) { 169 void Context::DidCreateContext() {
170 // TODO(aa): When we want to support multiple contexts, we should add 170 // TODO(aa): When we want to support multiple contexts, we should add
171 // Context::MakeCurrent() for developers to switch between them. 171 // Context::MakeCurrent() for developers to switch between them.
172 MojoGLES2MakeCurrent(context_); 172 MojoGLES2MakeCurrent(context_);
173 if (!runner_) 173 if (!runner_)
174 return; 174 return;
175 gin::Runner::Scope scope(runner_.get()); 175 gin::Runner::Scope scope(runner_.get());
176 v8::Isolate* isolate = runner_->isolate(); 176 v8::Isolate* isolate = runner_->isolate();
177 177
178 v8::Handle<v8::Function> callback = v8::Local<v8::Function>::New( 178 v8::Handle<v8::Function> callback = v8::Local<v8::Function>::New(
179 isolate, did_create_callback_); 179 isolate, did_create_callback_);
180 180
181 v8::Handle<v8::Value> args[] = { 181 runner_->Call(callback, runner_->global(), 0, NULL);
182 gin::ConvertToV8(isolate, width),
183 gin::ConvertToV8(isolate, height),
184 };
185 runner_->Call(callback, runner_->global(), 2, args);
186 } 182 }
187 183
188 void Context::DidCreateContextThunk( 184 void Context::DidCreateContextThunk(void* closure) {
189 void* closure, 185 static_cast<Context*>(closure)->DidCreateContext();
190 uint32_t width,
191 uint32_t height) {
192 static_cast<Context*>(closure)->DidCreateContext(width, height);
193 } 186 }
194 187
195 void Context::ContextLost() { 188 void Context::ContextLost() {
196 } 189 }
197 190
198 void Context::ContextLostThunk(void* closure) { 191 void Context::ContextLostThunk(void* closure) {
199 static_cast<Context*>(closure)->ContextLost(); 192 static_cast<Context*>(closure)->ContextLost();
200 } 193 }
201 194
202 } // namespace gl 195 } // namespace gl
203 } // namespace js 196 } // namespace js
204 } // namespace mojo 197 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/apps/js/bindings/gl/context.h ('k') | mojo/apps/js/main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698