| 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" |
| 15 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 16 #include "ipc/ipc_listener.h" | 17 #include "ipc/ipc_listener.h" |
| 17 #include "ipc/ipc_message.h" | 18 #include "ipc/ipc_message.h" |
| 18 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 19 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
| 20 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
| 21 #include "ui/gl/gl_surface.h" | 22 #include "ui/gl/gl_surface.h" |
| 22 #include "ui/surface/transport_dib.h" | 23 #include "ui/surface/transport_dib.h" |
| 23 | 24 |
| 24 struct AcceleratedSurfaceMsg_BufferPresented_Params; | 25 struct AcceleratedSurfaceMsg_BufferPresented_Params; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // allowing the ImageTransportSurface to send events to the outside world. | 57 // allowing the ImageTransportSurface to send events to the outside world. |
| 57 | 58 |
| 58 class ImageTransportSurface { | 59 class ImageTransportSurface { |
| 59 public: | 60 public: |
| 60 ImageTransportSurface(); | 61 ImageTransportSurface(); |
| 61 | 62 |
| 62 virtual void OnBufferPresented( | 63 virtual void OnBufferPresented( |
| 63 const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0; | 64 const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0; |
| 64 virtual void OnResizeViewACK() = 0; | 65 virtual void OnResizeViewACK() = 0; |
| 65 virtual void OnResize(gfx::Size size) = 0; | 66 virtual void OnResize(gfx::Size size) = 0; |
| 67 virtual void SetLatencyInfo( |
| 68 const cc::LatencyInfo& latency_info) = 0; |
| 66 | 69 |
| 67 // Creates a surface with the given attributes. | 70 // Creates a surface with the given attributes. |
| 68 static scoped_refptr<gfx::GLSurface> CreateSurface( | 71 static scoped_refptr<gfx::GLSurface> CreateSurface( |
| 69 GpuChannelManager* manager, | 72 GpuChannelManager* manager, |
| 70 GpuCommandBufferStub* stub, | 73 GpuCommandBufferStub* stub, |
| 71 const gfx::GLSurfaceHandle& handle); | 74 const gfx::GLSurfaceHandle& handle); |
| 72 | 75 |
| 73 #if defined(OS_MACOSX) | 76 #if defined(OS_MACOSX) |
| 74 CONTENT_EXPORT static void SetAllowOSMesaForTesting(bool allow); | 77 CONTENT_EXPORT static void SetAllowOSMesaForTesting(bool allow); |
| 75 #endif | 78 #endif |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void SendAcceleratedSurfaceBuffersSwapped( | 120 void SendAcceleratedSurfaceBuffersSwapped( |
| 118 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); | 121 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); |
| 119 void SendAcceleratedSurfacePostSubBuffer( | 122 void SendAcceleratedSurfacePostSubBuffer( |
| 120 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params); | 123 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params); |
| 121 void SendAcceleratedSurfaceRelease( | 124 void SendAcceleratedSurfaceRelease( |
| 122 GpuHostMsg_AcceleratedSurfaceRelease_Params params); | 125 GpuHostMsg_AcceleratedSurfaceRelease_Params params); |
| 123 void SendResizeView(const gfx::Size& size); | 126 void SendResizeView(const gfx::Size& size); |
| 124 void SendUpdateVSyncParameters( | 127 void SendUpdateVSyncParameters( |
| 125 base::TimeTicks timebase, base::TimeDelta interval); | 128 base::TimeTicks timebase, base::TimeDelta interval); |
| 126 | 129 |
| 130 void SendLatencyInfo(const cc::LatencyInfo& latency_info); |
| 131 |
| 127 // Whether or not we should execute more commands. | 132 // Whether or not we should execute more commands. |
| 128 void SetScheduled(bool is_scheduled); | 133 void SetScheduled(bool is_scheduled); |
| 129 | 134 |
| 130 void DeferToFence(base::Closure task); | 135 void DeferToFence(base::Closure task); |
| 131 | 136 |
| 132 void SetPreemptByFlag( | 137 void SetPreemptByFlag( |
| 133 scoped_refptr<gpu::PreemptionFlag> preemption_flag); | 138 scoped_refptr<gpu::PreemptionFlag> preemption_flag); |
| 134 | 139 |
| 135 // Make the surface's context current. | 140 // Make the surface's context current. |
| 136 bool MakeCurrent(); | 141 bool MakeCurrent(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 148 gpu::gles2::GLES2Decoder* Decoder(); | 153 gpu::gles2::GLES2Decoder* Decoder(); |
| 149 | 154 |
| 150 // IPC::Message handlers. | 155 // IPC::Message handlers. |
| 151 void OnBufferPresented( | 156 void OnBufferPresented( |
| 152 const AcceleratedSurfaceMsg_BufferPresented_Params& params); | 157 const AcceleratedSurfaceMsg_BufferPresented_Params& params); |
| 153 void OnResizeViewACK(); | 158 void OnResizeViewACK(); |
| 154 | 159 |
| 155 // Backbuffer resize callback. | 160 // Backbuffer resize callback. |
| 156 void Resize(gfx::Size size); | 161 void Resize(gfx::Size size); |
| 157 | 162 |
| 163 void SetLatencyInfo(const cc::LatencyInfo& latency_info); |
| 164 |
| 158 // Weak pointers that point to objects that outlive this helper. | 165 // Weak pointers that point to objects that outlive this helper. |
| 159 ImageTransportSurface* surface_; | 166 ImageTransportSurface* surface_; |
| 160 GpuChannelManager* manager_; | 167 GpuChannelManager* manager_; |
| 161 | 168 |
| 162 base::WeakPtr<GpuCommandBufferStub> stub_; | 169 base::WeakPtr<GpuCommandBufferStub> stub_; |
| 163 int32 route_id_; | 170 int32 route_id_; |
| 164 gfx::PluginWindowHandle handle_; | 171 gfx::PluginWindowHandle handle_; |
| 165 | 172 |
| 166 DISALLOW_COPY_AND_ASSIGN(ImageTransportHelper); | 173 DISALLOW_COPY_AND_ASSIGN(ImageTransportHelper); |
| 167 }; | 174 }; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 184 virtual bool SwapBuffers() OVERRIDE; | 191 virtual bool SwapBuffers() OVERRIDE; |
| 185 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; |
| 186 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 193 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
| 187 | 194 |
| 188 // ImageTransportSurface implementation. | 195 // ImageTransportSurface implementation. |
| 189 virtual void OnBufferPresented( | 196 virtual void OnBufferPresented( |
| 190 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; | 197 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; |
| 191 virtual void OnResizeViewACK() OVERRIDE; | 198 virtual void OnResizeViewACK() OVERRIDE; |
| 192 virtual void OnResize(gfx::Size size) OVERRIDE; | 199 virtual void OnResize(gfx::Size size) OVERRIDE; |
| 193 virtual gfx::Size GetSize() OVERRIDE; | 200 virtual gfx::Size GetSize() OVERRIDE; |
| 201 virtual void SetLatencyInfo( |
| 202 const cc::LatencyInfo& latency_info) OVERRIDE; |
| 194 | 203 |
| 195 protected: | 204 protected: |
| 196 virtual ~PassThroughImageTransportSurface(); | 205 virtual ~PassThroughImageTransportSurface(); |
| 197 | 206 |
| 198 // If updated vsync parameters can be determined, send this information to | 207 // If updated vsync parameters can be determined, send this information to |
| 199 // the browser. | 208 // the browser. |
| 200 virtual void SendVSyncUpdateIfAvailable(); | 209 virtual void SendVSyncUpdateIfAvailable(); |
| 201 | 210 |
| 202 private: | 211 private: |
| 203 scoped_ptr<ImageTransportHelper> helper_; | 212 scoped_ptr<ImageTransportHelper> helper_; |
| 204 gfx::Size new_size_; | 213 gfx::Size new_size_; |
| 205 bool transport_; | 214 bool transport_; |
| 206 bool did_set_swap_interval_; | 215 bool did_set_swap_interval_; |
| 207 bool did_unschedule_; | 216 bool did_unschedule_; |
| 208 bool is_swap_buffers_pending_; | 217 bool is_swap_buffers_pending_; |
| 218 cc::LatencyInfo latency_info_; |
| 209 | 219 |
| 210 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 220 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
| 211 }; | 221 }; |
| 212 | 222 |
| 213 } // namespace content | 223 } // namespace content |
| 214 | 224 |
| 215 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 225 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
| OLD | NEW |