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 "content/common/gpu/gpu_command_buffer_stub.h" | 10 #include "content/common/gpu/gpu_command_buffer_stub.h" |
(...skipping 30 matching lines...) Expand all Loading... | |
41 virtual void* GetDisplay() OVERRIDE; | 41 virtual void* GetDisplay() OVERRIDE; |
42 virtual void* GetConfig() OVERRIDE; | 42 virtual void* GetConfig() OVERRIDE; |
43 | 43 |
44 protected: | 44 protected: |
45 // ImageTransportSurface implementation. | 45 // ImageTransportSurface implementation. |
46 virtual void OnNewSurfaceACK( | 46 virtual void OnNewSurfaceACK( |
47 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; | 47 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; |
48 virtual void OnBuffersSwappedACK() OVERRIDE; | 48 virtual void OnBuffersSwappedACK() OVERRIDE; |
49 virtual void OnPostSubBufferACK() OVERRIDE; | 49 virtual void OnPostSubBufferACK() OVERRIDE; |
50 virtual void OnResizeViewACK() OVERRIDE; | 50 virtual void OnResizeViewACK() OVERRIDE; |
51 virtual void OnSetFrontSurfaceIsProtected(bool is_protected, | |
52 uint32 visibility_state_id) | |
53 OVERRIDE; | |
piman
2012/06/12 20:59:48
nit: you can write it as:
virtual void OnSetFrontS
| |
51 virtual void OnResize(gfx::Size size) OVERRIDE; | 54 virtual void OnResize(gfx::Size size) OVERRIDE; |
52 | 55 |
53 // GpuCommandBufferStub::DestructionObserver implementation. | 56 // GpuCommandBufferStub::DestructionObserver implementation. |
54 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) OVERRIDE; | 57 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) OVERRIDE; |
55 | 58 |
56 private: | 59 private: |
57 // A texture backing the front/back buffer in the parent stub. | 60 // A texture backing the front/back buffer in the parent stub. |
58 struct Texture { | 61 struct Texture { |
59 Texture(); | 62 Texture(); |
60 ~Texture(); | 63 ~Texture(); |
61 | 64 |
62 // The client-side id in the parent stub. | 65 // The client-side id in the parent stub. |
63 uint32 client_id; | 66 uint32 client_id; |
64 | 67 |
65 // The currently allocated size. | 68 // The currently allocated size. |
66 gfx::Size size; | 69 gfx::Size size; |
67 | 70 |
68 // Whether or not that texture has been sent to the client yet. | 71 // Whether or not that texture has been sent to the client yet. |
69 bool sent_to_client; | 72 bool sent_to_client; |
70 | 73 |
71 // The texture info in the parent stub. | 74 // The texture info in the parent stub. |
72 gpu::gles2::TextureManager::TextureInfo::Ref info; | 75 gpu::gles2::TextureManager::TextureInfo::Ref info; |
73 }; | 76 }; |
74 | 77 |
75 virtual ~TextureImageTransportSurface(); | 78 virtual ~TextureImageTransportSurface(); |
76 void CreateBackTexture(const gfx::Size& size); | 79 void CreateBackTexture(const gfx::Size& size); |
77 void ReleaseBackTexture(); | |
78 void AttachBackTextureToFBO(); | 80 void AttachBackTextureToFBO(); |
81 void ReleaseTexture(int id); | |
79 void ReleaseParentStub(); | 82 void ReleaseParentStub(); |
83 void AdjustFrontBufferAllocation(); | |
84 int front() const { return front_; } | |
80 int back() const { return 1 - front_; } | 85 int back() const { return 1 - front_; } |
81 | 86 |
82 // The framebuffer that represents this surface (service id). Allocated lazily | 87 // The framebuffer that represents this surface (service id). Allocated lazily |
83 // in OnMakeCurrent. | 88 // in OnMakeCurrent. |
84 uint32 fbo_id_; | 89 uint32 fbo_id_; |
85 | 90 |
86 // The front and back buffers. | 91 // The front and back buffers. |
87 Texture textures_[2]; | 92 Texture textures_[2]; |
88 | 93 |
89 gfx::Rect previous_damage_rect_; | 94 gfx::Rect previous_damage_rect_; |
90 | 95 |
91 // Indicates which of the 2 above is the front buffer. | 96 // Indicates which of the 2 above is the front buffer. |
92 int front_; | 97 int front_; |
93 | 98 |
94 // Whether or not the command buffer stub has been destroyed. | 99 // Whether or not the command buffer stub has been destroyed. |
95 bool stub_destroyed_; | 100 bool stub_destroyed_; |
96 | 101 |
97 bool backbuffer_suggested_allocation_; | 102 bool backbuffer_suggested_allocation_; |
98 bool frontbuffer_suggested_allocation_; | 103 bool frontbuffer_suggested_allocation_; |
99 | 104 |
105 bool frontbuffer_is_protected_; | |
106 uint32 visibility_state_id_; | |
107 | |
100 scoped_ptr<ImageTransportHelper> helper_; | 108 scoped_ptr<ImageTransportHelper> helper_; |
101 gfx::GLSurfaceHandle handle_; | 109 gfx::GLSurfaceHandle handle_; |
102 GpuCommandBufferStub* parent_stub_; | 110 GpuCommandBufferStub* parent_stub_; |
103 | 111 |
104 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); | 112 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); |
105 }; | 113 }; |
106 | 114 |
107 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ | 115 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |