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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 class ImageTransportHelper | 107 class ImageTransportHelper |
108 : public IPC::Listener, | 108 : public IPC::Listener, |
109 public base::SupportsWeakPtr<ImageTransportHelper> { | 109 public base::SupportsWeakPtr<ImageTransportHelper> { |
110 public: | 110 public: |
111 // Takes weak pointers to objects that outlive the helper. | 111 // Takes weak pointers to objects that outlive the helper. |
112 ImageTransportHelper(ImageTransportSurface* surface, | 112 ImageTransportHelper(ImageTransportSurface* surface, |
113 GpuChannelManager* manager, | 113 GpuChannelManager* manager, |
114 GpuCommandBufferStub* stub, | 114 GpuCommandBufferStub* stub, |
115 gfx::PluginWindowHandle handle); | 115 gfx::PluginWindowHandle handle); |
116 virtual ~ImageTransportHelper(); | 116 ~ImageTransportHelper() override; |
117 | 117 |
118 bool Initialize(); | 118 bool Initialize(); |
119 | 119 |
120 // IPC::Listener implementation: | 120 // IPC::Listener implementation: |
121 virtual bool OnMessageReceived(const IPC::Message& message) override; | 121 bool OnMessageReceived(const IPC::Message& message) override; |
122 | 122 |
123 // Helper send functions. Caller fills in the surface specific params | 123 // Helper send functions. Caller fills in the surface specific params |
124 // like size and surface id. The helper fills in the rest. | 124 // like size and surface id. The helper fills in the rest. |
125 void SendAcceleratedSurfaceBuffersSwapped( | 125 void SendAcceleratedSurfaceBuffersSwapped( |
126 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); | 126 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); |
127 void SendUpdateVSyncParameters( | 127 void SendUpdateVSyncParameters( |
128 base::TimeTicks timebase, base::TimeDelta interval); | 128 base::TimeTicks timebase, base::TimeDelta interval); |
129 | 129 |
130 void SwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); | 130 void SwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); |
131 | 131 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // GLSurfaceAdapter, thereby forwarding GLSurface methods through to it. | 177 // GLSurfaceAdapter, thereby forwarding GLSurface methods through to it. |
178 class PassThroughImageTransportSurface | 178 class PassThroughImageTransportSurface |
179 : public gfx::GLSurfaceAdapter, | 179 : public gfx::GLSurfaceAdapter, |
180 public ImageTransportSurface { | 180 public ImageTransportSurface { |
181 public: | 181 public: |
182 PassThroughImageTransportSurface(GpuChannelManager* manager, | 182 PassThroughImageTransportSurface(GpuChannelManager* manager, |
183 GpuCommandBufferStub* stub, | 183 GpuCommandBufferStub* stub, |
184 gfx::GLSurface* surface); | 184 gfx::GLSurface* surface); |
185 | 185 |
186 // GLSurface implementation. | 186 // GLSurface implementation. |
187 virtual bool Initialize() override; | 187 bool Initialize() override; |
188 virtual void Destroy() override; | 188 void Destroy() override; |
189 virtual bool SwapBuffers() override; | 189 bool SwapBuffers() override; |
190 virtual bool PostSubBuffer(int x, int y, int width, int height) override; | 190 bool PostSubBuffer(int x, int y, int width, int height) override; |
191 virtual bool OnMakeCurrent(gfx::GLContext* context) override; | 191 bool OnMakeCurrent(gfx::GLContext* context) override; |
192 | 192 |
193 // ImageTransportSurface implementation. | 193 // ImageTransportSurface implementation. |
194 #if defined(OS_MACOSX) | 194 #if defined(OS_MACOSX) |
195 virtual void OnBufferPresented( | 195 void OnBufferPresented( |
196 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; | 196 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; |
197 #endif | 197 #endif |
198 virtual void OnResize(gfx::Size size, float scale_factor) override; | 198 void OnResize(gfx::Size size, float scale_factor) override; |
199 virtual gfx::Size GetSize() override; | 199 gfx::Size GetSize() override; |
200 virtual void SetLatencyInfo( | 200 void SetLatencyInfo( |
201 const std::vector<ui::LatencyInfo>& latency_info) override; | 201 const std::vector<ui::LatencyInfo>& latency_info) override; |
202 virtual void WakeUpGpu() override; | 202 void WakeUpGpu() override; |
203 | 203 |
204 protected: | 204 protected: |
205 virtual ~PassThroughImageTransportSurface(); | 205 ~PassThroughImageTransportSurface() override; |
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 bool did_set_swap_interval_; | 215 bool did_set_swap_interval_; |
216 std::vector<ui::LatencyInfo> latency_info_; | 216 std::vector<ui::LatencyInfo> latency_info_; |
217 | 217 |
218 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 218 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
219 }; | 219 }; |
220 | 220 |
221 } // namespace content | 221 } // namespace content |
222 | 222 |
223 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 223 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |