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 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 | 62 |
63 virtual void OnBufferPresented( | 63 virtual void OnBufferPresented( |
64 const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0; | 64 const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0; |
65 virtual void OnResizeViewACK() = 0; | 65 virtual void OnResizeViewACK() = 0; |
66 virtual void OnResize(gfx::Size size) = 0; | 66 virtual void OnResize(gfx::Size size, float scale_factor) = 0; |
67 virtual void SetLatencyInfo( | 67 virtual void SetLatencyInfo( |
68 const cc::LatencyInfo& latency_info) = 0; | 68 const cc::LatencyInfo& latency_info) = 0; |
69 | 69 |
70 // Creates a surface with the given attributes. | 70 // Creates a surface with the given attributes. |
71 static scoped_refptr<gfx::GLSurface> CreateSurface( | 71 static scoped_refptr<gfx::GLSurface> CreateSurface( |
72 GpuChannelManager* manager, | 72 GpuChannelManager* manager, |
73 GpuCommandBufferStub* stub, | 73 GpuCommandBufferStub* stub, |
74 const gfx::GLSurfaceHandle& handle); | 74 const gfx::GLSurfaceHandle& handle); |
75 | 75 |
76 #if defined(OS_MACOSX) | 76 #if defined(OS_MACOSX) |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 private: | 151 private: |
152 gpu::GpuScheduler* Scheduler(); | 152 gpu::GpuScheduler* Scheduler(); |
153 gpu::gles2::GLES2Decoder* Decoder(); | 153 gpu::gles2::GLES2Decoder* Decoder(); |
154 | 154 |
155 // IPC::Message handlers. | 155 // IPC::Message handlers. |
156 void OnBufferPresented( | 156 void OnBufferPresented( |
157 const AcceleratedSurfaceMsg_BufferPresented_Params& params); | 157 const AcceleratedSurfaceMsg_BufferPresented_Params& params); |
158 void OnResizeViewACK(); | 158 void OnResizeViewACK(); |
159 | 159 |
160 // Backbuffer resize callback. | 160 // Backbuffer resize callback. |
161 void Resize(gfx::Size size); | 161 void Resize(gfx::Size size, float scale_factor); |
162 | 162 |
163 void SetLatencyInfo(const cc::LatencyInfo& latency_info); | 163 void SetLatencyInfo(const cc::LatencyInfo& latency_info); |
164 | 164 |
165 // Weak pointers that point to objects that outlive this helper. | 165 // Weak pointers that point to objects that outlive this helper. |
166 ImageTransportSurface* surface_; | 166 ImageTransportSurface* surface_; |
167 GpuChannelManager* manager_; | 167 GpuChannelManager* manager_; |
168 | 168 |
169 base::WeakPtr<GpuCommandBufferStub> stub_; | 169 base::WeakPtr<GpuCommandBufferStub> stub_; |
170 int32 route_id_; | 170 int32 route_id_; |
171 gfx::PluginWindowHandle handle_; | 171 gfx::PluginWindowHandle handle_; |
(...skipping 17 matching lines...) Expand all Loading... |
189 virtual void Destroy() OVERRIDE; | 189 virtual void Destroy() OVERRIDE; |
190 virtual bool DeferDraws() OVERRIDE; | 190 virtual bool DeferDraws() OVERRIDE; |
191 virtual bool SwapBuffers() OVERRIDE; | 191 virtual bool SwapBuffers() OVERRIDE; |
192 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 192 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
193 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 193 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
194 | 194 |
195 // ImageTransportSurface implementation. | 195 // ImageTransportSurface implementation. |
196 virtual void OnBufferPresented( | 196 virtual void OnBufferPresented( |
197 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; | 197 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; |
198 virtual void OnResizeViewACK() OVERRIDE; | 198 virtual void OnResizeViewACK() OVERRIDE; |
199 virtual void OnResize(gfx::Size size) OVERRIDE; | 199 virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; |
200 virtual gfx::Size GetSize() OVERRIDE; | 200 virtual gfx::Size GetSize() OVERRIDE; |
201 virtual void SetLatencyInfo( | 201 virtual void SetLatencyInfo( |
202 const cc::LatencyInfo& latency_info) OVERRIDE; | 202 const cc::LatencyInfo& latency_info) OVERRIDE; |
203 | 203 |
204 protected: | 204 protected: |
205 virtual ~PassThroughImageTransportSurface(); | 205 virtual ~PassThroughImageTransportSurface(); |
206 | 206 |
207 // If updated vsync parameters can be determined, send this information to | 207 // If updated vsync parameters can be determined, send this information to |
208 // the browser. | 208 // the browser. |
209 virtual void SendVSyncUpdateIfAvailable(); | 209 virtual void SendVSyncUpdateIfAvailable(); |
210 | 210 |
211 private: | 211 private: |
212 scoped_ptr<ImageTransportHelper> helper_; | 212 scoped_ptr<ImageTransportHelper> helper_; |
213 gfx::Size new_size_; | 213 gfx::Size new_size_; |
214 bool transport_; | 214 bool transport_; |
215 bool did_set_swap_interval_; | 215 bool did_set_swap_interval_; |
216 bool did_unschedule_; | 216 bool did_unschedule_; |
217 bool is_swap_buffers_pending_; | 217 bool is_swap_buffers_pending_; |
218 cc::LatencyInfo latency_info_; | 218 cc::LatencyInfo latency_info_; |
219 | 219 |
220 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 220 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
221 }; | 221 }; |
222 | 222 |
223 } // namespace content | 223 } // namespace content |
224 | 224 |
225 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 225 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |