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 #include <utility> | 8 #include <utility> |
9 #ifndef GL_GLEXT_PROTOTYPES | 9 #ifndef GL_GLEXT_PROTOTYPES |
10 #define GL_GLEXT_PROTOTYPES 1 | 10 #define GL_GLEXT_PROTOTYPES 1 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 base::Closure context_lost_callback = base::Bind( | 129 base::Closure context_lost_callback = base::Bind( |
130 &WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost, | 130 &WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost, |
131 base::Unretained(this)); | 131 base::Unretained(this)); |
132 context_->SetContextLostCallback(context_lost_callback); | 132 context_->SetContextLostCallback(context_lost_callback); |
133 } else { | 133 } else { |
134 initialize_failed_ = true; | 134 initialize_failed_ = true; |
135 return false; | 135 return false; |
136 } | 136 } |
137 | 137 |
138 real_gl_ = context_->GetImplementation(); | 138 real_gl_ = context_->GetImplementation(); |
139 setGLInterface(real_gl_); | 139 SetGLInterface(real_gl_); |
140 | 140 |
141 real_gl_->TraceBeginCHROMIUM("WebGraphicsContext3D", | 141 real_gl_->TraceBeginCHROMIUM("WebGraphicsContext3D", |
142 "InProcessContext"); | 142 "InProcessContext"); |
143 | 143 |
144 initialized_ = true; | 144 initialized_ = true; |
145 return true; | 145 return true; |
146 } | 146 } |
147 | 147 |
148 bool | 148 bool |
149 WebGraphicsContext3DInProcessCommandBufferImpl::InitializeOnCurrentThread() { | 149 WebGraphicsContext3DInProcessCommandBufferImpl::InitializeOnCurrentThread() { |
150 if (!MaybeInitializeGL()) | 150 if (!MaybeInitializeGL()) |
151 return false; | 151 return false; |
152 return context_ && !isContextLost(); | 152 return context_ && |
| 153 context_->GetImplementation()->GetGraphicsResetStatusKHR() == |
| 154 GL_NO_ERROR; |
153 } | 155 } |
154 | 156 |
155 void WebGraphicsContext3DInProcessCommandBufferImpl::SetLock(base::Lock* lock) { | 157 void WebGraphicsContext3DInProcessCommandBufferImpl::SetLock(base::Lock* lock) { |
156 context_->SetLock(lock); | 158 context_->SetLock(lock); |
157 } | 159 } |
158 | 160 |
159 ::gpu::ContextSupport* | 161 ::gpu::ContextSupport* |
160 WebGraphicsContext3DInProcessCommandBufferImpl::GetContextSupport() { | 162 WebGraphicsContext3DInProcessCommandBufferImpl::GetContextSupport() { |
161 return real_gl_; | 163 return real_gl_; |
162 } | 164 } |
163 | 165 |
164 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { | 166 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { |
165 if (context_lost_callback_) { | 167 if (context_lost_callback_) { |
166 context_lost_callback_->onContextLost(); | 168 context_lost_callback_->onContextLost(); |
167 } | 169 } |
168 } | 170 } |
169 | 171 |
170 } // namespace gpu_blink | 172 } // namespace gpu_blink |
OLD | NEW |