Revert of Enabling audio quality test on mac. (patchset #1 id:1 of https://codereview...
[chromium-blink-merge.git] / webkit / common / gpu / webgraphicscontext3d_in_process_command_buffer_impl.h
blob62197fd53deb190d95e8ba4f9b329ac3ffc519c0
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.
5 #ifndef WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_
6 #define WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_
8 #include <vector>
10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "gpu/command_buffer/client/gl_in_process_context.h"
13 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
14 #include "third_party/WebKit/public/platform/WebString.h"
15 #include "ui/gfx/native_widget_types.h"
16 #include "webkit/common/gpu/webgraphicscontext3d_impl.h"
17 #include "webkit/common/gpu/webkit_gpu_export.h"
19 namespace gpu {
20 class ContextSupport;
22 namespace gles2 {
23 class GLES2Interface;
24 class GLES2Implementation;
25 struct ContextCreationAttribHelper;
29 namespace gpu {
30 class GLInProcessContext;
33 namespace webkit {
34 namespace gpu {
36 class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
37 : public WebGraphicsContext3DImpl {
38 public:
39 enum MappedMemoryReclaimLimit {
40 kNoLimit = 0,
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);
49 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
50 CreateOffscreenContext(
51 const blink::WebGraphicsContext3D::Attributes& attributes,
52 bool lose_context_when_out_of_memory);
54 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
55 WrapContext(
56 scoped_ptr< ::gpu::GLInProcessContext> context,
57 const blink::WebGraphicsContext3D::Attributes& attributes);
59 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl();
61 size_t GetMappedMemoryLimit();
63 // WebGraphicsContext3DImpl methods
64 virtual bool InitializeOnCurrentThread() OVERRIDE;
66 //----------------------------------------------------------------------
67 // WebGraphicsContext3D methods
68 virtual bool isContextLost();
70 virtual WGC3Denum getGraphicsResetStatusARB();
72 ::gpu::ContextSupport* GetContextSupport();
74 ::gpu::gles2::GLES2Implementation* GetImplementation() {
75 return real_gl_;
78 private:
79 WebGraphicsContext3DInProcessCommandBufferImpl(
80 scoped_ptr< ::gpu::GLInProcessContext> context,
81 const blink::WebGraphicsContext3D::Attributes& attributes,
82 bool lose_context_when_out_of_memory,
83 bool is_offscreen,
84 gfx::AcceleratedWidget window);
86 void OnContextLost();
88 bool MaybeInitializeGL();
90 // Used to try to find bugs in code that calls gl directly through the gl api
91 // instead of going through WebGraphicsContext3D.
92 void ClearContext();
94 ::gpu::gles2::ContextCreationAttribHelper attribs_;
95 bool share_resources_;
96 bool webgl_context_;
98 bool is_offscreen_;
99 // Only used when not offscreen.
100 gfx::AcceleratedWidget window_;
102 // The context we use for OpenGL rendering.
103 scoped_ptr< ::gpu::GLInProcessContext> context_;
104 // The GLES2Implementation we use for OpenGL rendering.
105 ::gpu::gles2::GLES2Implementation* real_gl_;
108 } // namespace gpu
109 } // namespace webkit
111 #endif // WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_