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