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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/weak_ptr.h" | |
11 #include "content/common/gpu/gpu_command_buffer_stub.h" | 10 #include "content/common/gpu/gpu_command_buffer_stub.h" |
12 #include "content/common/gpu/image_transport_surface.h" | 11 #include "content/common/gpu/image_transport_surface.h" |
13 #include "gpu/command_buffer/service/texture_manager.h" | 12 #include "gpu/command_buffer/service/texture_manager.h" |
14 #include "ui/gfx/gl/gl_surface.h" | 13 #include "ui/gfx/gl/gl_surface.h" |
15 | 14 |
16 class GpuChannelManager; | 15 class GpuChannelManager; |
17 | 16 |
18 class TextureImageTransportSurface : | 17 class TextureImageTransportSurface : |
19 public ImageTransportSurface, | 18 public ImageTransportSurface, |
20 public GpuCommandBufferStub::DestructionObserver, | 19 public GpuCommandBufferStub::DestructionObserver, |
(...skipping 28 matching lines...) Expand all Loading... | |
49 virtual void OnPostSubBufferACK() OVERRIDE; | 48 virtual void OnPostSubBufferACK() OVERRIDE; |
50 virtual void OnResizeViewACK() OVERRIDE; | 49 virtual void OnResizeViewACK() OVERRIDE; |
51 virtual void OnResize(gfx::Size size) OVERRIDE; | 50 virtual void OnResize(gfx::Size size) OVERRIDE; |
52 | 51 |
53 // GpuCommandBufferStub::DestructionObserver implementation. | 52 // GpuCommandBufferStub::DestructionObserver implementation. |
54 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) OVERRIDE; | 53 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) OVERRIDE; |
55 | 54 |
56 private: | 55 private: |
57 // A texture backing the front/back buffer in the parent stub. | 56 // A texture backing the front/back buffer in the parent stub. |
58 struct Texture { | 57 struct Texture { |
59 Texture() : client_id(0), sent_to_client(false) {} | 58 Texture(); |
59 ~Texture(); | |
60 | 60 |
61 // The client-side id in the parent stub. | 61 // The client-side id in the parent stub. |
62 uint32 client_id; | 62 uint32 client_id; |
63 | 63 |
64 // The currently allocated size. | 64 // The currently allocated size. |
65 gfx::Size size; | 65 gfx::Size size; |
66 | 66 |
67 // Whether or not that texture has been sent to the client yet. | 67 // Whether or not that texture has been sent to the client yet. |
68 bool sent_to_client; | 68 bool sent_to_client; |
69 | |
70 // The texture info in the parent stub. | |
71 scoped_refptr<gpu::gles2::TextureManager::TextureInfo> info; | |
jonathan.backer
2012/04/17 17:21:50
TextureManager::Ref
piman
2012/04/17 17:37:24
Done.
| |
69 }; | 72 }; |
70 | 73 |
71 virtual ~TextureImageTransportSurface(); | 74 virtual ~TextureImageTransportSurface(); |
72 void CreateBackTexture(const gfx::Size& size); | 75 void CreateBackTexture(const gfx::Size& size); |
73 void ReleaseBackTexture(); | 76 void ReleaseBackTexture(); |
74 void AttachBackTextureToFBO(); | 77 void AttachBackTextureToFBO(); |
75 gpu::gles2::TextureManager::TextureInfo* GetParentInfo(uint32 client_id); | |
76 int back() const { return 1 - front_; } | 78 int back() const { return 1 - front_; } |
77 | 79 |
78 // The framebuffer that represents this surface (service id). Allocated lazily | 80 // The framebuffer that represents this surface (service id). Allocated lazily |
79 // in OnMakeCurrent. | 81 // in OnMakeCurrent. |
80 uint32 fbo_id_; | 82 uint32 fbo_id_; |
81 | 83 |
82 // The front and back buffers. | 84 // The front and back buffers. |
83 Texture textures_[2]; | 85 Texture textures_[2]; |
84 | 86 |
85 gfx::Rect previous_damage_rect_; | 87 gfx::Rect previous_damage_rect_; |
86 | 88 |
87 // Indicates which of the 2 above is the front buffer. | 89 // Indicates which of the 2 above is the front buffer. |
88 int front_; | 90 int front_; |
89 | 91 |
90 // Whether or not the command buffer stub has been destroyed. | 92 // Whether or not the command buffer stub has been destroyed. |
91 bool stub_destroyed_; | 93 bool stub_destroyed_; |
92 | 94 |
93 scoped_ptr<ImageTransportHelper> helper_; | 95 scoped_ptr<ImageTransportHelper> helper_; |
94 base::WeakPtr<GpuCommandBufferStub> parent_stub_; | 96 GpuCommandBufferStub* parent_stub_; |
jonathan.backer
2012/04/17 17:21:50
Here's my understanding: we've got a race on teard
| |
95 | 97 |
96 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); | 98 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); |
97 }; | 99 }; |
98 | 100 |
99 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ | 101 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |