| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef GPU_BLINK_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | |
| 6 #define GPU_BLINK_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "gpu/blink/gpu_blink_export.h" | |
| 13 #include "gpu/blink/webgraphicscontext3d_impl.h" | |
| 14 #include "gpu/command_buffer/client/gl_in_process_context.h" | |
| 15 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | |
| 16 #include "third_party/WebKit/public/platform/WebString.h" | |
| 17 #include "ui/gfx/native_widget_types.h" | |
| 18 | |
| 19 namespace gpu { | |
| 20 class ContextSupport; | |
| 21 class GLInProcessContext; | |
| 22 | |
| 23 namespace gles2 { | |
| 24 class GLES2Interface; | |
| 25 class GLES2Implementation; | |
| 26 struct ContextCreationAttribHelper; | |
| 27 } | |
| 28 } | |
| 29 | |
| 30 namespace gpu_blink { | |
| 31 | |
| 32 class GPU_BLINK_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl | |
| 33 : public WebGraphicsContext3DImpl { | |
| 34 public: | |
| 35 enum MappedMemoryReclaimLimit { | |
| 36 kNoLimit = 0, | |
| 37 }; | |
| 38 | |
| 39 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | |
| 40 CreateViewContext( | |
| 41 const blink::WebGraphicsContext3D::Attributes& attributes, | |
| 42 bool lose_context_when_out_of_memory, | |
| 43 gfx::AcceleratedWidget window); | |
| 44 | |
| 45 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | |
| 46 CreateOffscreenContext( | |
| 47 const blink::WebGraphicsContext3D::Attributes& attributes, | |
| 48 bool lose_context_when_out_of_memory); | |
| 49 | |
| 50 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | |
| 51 WrapContext( | |
| 52 scoped_ptr< ::gpu::GLInProcessContext> context, | |
| 53 const blink::WebGraphicsContext3D::Attributes& attributes); | |
| 54 | |
| 55 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); | |
| 56 | |
| 57 size_t GetMappedMemoryLimit(); | |
| 58 | |
| 59 bool InitializeOnCurrentThread(); | |
| 60 void SetLock(base::Lock* lock); | |
| 61 | |
| 62 //---------------------------------------------------------------------- | |
| 63 // WebGraphicsContext3D methods | |
| 64 virtual bool isContextLost(); | |
| 65 | |
| 66 virtual blink::WGC3Denum getGraphicsResetStatusARB(); | |
| 67 | |
| 68 ::gpu::ContextSupport* GetContextSupport(); | |
| 69 | |
| 70 ::gpu::gles2::GLES2Implementation* GetImplementation() { | |
| 71 return real_gl_; | |
| 72 } | |
| 73 | |
| 74 private: | |
| 75 WebGraphicsContext3DInProcessCommandBufferImpl( | |
| 76 scoped_ptr< ::gpu::GLInProcessContext> context, | |
| 77 const blink::WebGraphicsContext3D::Attributes& attributes, | |
| 78 bool lose_context_when_out_of_memory, | |
| 79 bool is_offscreen, | |
| 80 gfx::AcceleratedWidget window); | |
| 81 | |
| 82 void OnContextLost(); | |
| 83 | |
| 84 bool MaybeInitializeGL(); | |
| 85 | |
| 86 // Used to try to find bugs in code that calls gl directly through the gl api | |
| 87 // instead of going through WebGraphicsContext3D. | |
| 88 void ClearContext(); | |
| 89 | |
| 90 ::gpu::gles2::ContextCreationAttribHelper attribs_; | |
| 91 bool share_resources_; | |
| 92 bool webgl_context_; | |
| 93 | |
| 94 bool is_offscreen_; | |
| 95 // Only used when not offscreen. | |
| 96 gfx::AcceleratedWidget window_; | |
| 97 | |
| 98 // The context we use for OpenGL rendering. | |
| 99 scoped_ptr< ::gpu::GLInProcessContext> context_; | |
| 100 // The GLES2Implementation we use for OpenGL rendering. | |
| 101 ::gpu::gles2::GLES2Implementation* real_gl_; | |
| 102 }; | |
| 103 | |
| 104 } // namespace gpu_blink | |
| 105 | |
| 106 #endif // GPU_BLINK_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | |
| OLD | NEW |