| 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 "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 #include "ipc/ipc_listener.h" | 16 #include "ipc/ipc_listener.h" |
| 17 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
| 18 #include "ui/events/latency_info.h" | 18 #include "ui/events/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 | 23 |
| 24 struct AcceleratedSurfaceMsg_BufferPresented_Params; | 24 struct AcceleratedSurfaceMsg_BufferPresented_Params; |
| 25 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | 25 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
| 26 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; | |
| 27 | 26 |
| 28 namespace gfx { | 27 namespace gfx { |
| 29 class GLSurface; | 28 class GLSurface; |
| 30 } | 29 } |
| 31 | 30 |
| 32 namespace gpu { | 31 namespace gpu { |
| 33 class GpuScheduler; | 32 class GpuScheduler; |
| 34 class PreemptionFlag; | 33 class PreemptionFlag; |
| 35 namespace gles2 { | 34 namespace gles2 { |
| 36 class GLES2Decoder; | 35 class GLES2Decoder; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 public base::SupportsWeakPtr<ImageTransportHelper> { | 100 public base::SupportsWeakPtr<ImageTransportHelper> { |
| 102 public: | 101 public: |
| 103 // Takes weak pointers to objects that outlive the helper. | 102 // Takes weak pointers to objects that outlive the helper. |
| 104 ImageTransportHelper(ImageTransportSurface* surface, | 103 ImageTransportHelper(ImageTransportSurface* surface, |
| 105 GpuChannelManager* manager, | 104 GpuChannelManager* manager, |
| 106 GpuCommandBufferStub* stub, | 105 GpuCommandBufferStub* stub, |
| 107 gfx::PluginWindowHandle handle); | 106 gfx::PluginWindowHandle handle); |
| 108 virtual ~ImageTransportHelper(); | 107 virtual ~ImageTransportHelper(); |
| 109 | 108 |
| 110 bool Initialize(); | 109 bool Initialize(); |
| 111 void Destroy(); | |
| 112 | 110 |
| 113 // IPC::Listener implementation: | 111 // IPC::Listener implementation: |
| 114 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 112 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 115 | 113 |
| 116 // Helper send functions. Caller fills in the surface specific params | 114 // Helper send functions. Caller fills in the surface specific params |
| 117 // like size and surface id. The helper fills in the rest. | 115 // like size and surface id. The helper fills in the rest. |
| 118 void SendAcceleratedSurfaceBuffersSwapped( | 116 void SendAcceleratedSurfaceBuffersSwapped( |
| 119 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); | 117 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); |
| 120 void SendAcceleratedSurfacePostSubBuffer( | |
| 121 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params); | |
| 122 void SendAcceleratedSurfaceRelease(); | |
| 123 void SendUpdateVSyncParameters( | 118 void SendUpdateVSyncParameters( |
| 124 base::TimeTicks timebase, base::TimeDelta interval); | 119 base::TimeTicks timebase, base::TimeDelta interval); |
| 125 | 120 |
| 126 void SendLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); | 121 void SendLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
| 127 | 122 |
| 128 // Whether or not we should execute more commands. | 123 // Whether or not we should execute more commands. |
| 129 void SetScheduled(bool is_scheduled); | 124 void SetScheduled(bool is_scheduled); |
| 130 | 125 |
| 131 void DeferToFence(base::Closure task); | 126 void DeferToFence(base::Closure task); |
| 132 | 127 |
| 133 void SetPreemptByFlag( | 128 void SetPreemptByFlag( |
| 134 scoped_refptr<gpu::PreemptionFlag> preemption_flag); | 129 scoped_refptr<gpu::PreemptionFlag> preemption_flag); |
| 135 | 130 |
| 136 // Make the surface's context current. | 131 // Make the surface's context current. |
| 137 bool MakeCurrent(); | 132 bool MakeCurrent(); |
| 138 | 133 |
| 139 // Set the default swap interval on the surface. | 134 // Set the default swap interval on the surface. |
| 140 static void SetSwapInterval(gfx::GLContext* context); | 135 static void SetSwapInterval(gfx::GLContext* context); |
| 141 | 136 |
| 142 void Suspend(); | |
| 143 | |
| 144 GpuChannelManager* manager() const { return manager_; } | 137 GpuChannelManager* manager() const { return manager_; } |
| 145 GpuCommandBufferStub* stub() const { return stub_.get(); } | 138 GpuCommandBufferStub* stub() const { return stub_.get(); } |
| 146 | 139 |
| 147 private: | 140 private: |
| 148 gpu::GpuScheduler* Scheduler(); | 141 gpu::GpuScheduler* Scheduler(); |
| 149 gpu::gles2::GLES2Decoder* Decoder(); | 142 gpu::gles2::GLES2Decoder* Decoder(); |
| 150 | 143 |
| 151 // IPC::Message handlers. | 144 // IPC::Message handlers. |
| 152 void OnBufferPresented( | 145 void OnBufferPresented( |
| 153 const AcceleratedSurfaceMsg_BufferPresented_Params& params); | 146 const AcceleratedSurfaceMsg_BufferPresented_Params& params); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 scoped_ptr<ImageTransportHelper> helper_; | 201 scoped_ptr<ImageTransportHelper> helper_; |
| 209 bool did_set_swap_interval_; | 202 bool did_set_swap_interval_; |
| 210 std::vector<ui::LatencyInfo> latency_info_; | 203 std::vector<ui::LatencyInfo> latency_info_; |
| 211 | 204 |
| 212 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 205 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
| 213 }; | 206 }; |
| 214 | 207 |
| 215 } // namespace content | 208 } // namespace content |
| 216 | 209 |
| 217 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 210 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
| OLD | NEW |