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 "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" | 5 #include "webkit/gpu/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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 last_error_ = SUCCESS; | 306 last_error_ = SUCCESS; |
307 return old_error; | 307 return old_error; |
308 } else { | 308 } else { |
309 // All command buffer errors are unrecoverable. The error is treated as a | 309 // All command buffer errors are unrecoverable. The error is treated as a |
310 // lost context: destroy the context and create another one. | 310 // lost context: destroy the context and create another one. |
311 return CONTEXT_LOST; | 311 return CONTEXT_LOST; |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 bool GLInProcessContext::IsCommandBufferContextLost() { | 315 bool GLInProcessContext::IsCommandBufferContextLost() { |
| 316 if (!command_buffer_.get()) { |
| 317 return true; |
| 318 } |
316 CommandBuffer::State state = command_buffer_->GetState(); | 319 CommandBuffer::State state = command_buffer_->GetState(); |
317 return state.error == ::gpu::error::kLostContext; | 320 return state.error == ::gpu::error::kLostContext; |
318 } | 321 } |
319 | 322 |
320 CommandBufferService* GLInProcessContext::GetCommandBufferService() { | 323 CommandBufferService* GLInProcessContext::GetCommandBufferService() { |
321 return command_buffer_.get(); | 324 return command_buffer_.get(); |
322 } | 325 } |
323 | 326 |
324 // TODO(gman): Remove This | 327 // TODO(gman): Remove This |
325 void GLInProcessContext::DisableShaderTranslation() { | 328 void GLInProcessContext::DisableShaderTranslation() { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 gles2_implementation_->Flush(); | 506 gles2_implementation_->Flush(); |
504 | 507 |
505 gles2_implementation_.reset(); | 508 gles2_implementation_.reset(); |
506 } | 509 } |
507 | 510 |
508 transfer_buffer_.reset(); | 511 transfer_buffer_.reset(); |
509 gles2_helper_.reset(); | 512 gles2_helper_.reset(); |
510 command_buffer_.reset(); | 513 command_buffer_.reset(); |
511 | 514 |
512 if (decoder_.get()) { | 515 if (decoder_.get()) { |
513 decoder_->Destroy(context_lost); | 516 decoder_->Destroy(!context_lost); |
514 } | 517 } |
515 } | 518 } |
516 | 519 |
517 void GLInProcessContext::OnContextLost() { | 520 void GLInProcessContext::OnContextLost() { |
518 if (!context_lost_callback_.is_null()) | 521 if (!context_lost_callback_.is_null()) |
519 context_lost_callback_.Run(); | 522 context_lost_callback_.Run(); |
520 } | 523 } |
521 | 524 |
522 WebGraphicsContext3DInProcessCommandBufferImpl:: | 525 WebGraphicsContext3DInProcessCommandBufferImpl:: |
523 WebGraphicsContext3DInProcessCommandBufferImpl() | 526 WebGraphicsContext3DInProcessCommandBufferImpl() |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { | 1620 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { |
1618 // TODO(kbr): improve the precision here. | 1621 // TODO(kbr): improve the precision here. |
1619 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; | 1622 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; |
1620 if (context_lost_callback_) { | 1623 if (context_lost_callback_) { |
1621 context_lost_callback_->onContextLost(); | 1624 context_lost_callback_->onContextLost(); |
1622 } | 1625 } |
1623 } | 1626 } |
1624 | 1627 |
1625 } // namespace gpu | 1628 } // namespace gpu |
1626 } // namespace webkit | 1629 } // namespace webkit |
OLD | NEW |