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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 417 |
418 context_ = gfx::GLContext::CreateGLContext(share_group.get(), | 418 context_ = gfx::GLContext::CreateGLContext(share_group.get(), |
419 surface_.get(), | 419 surface_.get(), |
420 gpu_preference); | 420 gpu_preference); |
421 if (!context_.get()) { | 421 if (!context_.get()) { |
422 LOG(ERROR) << "Could not create GLContext."; | 422 LOG(ERROR) << "Could not create GLContext."; |
423 Destroy(); | 423 Destroy(); |
424 return false; | 424 return false; |
425 } | 425 } |
426 | 426 |
| 427 if (!context_->MakeCurrent(surface_.get())) { |
| 428 LOG(ERROR) << "Could not make context current."; |
| 429 Destroy(); |
| 430 return false; |
| 431 } |
| 432 |
427 ::gpu::gles2::DisallowedFeatures disallowed_features; | 433 ::gpu::gles2::DisallowedFeatures disallowed_features; |
428 disallowed_features.swap_buffer_complete_callback = true; | 434 disallowed_features.swap_buffer_complete_callback = true; |
429 if (!decoder_->Initialize(surface_.get(), | 435 if (!decoder_->Initialize(surface_, |
430 context_.get(), | 436 context_, |
431 true, | 437 true, |
432 size, | 438 size, |
433 disallowed_features, | 439 disallowed_features, |
434 allowed_extensions, | 440 allowed_extensions, |
435 attribs)) { | 441 attribs)) { |
436 LOG(ERROR) << "Could not initialize decoder."; | 442 LOG(ERROR) << "Could not initialize decoder."; |
437 Destroy(); | 443 Destroy(); |
438 return false; | 444 return false; |
439 } | 445 } |
440 | 446 |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { | 1611 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { |
1606 // TODO(kbr): improve the precision here. | 1612 // TODO(kbr): improve the precision here. |
1607 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; | 1613 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; |
1608 if (context_lost_callback_) { | 1614 if (context_lost_callback_) { |
1609 context_lost_callback_->onContextLost(); | 1615 context_lost_callback_->onContextLost(); |
1610 } | 1616 } |
1611 } | 1617 } |
1612 | 1618 |
1613 } // namespace gpu | 1619 } // namespace gpu |
1614 } // namespace webkit | 1620 } // namespace webkit |
OLD | NEW |