| 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/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 5 #include "webkit/common/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 |
| 11 #include <GLES2/gl2ext.h> | 11 #include <GLES2/gl2ext.h> |
| 12 #include <GLES2/gl2extchromium.h> | 12 #include <GLES2/gl2extchromium.h> |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "base/atomicops.h" | 16 #include "base/atomicops.h" |
| 17 #include "base/bind.h" | 17 #include "base/bind.h" |
| 18 #include "base/bind_helpers.h" | 18 #include "base/bind_helpers.h" |
| 19 #include "base/callback.h" | 19 #include "base/callback.h" |
| 20 #include "base/lazy_instance.h" | 20 #include "base/lazy_instance.h" |
| 21 #include "base/logging.h" | 21 #include "base/logging.h" |
| 22 #include "gpu/command_buffer/client/gles2_implementation.h" | 22 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 23 #include "gpu/command_buffer/client/gles2_lib.h" | 23 #include "gpu/command_buffer/client/gles2_lib.h" |
| 24 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 24 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 25 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" | 25 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" |
| 26 #include "ui/gfx/size.h" | 26 #include "ui/gfx/size.h" |
| 27 #include "ui/gl/gl_implementation.h" | |
| 28 | 27 |
| 29 using gpu::gles2::GLES2Implementation; | 28 using gpu::gles2::GLES2Implementation; |
| 30 using gpu::GLInProcessContext; | 29 using gpu::GLInProcessContext; |
| 31 | 30 |
| 32 namespace webkit { | 31 namespace webkit { |
| 33 namespace gpu { | 32 namespace gpu { |
| 34 | 33 |
| 35 namespace { | 34 namespace { |
| 36 | 35 |
| 37 // Singleton used to initialize and terminate the gles2 library. | 36 // Singleton used to initialize and terminate the gles2 library. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 53 LAZY_INSTANCE_INITIALIZER; | 52 LAZY_INSTANCE_INITIALIZER; |
| 54 | 53 |
| 55 } // namespace anonymous | 54 } // namespace anonymous |
| 56 | 55 |
| 57 // static | 56 // static |
| 58 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 57 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
| 59 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( | 58 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( |
| 60 const blink::WebGraphicsContext3D::Attributes& attributes, | 59 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 61 bool lose_context_when_out_of_memory, | 60 bool lose_context_when_out_of_memory, |
| 62 gfx::AcceleratedWidget window) { | 61 gfx::AcceleratedWidget window) { |
| 63 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone); | |
| 64 bool is_offscreen = false; | 62 bool is_offscreen = false; |
| 65 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( | 63 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( |
| 66 scoped_ptr< ::gpu::GLInProcessContext>(), | 64 scoped_ptr< ::gpu::GLInProcessContext>(), |
| 67 attributes, | 65 attributes, |
| 68 lose_context_when_out_of_memory, | 66 lose_context_when_out_of_memory, |
| 69 is_offscreen, | 67 is_offscreen, |
| 70 window)); | 68 window)); |
| 71 } | 69 } |
| 72 | 70 |
| 73 // static | 71 // static |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { | 188 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { |
| 191 // TODO(kbr): improve the precision here. | 189 // TODO(kbr): improve the precision here. |
| 192 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; | 190 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; |
| 193 if (context_lost_callback_) { | 191 if (context_lost_callback_) { |
| 194 context_lost_callback_->onContextLost(); | 192 context_lost_callback_->onContextLost(); |
| 195 } | 193 } |
| 196 } | 194 } |
| 197 | 195 |
| 198 } // namespace gpu | 196 } // namespace gpu |
| 199 } // namespace webkit | 197 } // namespace webkit |
| OLD | NEW |