| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" | 5 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #ifndef GL_GLEXT_PROTOTYPES | 8 #ifndef GL_GLEXT_PROTOTYPES |
| 9 #define GL_GLEXT_PROTOTYPES 1 | 9 #define GL_GLEXT_PROTOTYPES 1 |
| 10 #endif | 10 #endif |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 return true; | 146 return true; |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool | 149 bool |
| 150 WebGraphicsContext3DInProcessCommandBufferImpl::InitializeOnCurrentThread() { | 150 WebGraphicsContext3DInProcessCommandBufferImpl::InitializeOnCurrentThread() { |
| 151 if (!MaybeInitializeGL()) | 151 if (!MaybeInitializeGL()) |
| 152 return false; | 152 return false; |
| 153 return context_ && !isContextLost(); | 153 return context_ && !isContextLost(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void WebGraphicsContext3DInProcessCommandBufferImpl::SetLock(base::Lock* lock) { |
| 157 context_->SetLock(lock); |
| 158 } |
| 159 |
| 156 bool WebGraphicsContext3DInProcessCommandBufferImpl::isContextLost() { | 160 bool WebGraphicsContext3DInProcessCommandBufferImpl::isContextLost() { |
| 157 return context_lost_reason_ != GL_NO_ERROR; | 161 return context_lost_reason_ != GL_NO_ERROR; |
| 158 } | 162 } |
| 159 | 163 |
| 160 WGC3Denum WebGraphicsContext3DInProcessCommandBufferImpl:: | 164 WGC3Denum WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 161 getGraphicsResetStatusARB() { | 165 getGraphicsResetStatusARB() { |
| 162 return context_lost_reason_; | 166 return context_lost_reason_; |
| 163 } | 167 } |
| 164 | 168 |
| 165 ::gpu::ContextSupport* | 169 ::gpu::ContextSupport* |
| 166 WebGraphicsContext3DInProcessCommandBufferImpl::GetContextSupport() { | 170 WebGraphicsContext3DInProcessCommandBufferImpl::GetContextSupport() { |
| 167 return real_gl_; | 171 return real_gl_; |
| 168 } | 172 } |
| 169 | 173 |
| 170 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { | 174 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { |
| 171 // TODO(kbr): improve the precision here. | 175 // TODO(kbr): improve the precision here. |
| 172 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; | 176 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; |
| 173 if (context_lost_callback_) { | 177 if (context_lost_callback_) { |
| 174 context_lost_callback_->onContextLost(); | 178 context_lost_callback_->onContextLost(); |
| 175 } | 179 } |
| 176 } | 180 } |
| 177 | 181 |
| 178 } // namespace gpu_blink | 182 } // namespace gpu_blink |
| OLD | NEW |