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 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 }; | 173 }; |
174 | 174 |
175 // An implementation of ImageTransportSurface that implements GLSurface through | 175 // An implementation of ImageTransportSurface that implements GLSurface through |
176 // GLSurfaceAdapter, thereby forwarding GLSurface methods through to it. | 176 // GLSurfaceAdapter, thereby forwarding GLSurface methods through to it. |
177 class PassThroughImageTransportSurface | 177 class PassThroughImageTransportSurface |
178 : public gfx::GLSurfaceAdapter, | 178 : public gfx::GLSurfaceAdapter, |
179 public ImageTransportSurface { | 179 public ImageTransportSurface { |
180 public: | 180 public: |
181 PassThroughImageTransportSurface(GpuChannelManager* manager, | 181 PassThroughImageTransportSurface(GpuChannelManager* manager, |
182 GpuCommandBufferStub* stub, | 182 GpuCommandBufferStub* stub, |
183 gfx::GLSurface* surface, | 183 gfx::GLSurface* surface); |
184 bool transport); | |
185 | 184 |
186 // GLSurface implementation. | 185 // GLSurface implementation. |
187 virtual bool Initialize() OVERRIDE; | 186 virtual bool Initialize() OVERRIDE; |
188 virtual void Destroy() OVERRIDE; | 187 virtual void Destroy() OVERRIDE; |
189 virtual bool DeferDraws() OVERRIDE; | |
190 virtual bool SwapBuffers() OVERRIDE; | 188 virtual bool SwapBuffers() OVERRIDE; |
191 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 189 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
192 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 190 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
193 | 191 |
194 // ImageTransportSurface implementation. | 192 // ImageTransportSurface implementation. |
195 virtual void OnBufferPresented( | 193 virtual void OnBufferPresented( |
196 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; | 194 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; |
197 virtual void OnResizeViewACK() OVERRIDE; | 195 virtual void OnResizeViewACK() OVERRIDE; |
198 virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; | 196 virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; |
199 virtual gfx::Size GetSize() OVERRIDE; | 197 virtual gfx::Size GetSize() OVERRIDE; |
200 virtual void SetLatencyInfo( | 198 virtual void SetLatencyInfo( |
201 const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; | 199 const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; |
202 virtual void WakeUpGpu() OVERRIDE; | 200 virtual void WakeUpGpu() OVERRIDE; |
203 | 201 |
204 protected: | 202 protected: |
205 virtual ~PassThroughImageTransportSurface(); | 203 virtual ~PassThroughImageTransportSurface(); |
206 | 204 |
207 // If updated vsync parameters can be determined, send this information to | 205 // If updated vsync parameters can be determined, send this information to |
208 // the browser. | 206 // the browser. |
209 virtual void SendVSyncUpdateIfAvailable(); | 207 virtual void SendVSyncUpdateIfAvailable(); |
210 | 208 |
211 ImageTransportHelper* GetHelper() { return helper_.get(); } | 209 ImageTransportHelper* GetHelper() { return helper_.get(); } |
212 | 210 |
213 private: | 211 private: |
214 scoped_ptr<ImageTransportHelper> helper_; | 212 scoped_ptr<ImageTransportHelper> helper_; |
215 gfx::Size new_size_; | |
216 bool transport_; | |
217 bool did_set_swap_interval_; | 213 bool did_set_swap_interval_; |
218 bool did_unschedule_; | |
219 bool is_swap_buffers_pending_; | |
220 std::vector<ui::LatencyInfo> latency_info_; | 214 std::vector<ui::LatencyInfo> latency_info_; |
221 | 215 |
222 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 216 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
223 }; | 217 }; |
224 | 218 |
225 } // namespace content | 219 } // namespace content |
226 | 220 |
227 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 221 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |