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_IMAGE_TRANSPORT_SURFACE_H_ | 5 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // making sure outside events reach the ImageTransportSurface and | 56 // making sure outside events reach the ImageTransportSurface and |
57 // allowing the ImageTransportSurface to send events to the outside world. | 57 // allowing the ImageTransportSurface to send events to the outside world. |
58 | 58 |
59 class ImageTransportSurface { | 59 class ImageTransportSurface { |
60 public: | 60 public: |
61 ImageTransportSurface(); | 61 ImageTransportSurface(); |
62 virtual ~ImageTransportSurface(); | 62 virtual ~ImageTransportSurface(); |
63 | 63 |
64 virtual void OnNewSurfaceACK( | 64 virtual void OnNewSurfaceACK( |
65 uint64 surface_id, TransportDIB::Handle surface_handle) = 0; | 65 uint64 surface_id, TransportDIB::Handle surface_handle) = 0; |
| 66 virtual void OnReleaseSurfaceACK(uint64 surface_id, bool success) = 0; |
66 virtual void OnBuffersSwappedACK() = 0; | 67 virtual void OnBuffersSwappedACK() = 0; |
67 virtual void OnPostSubBufferACK() = 0; | 68 virtual void OnPostSubBufferACK() = 0; |
68 virtual void OnResizeViewACK() = 0; | 69 virtual void OnResizeViewACK() = 0; |
69 virtual void OnResize(gfx::Size size) = 0; | 70 virtual void OnResize(gfx::Size size) = 0; |
70 | 71 |
71 // Creates the appropriate surface depending on the GL implementation. | 72 // Creates the appropriate surface depending on the GL implementation. |
72 static scoped_refptr<gfx::GLSurface> | 73 static scoped_refptr<gfx::GLSurface> |
73 CreateSurface(GpuChannelManager* manager, | 74 CreateSurface(GpuChannelManager* manager, |
74 GpuCommandBufferStub* stub, | 75 GpuCommandBufferStub* stub, |
75 const gfx::GLSurfaceHandle& handle); | 76 const gfx::GLSurfaceHandle& handle); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 void SetSwapInterval(); | 124 void SetSwapInterval(); |
124 | 125 |
125 void Suspend(); | 126 void Suspend(); |
126 | 127 |
127 private: | 128 private: |
128 gpu::GpuScheduler* Scheduler(); | 129 gpu::GpuScheduler* Scheduler(); |
129 gpu::gles2::GLES2Decoder* Decoder(); | 130 gpu::gles2::GLES2Decoder* Decoder(); |
130 | 131 |
131 // IPC::Message handlers. | 132 // IPC::Message handlers. |
132 void OnNewSurfaceACK(uint64 surface_handle, TransportDIB::Handle shm_handle); | 133 void OnNewSurfaceACK(uint64 surface_handle, TransportDIB::Handle shm_handle); |
| 134 void OnReleaseSurfaceACK(uint64 surface_id, bool success); |
133 void OnBuffersSwappedACK(); | 135 void OnBuffersSwappedACK(); |
134 void OnPostSubBufferACK(); | 136 void OnPostSubBufferACK(); |
135 void OnResizeViewACK(); | 137 void OnResizeViewACK(); |
136 | 138 |
137 // Backbuffer resize callback. | 139 // Backbuffer resize callback. |
138 void Resize(gfx::Size size); | 140 void Resize(gfx::Size size); |
139 | 141 |
140 // Weak pointers that point to objects that outlive this helper. | 142 // Weak pointers that point to objects that outlive this helper. |
141 ImageTransportSurface* surface_; | 143 ImageTransportSurface* surface_; |
142 GpuChannelManager* manager_; | 144 GpuChannelManager* manager_; |
(...skipping 20 matching lines...) Expand all Loading... |
163 // GLSurface implementation. | 165 // GLSurface implementation. |
164 virtual bool Initialize() OVERRIDE; | 166 virtual bool Initialize() OVERRIDE; |
165 virtual void Destroy() OVERRIDE; | 167 virtual void Destroy() OVERRIDE; |
166 virtual bool SwapBuffers() OVERRIDE; | 168 virtual bool SwapBuffers() OVERRIDE; |
167 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 169 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
168 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 170 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
169 | 171 |
170 // ImageTransportSurface implementation. | 172 // ImageTransportSurface implementation. |
171 virtual void OnNewSurfaceACK( | 173 virtual void OnNewSurfaceACK( |
172 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; | 174 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; |
| 175 virtual void OnReleaseSurfaceACK(uint64 surface_id, bool success) OVERRIDE; |
173 virtual void OnBuffersSwappedACK() OVERRIDE; | 176 virtual void OnBuffersSwappedACK() OVERRIDE; |
174 virtual void OnPostSubBufferACK() OVERRIDE; | 177 virtual void OnPostSubBufferACK() OVERRIDE; |
175 virtual void OnResizeViewACK() OVERRIDE; | 178 virtual void OnResizeViewACK() OVERRIDE; |
176 virtual void OnResize(gfx::Size size) OVERRIDE; | 179 virtual void OnResize(gfx::Size size) OVERRIDE; |
177 | 180 |
178 private: | 181 private: |
179 scoped_ptr<ImageTransportHelper> helper_; | 182 scoped_ptr<ImageTransportHelper> helper_; |
180 gfx::Size new_size_; | 183 gfx::Size new_size_; |
181 bool transport_; | 184 bool transport_; |
182 bool did_set_swap_interval_; | 185 bool did_set_swap_interval_; |
183 | 186 |
184 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 187 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
185 }; | 188 }; |
186 | 189 |
187 #endif // defined(ENABLE_GPU) | 190 #endif // defined(ENABLE_GPU) |
188 | 191 |
189 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 192 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |