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 #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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 | 164 |
165 Context::~Context() { | 165 Context::~Context() { |
166 MojoGLES2DestroyContext(context_); | 166 MojoGLES2DestroyContext(context_); |
167 } | 167 } |
168 | 168 |
169 void Context::ContextLost() { | 169 void Context::ContextLost() { |
170 if (!runner_) | 170 if (!runner_) |
171 return; | 171 return; |
172 gin::Runner::Scope scope(runner_.get()); | 172 gin::Runner::Scope scope(runner_.get()); |
173 v8::Isolate* isolate = runner_->isolate(); | 173 v8::Isolate* isolate = runner_->GetContextHolder()->isolate(); |
174 | 174 |
175 v8::Handle<v8::Function> callback = v8::Local<v8::Function>::New( | 175 v8::Handle<v8::Function> callback = v8::Local<v8::Function>::New( |
176 isolate, context_lost_callback_); | 176 isolate, context_lost_callback_); |
177 | 177 |
178 runner_->Call(callback, runner_->global(), 0, NULL); | 178 runner_->Call(callback, runner_->global(), 0, NULL); |
179 } | 179 } |
180 | 180 |
181 void Context::ContextLostThunk(void* closure) { | 181 void Context::ContextLostThunk(void* closure) { |
182 static_cast<Context*>(closure)->ContextLost(); | 182 static_cast<Context*>(closure)->ContextLost(); |
183 } | 183 } |
184 | 184 |
185 } // namespace gl | 185 } // namespace gl |
186 } // namespace js | 186 } // namespace js |
187 } // namespace mojo | 187 } // namespace mojo |
OLD | NEW |