| 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 #ifndef WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
| 6 #define WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | 6 #define WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 namespace webkit { | 46 namespace webkit { |
| 47 namespace gpu { | 47 namespace gpu { |
| 48 | 48 |
| 49 class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl | 49 class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl |
| 50 : public NON_EXPORTED_BASE(blink::WebGraphicsContext3D) { | 50 : public NON_EXPORTED_BASE(blink::WebGraphicsContext3D) { |
| 51 public: | 51 public: |
| 52 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 52 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
| 53 CreateViewContext( | 53 CreateViewContext( |
| 54 const blink::WebGraphicsContext3D::Attributes& attributes, | 54 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 55 bool lose_context_when_out_of_memory, | |
| 56 gfx::AcceleratedWidget window); | 55 gfx::AcceleratedWidget window); |
| 57 | 56 |
| 58 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 57 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
| 59 CreateOffscreenContext( | 58 CreateOffscreenContext( |
| 60 const blink::WebGraphicsContext3D::Attributes& attributes, | 59 const blink::WebGraphicsContext3D::Attributes& attributes); |
| 61 bool lose_context_when_out_of_memory); | |
| 62 | 60 |
| 63 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 61 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
| 64 WrapContext( | 62 WrapContext( |
| 65 scoped_ptr< ::gpu::GLInProcessContext> context, | 63 scoped_ptr< ::gpu::GLInProcessContext> context, |
| 66 const blink::WebGraphicsContext3D::Attributes& attributes); | 64 const blink::WebGraphicsContext3D::Attributes& attributes); |
| 67 | 65 |
| 68 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); | 66 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); |
| 69 | 67 |
| 70 // Convert WebGL context creation attributes into GLInProcessContext / EGL | 68 // Convert WebGL context creation attributes into GLInProcessContext / EGL |
| 71 // size requests. | 69 // size requests. |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 ::gpu::ContextSupport* GetContextSupport(); | 564 ::gpu::ContextSupport* GetContextSupport(); |
| 567 | 565 |
| 568 ::gpu::gles2::GLES2Implementation* GetImplementation() { | 566 ::gpu::gles2::GLES2Implementation* GetImplementation() { |
| 569 return gl_; | 567 return gl_; |
| 570 } | 568 } |
| 571 | 569 |
| 572 private: | 570 private: |
| 573 WebGraphicsContext3DInProcessCommandBufferImpl( | 571 WebGraphicsContext3DInProcessCommandBufferImpl( |
| 574 scoped_ptr< ::gpu::GLInProcessContext> context, | 572 scoped_ptr< ::gpu::GLInProcessContext> context, |
| 575 const blink::WebGraphicsContext3D::Attributes& attributes, | 573 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 576 bool lose_context_when_out_of_memory, | |
| 577 bool is_offscreen, | 574 bool is_offscreen, |
| 578 gfx::AcceleratedWidget window); | 575 gfx::AcceleratedWidget window); |
| 579 | 576 |
| 580 void OnContextLost(); | 577 void OnContextLost(); |
| 581 | 578 |
| 582 bool MaybeInitializeGL(); | 579 bool MaybeInitializeGL(); |
| 583 | 580 |
| 584 // Used to try to find bugs in code that calls gl directly through the gl api | 581 // Used to try to find bugs in code that calls gl directly through the gl api |
| 585 // instead of going through WebGraphicsContext3D. | 582 // instead of going through WebGraphicsContext3D. |
| 586 void ClearContext(); | 583 void ClearContext(); |
| 587 | 584 |
| 588 bool is_offscreen_; | 585 bool is_offscreen_; |
| 589 // Only used when not offscreen. | 586 // Only used when not offscreen. |
| 590 gfx::AcceleratedWidget window_; | 587 gfx::AcceleratedWidget window_; |
| 591 | 588 |
| 592 bool initialized_; | 589 bool initialized_; |
| 593 bool initialize_failed_; | 590 bool initialize_failed_; |
| 594 | 591 |
| 595 // The context we use for OpenGL rendering. | 592 // The context we use for OpenGL rendering. |
| 596 scoped_ptr< ::gpu::GLInProcessContext> context_; | 593 scoped_ptr< ::gpu::GLInProcessContext> context_; |
| 597 // The GLES2Implementation we use for OpenGL rendering. | 594 // The GLES2Implementation we use for OpenGL rendering. |
| 598 ::gpu::gles2::GLES2Implementation* gl_; | 595 ::gpu::gles2::GLES2Implementation* gl_; |
| 599 | 596 |
| 600 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; | 597 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; |
| 601 WGC3Denum context_lost_reason_; | 598 WGC3Denum context_lost_reason_; |
| 602 | 599 |
| 603 blink::WebGraphicsContext3D::Attributes attributes_; | 600 blink::WebGraphicsContext3D::Attributes attributes_; |
| 604 bool lose_context_when_out_of_memory_; | |
| 605 | 601 |
| 606 // Errors raised by synthesizeGLError(). | 602 // Errors raised by synthesizeGLError(). |
| 607 std::vector<WGC3Denum> synthetic_errors_; | 603 std::vector<WGC3Denum> synthetic_errors_; |
| 608 | 604 |
| 609 uint32_t flush_id_; | 605 uint32_t flush_id_; |
| 610 }; | 606 }; |
| 611 | 607 |
| 612 } // namespace gpu | 608 } // namespace gpu |
| 613 } // namespace webkit | 609 } // namespace webkit |
| 614 | 610 |
| 615 #endif // WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL
_H_ | 611 #endif // WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL
_H_ |
| OLD | NEW |