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