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 CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ | 5 #ifndef CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ |
6 #define CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ | 6 #define CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "content/common/gpu/gpu_command_buffer_stub.h" | 10 #include "content/common/gpu/gpu_command_buffer_stub.h" |
11 #include "content/common/gpu/image_transport_surface.h" | 11 #include "content/common/gpu/image_transport_surface.h" |
12 #include "gpu/command_buffer/service/texture_manager.h" | 12 #include "gpu/command_buffer/service/texture_manager.h" |
13 #include "ui/gl/gl_surface.h" | 13 #include "ui/gl/gl_surface.h" |
14 | 14 |
15 class GpuChannelManager; | 15 class GpuChannelManager; |
16 | 16 |
17 class TextureImageTransportSurface : | 17 class TextureImageTransportSurface : |
18 public ImageTransportSurface, | 18 public ImageTransportSurface, |
19 public GpuCommandBufferStub::DestructionObserver, | 19 public GpuCommandBufferStub::DestructionObserver, |
20 public gfx::GLSurface, | 20 public gfx::GLSurface, |
21 public base::SupportsWeakPtr<TextureImageTransportSurface> { | 21 public base::SupportsWeakPtr<TextureImageTransportSurface> { |
22 public: | 22 public: |
23 TextureImageTransportSurface(GpuChannelManager* manager, | 23 TextureImageTransportSurface(GpuChannelManager* manager, |
24 GpuCommandBufferStub* stub, | 24 GpuCommandBufferStub* stub, |
25 const gfx::GLSurfaceHandle& handle); | 25 const gfx::GLSurfaceHandle& handle); |
26 | 26 |
27 // gfx::GLSurface implementation. | 27 // gfx::GLSurface implementation. |
28 virtual bool Initialize() OVERRIDE; | 28 virtual bool Initialize() OVERRIDE; |
29 virtual void Destroy() OVERRIDE; | 29 virtual void Destroy() OVERRIDE; |
| 30 virtual bool DeferDraws() OVERRIDE; |
30 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 31 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
31 virtual bool IsOffscreen() OVERRIDE; | 32 virtual bool IsOffscreen() OVERRIDE; |
32 virtual bool SwapBuffers() OVERRIDE; | 33 virtual bool SwapBuffers() OVERRIDE; |
33 virtual gfx::Size GetSize() OVERRIDE; | 34 virtual gfx::Size GetSize() OVERRIDE; |
34 virtual void* GetHandle() OVERRIDE; | 35 virtual void* GetHandle() OVERRIDE; |
35 virtual unsigned GetFormat() OVERRIDE; | 36 virtual unsigned GetFormat() OVERRIDE; |
36 virtual std::string GetExtensions() OVERRIDE; | 37 virtual std::string GetExtensions() OVERRIDE; |
37 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 38 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
38 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 39 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
39 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 40 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 uint32 protection_state_id_; | 108 uint32 protection_state_id_; |
108 | 109 |
109 scoped_ptr<ImageTransportHelper> helper_; | 110 scoped_ptr<ImageTransportHelper> helper_; |
110 gfx::GLSurfaceHandle handle_; | 111 gfx::GLSurfaceHandle handle_; |
111 GpuCommandBufferStub* parent_stub_; | 112 GpuCommandBufferStub* parent_stub_; |
112 | 113 |
113 // The offscreen surface used to make the context current. However note that | 114 // The offscreen surface used to make the context current. However note that |
114 // the actual rendering is always redirected to an FBO. | 115 // the actual rendering is always redirected to an FBO. |
115 scoped_refptr<GLSurface> surface_; | 116 scoped_refptr<GLSurface> surface_; |
116 | 117 |
| 118 // Whether a SwapBuffers is pending. |
| 119 bool is_swap_buffers_pending_; |
| 120 |
| 121 // Whether we unscheduled command buffer because of pending SwapBuffers. |
| 122 bool did_unschedule_; |
| 123 |
117 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); | 124 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); |
118 }; | 125 }; |
119 | 126 |
120 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ | 127 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |