| 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 | 56 |
| 57 class ImageTransportSurface { | 57 class ImageTransportSurface { |
| 58 public: | 58 public: |
| 59 ImageTransportSurface(); | 59 ImageTransportSurface(); |
| 60 | 60 |
| 61 virtual void OnBufferPresented( | 61 virtual void OnBufferPresented( |
| 62 const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0; | 62 const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0; |
| 63 virtual void OnResizeViewACK() = 0; | 63 virtual void OnResizeViewACK() = 0; |
| 64 virtual void OnResize(gfx::Size size, float scale_factor) = 0; | 64 virtual void OnResize(gfx::Size size, float scale_factor) = 0; |
| 65 virtual void SetLatencyInfo( | 65 virtual void SetLatencyInfo( |
| 66 const ui::LatencyInfo& latency_info) = 0; | 66 const std::vector<ui::LatencyInfo>& latency_info) = 0; |
| 67 virtual void WakeUpGpu() = 0; | 67 virtual void WakeUpGpu() = 0; |
| 68 | 68 |
| 69 // Creates a surface with the given attributes. | 69 // Creates a surface with the given attributes. |
| 70 static scoped_refptr<gfx::GLSurface> CreateSurface( | 70 static scoped_refptr<gfx::GLSurface> CreateSurface( |
| 71 GpuChannelManager* manager, | 71 GpuChannelManager* manager, |
| 72 GpuCommandBufferStub* stub, | 72 GpuCommandBufferStub* stub, |
| 73 const gfx::GLSurfaceHandle& handle); | 73 const gfx::GLSurfaceHandle& handle); |
| 74 | 74 |
| 75 #if defined(OS_MACOSX) | 75 #if defined(OS_MACOSX) |
| 76 CONTENT_EXPORT static void SetAllowOSMesaForTesting(bool allow); | 76 CONTENT_EXPORT static void SetAllowOSMesaForTesting(bool allow); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // like size and surface id. The helper fills in the rest. | 118 // like size and surface id. The helper fills in the rest. |
| 119 void SendAcceleratedSurfaceBuffersSwapped( | 119 void SendAcceleratedSurfaceBuffersSwapped( |
| 120 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); | 120 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); |
| 121 void SendAcceleratedSurfacePostSubBuffer( | 121 void SendAcceleratedSurfacePostSubBuffer( |
| 122 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params); | 122 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params); |
| 123 void SendAcceleratedSurfaceRelease(); | 123 void SendAcceleratedSurfaceRelease(); |
| 124 void SendResizeView(const gfx::Size& size); | 124 void SendResizeView(const gfx::Size& size); |
| 125 void SendUpdateVSyncParameters( | 125 void SendUpdateVSyncParameters( |
| 126 base::TimeTicks timebase, base::TimeDelta interval); | 126 base::TimeTicks timebase, base::TimeDelta interval); |
| 127 | 127 |
| 128 void SendLatencyInfo(const ui::LatencyInfo& latency_info); | 128 void SendLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
| 129 | 129 |
| 130 // Whether or not we should execute more commands. | 130 // Whether or not we should execute more commands. |
| 131 void SetScheduled(bool is_scheduled); | 131 void SetScheduled(bool is_scheduled); |
| 132 | 132 |
| 133 void DeferToFence(base::Closure task); | 133 void DeferToFence(base::Closure task); |
| 134 | 134 |
| 135 void SetPreemptByFlag( | 135 void SetPreemptByFlag( |
| 136 scoped_refptr<gpu::PreemptionFlag> preemption_flag); | 136 scoped_refptr<gpu::PreemptionFlag> preemption_flag); |
| 137 | 137 |
| 138 // Make the surface's context current. | 138 // Make the surface's context current. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 152 | 152 |
| 153 // IPC::Message handlers. | 153 // IPC::Message handlers. |
| 154 void OnBufferPresented( | 154 void OnBufferPresented( |
| 155 const AcceleratedSurfaceMsg_BufferPresented_Params& params); | 155 const AcceleratedSurfaceMsg_BufferPresented_Params& params); |
| 156 void OnResizeViewACK(); | 156 void OnResizeViewACK(); |
| 157 void OnWakeUpGpu(); | 157 void OnWakeUpGpu(); |
| 158 | 158 |
| 159 // Backbuffer resize callback. | 159 // Backbuffer resize callback. |
| 160 void Resize(gfx::Size size, float scale_factor); | 160 void Resize(gfx::Size size, float scale_factor); |
| 161 | 161 |
| 162 void SetLatencyInfo(const ui::LatencyInfo& latency_info); | 162 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
| 163 | 163 |
| 164 // Weak pointers that point to objects that outlive this helper. | 164 // Weak pointers that point to objects that outlive this helper. |
| 165 ImageTransportSurface* surface_; | 165 ImageTransportSurface* surface_; |
| 166 GpuChannelManager* manager_; | 166 GpuChannelManager* manager_; |
| 167 | 167 |
| 168 base::WeakPtr<GpuCommandBufferStub> stub_; | 168 base::WeakPtr<GpuCommandBufferStub> stub_; |
| 169 int32 route_id_; | 169 int32 route_id_; |
| 170 gfx::PluginWindowHandle handle_; | 170 gfx::PluginWindowHandle handle_; |
| 171 | 171 |
| 172 DISALLOW_COPY_AND_ASSIGN(ImageTransportHelper); | 172 DISALLOW_COPY_AND_ASSIGN(ImageTransportHelper); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 191 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 191 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
| 192 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 192 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
| 193 | 193 |
| 194 // ImageTransportSurface implementation. | 194 // ImageTransportSurface implementation. |
| 195 virtual void OnBufferPresented( | 195 virtual void OnBufferPresented( |
| 196 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; | 196 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; |
| 197 virtual void OnResizeViewACK() OVERRIDE; | 197 virtual void OnResizeViewACK() OVERRIDE; |
| 198 virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; | 198 virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; |
| 199 virtual gfx::Size GetSize() OVERRIDE; | 199 virtual gfx::Size GetSize() OVERRIDE; |
| 200 virtual void SetLatencyInfo( | 200 virtual void SetLatencyInfo( |
| 201 const ui::LatencyInfo& latency_info) OVERRIDE; | 201 const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; |
| 202 virtual void WakeUpGpu() OVERRIDE; | 202 virtual void WakeUpGpu() 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 ImageTransportHelper* GetHelper() { return helper_.get(); } | 211 ImageTransportHelper* GetHelper() { return helper_.get(); } |
| 212 | 212 |
| 213 private: | 213 private: |
| 214 scoped_ptr<ImageTransportHelper> helper_; | 214 scoped_ptr<ImageTransportHelper> helper_; |
| 215 gfx::Size new_size_; | 215 gfx::Size new_size_; |
| 216 bool transport_; | 216 bool transport_; |
| 217 bool did_set_swap_interval_; | 217 bool did_set_swap_interval_; |
| 218 bool did_unschedule_; | 218 bool did_unschedule_; |
| 219 bool is_swap_buffers_pending_; | 219 bool is_swap_buffers_pending_; |
| 220 ui::LatencyInfo latency_info_; | 220 std::vector<ui::LatencyInfo> latency_info_; |
| 221 | 221 |
| 222 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 222 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
| 223 }; | 223 }; |
| 224 | 224 |
| 225 } // namespace content | 225 } // namespace content |
| 226 | 226 |
| 227 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 227 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
| OLD | NEW |