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