| 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" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "cc/debug/latency_info.h" | |
| 16 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 17 #include "ipc/ipc_listener.h" | 16 #include "ipc/ipc_listener.h" |
| 18 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
| 18 #include "ui/base/latency_info.h" |
| 19 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 20 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
| 21 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
| 22 #include "ui/gl/gl_surface.h" | 22 #include "ui/gl/gl_surface.h" |
| 23 #include "ui/surface/transport_dib.h" | 23 #include "ui/surface/transport_dib.h" |
| 24 | 24 |
| 25 struct AcceleratedSurfaceMsg_BufferPresented_Params; | 25 struct AcceleratedSurfaceMsg_BufferPresented_Params; |
| 26 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | 26 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
| 27 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; | 27 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; |
| 28 struct GpuHostMsg_AcceleratedSurfaceRelease_Params; | 28 struct GpuHostMsg_AcceleratedSurfaceRelease_Params; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 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) = 0; |
| 67 virtual void SetLatencyInfo( | 67 virtual void SetLatencyInfo( |
| 68 const cc::LatencyInfo& latency_info) = 0; | 68 const ui::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) |
| 77 CONTENT_EXPORT static void SetAllowOSMesaForTesting(bool allow); | 77 CONTENT_EXPORT static void SetAllowOSMesaForTesting(bool allow); |
| 78 #endif | 78 #endif |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 void SendAcceleratedSurfaceBuffersSwapped( | 120 void SendAcceleratedSurfaceBuffersSwapped( |
| 121 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); | 121 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); |
| 122 void SendAcceleratedSurfacePostSubBuffer( | 122 void SendAcceleratedSurfacePostSubBuffer( |
| 123 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params); | 123 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params); |
| 124 void SendAcceleratedSurfaceRelease( | 124 void SendAcceleratedSurfaceRelease( |
| 125 GpuHostMsg_AcceleratedSurfaceRelease_Params params); | 125 GpuHostMsg_AcceleratedSurfaceRelease_Params params); |
| 126 void SendResizeView(const gfx::Size& size); | 126 void SendResizeView(const gfx::Size& size); |
| 127 void SendUpdateVSyncParameters( | 127 void SendUpdateVSyncParameters( |
| 128 base::TimeTicks timebase, base::TimeDelta interval); | 128 base::TimeTicks timebase, base::TimeDelta interval); |
| 129 | 129 |
| 130 void SendLatencyInfo(const cc::LatencyInfo& latency_info); | 130 void SendLatencyInfo(const ui::LatencyInfo& latency_info); |
| 131 | 131 |
| 132 // Whether or not we should execute more commands. | 132 // Whether or not we should execute more commands. |
| 133 void SetScheduled(bool is_scheduled); | 133 void SetScheduled(bool is_scheduled); |
| 134 | 134 |
| 135 void DeferToFence(base::Closure task); | 135 void DeferToFence(base::Closure task); |
| 136 | 136 |
| 137 void SetPreemptByFlag( | 137 void SetPreemptByFlag( |
| 138 scoped_refptr<gpu::PreemptionFlag> preemption_flag); | 138 scoped_refptr<gpu::PreemptionFlag> preemption_flag); |
| 139 | 139 |
| 140 // Make the surface's context current. | 140 // Make the surface's context current. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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); |
| 162 | 162 |
| 163 void SetLatencyInfo(const cc::LatencyInfo& latency_info); | 163 void SetLatencyInfo(const ui::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_; |
| 172 | 172 |
| 173 DISALLOW_COPY_AND_ASSIGN(ImageTransportHelper); | 173 DISALLOW_COPY_AND_ASSIGN(ImageTransportHelper); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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) 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 ui::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 ui::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 |