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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // IPC::Listener implementation: | 119 // IPC::Listener implementation: |
120 bool OnMessageReceived(const IPC::Message& message) override; | 120 bool OnMessageReceived(const IPC::Message& message) override; |
121 | 121 |
122 // Helper send functions. Caller fills in the surface specific params | 122 // Helper send functions. Caller fills in the surface specific params |
123 // like size and surface id. The helper fills in the rest. | 123 // like size and surface id. The helper fills in the rest. |
124 void SendAcceleratedSurfaceBuffersSwapped( | 124 void SendAcceleratedSurfaceBuffersSwapped( |
125 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); | 125 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); |
126 void SendUpdateVSyncParameters( | 126 void SendUpdateVSyncParameters( |
127 base::TimeTicks timebase, base::TimeDelta interval); | 127 base::TimeTicks timebase, base::TimeDelta interval); |
128 | 128 |
129 void SwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); | 129 void SwapBuffersCallBack(); |
130 | 130 |
131 void SetPreemptByFlag( | 131 void SetPreemptByFlag( |
132 scoped_refptr<gpu::PreemptionFlag> preemption_flag); | 132 scoped_refptr<gpu::PreemptionFlag> preemption_flag); |
133 | 133 |
134 // Make the surface's context current. | 134 // Make the surface's context current. |
135 bool MakeCurrent(); | 135 bool MakeCurrent(); |
136 | 136 |
| 137 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
| 138 |
137 // Set the default swap interval on the surface. | 139 // Set the default swap interval on the surface. |
138 static void SetSwapInterval(gfx::GLContext* context); | 140 static void SetSwapInterval(gfx::GLContext* context); |
139 | 141 |
140 GpuChannelManager* manager() const { return manager_; } | 142 GpuChannelManager* manager() const { return manager_; } |
141 GpuCommandBufferStub* stub() const { return stub_.get(); } | 143 GpuCommandBufferStub* stub() const { return stub_.get(); } |
142 | 144 |
143 private: | 145 private: |
144 gpu::gles2::GLES2Decoder* Decoder(); | 146 gpu::gles2::GLES2Decoder* Decoder(); |
145 | 147 |
146 // IPC::Message handlers. | 148 // IPC::Message handlers. |
147 #if defined(OS_MACOSX) | 149 #if defined(OS_MACOSX) |
148 void OnBufferPresented( | 150 void OnBufferPresented( |
149 const AcceleratedSurfaceMsg_BufferPresented_Params& params); | 151 const AcceleratedSurfaceMsg_BufferPresented_Params& params); |
150 #endif | 152 #endif |
151 void OnWakeUpGpu(); | 153 void OnWakeUpGpu(); |
152 | 154 |
153 // Backbuffer resize callback. | 155 // Backbuffer resize callback. |
154 void Resize(gfx::Size size, float scale_factor); | 156 void Resize(gfx::Size size, float scale_factor); |
155 | 157 |
156 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); | |
157 | |
158 // Weak pointers that point to objects that outlive this helper. | 158 // Weak pointers that point to objects that outlive this helper. |
159 ImageTransportSurface* surface_; | 159 ImageTransportSurface* surface_; |
160 GpuChannelManager* manager_; | 160 GpuChannelManager* manager_; |
161 | 161 |
162 base::WeakPtr<GpuCommandBufferStub> stub_; | 162 base::WeakPtr<GpuCommandBufferStub> stub_; |
| 163 std::vector<ui::LatencyInfo> latency_info_; |
163 int32 route_id_; | 164 int32 route_id_; |
164 gfx::PluginWindowHandle handle_; | 165 gfx::PluginWindowHandle handle_; |
165 | 166 |
166 DISALLOW_COPY_AND_ASSIGN(ImageTransportHelper); | 167 DISALLOW_COPY_AND_ASSIGN(ImageTransportHelper); |
167 }; | 168 }; |
168 | 169 |
169 // An implementation of ImageTransportSurface that implements GLSurface through | 170 // An implementation of ImageTransportSurface that implements GLSurface through |
170 // GLSurfaceAdapter, thereby forwarding GLSurface methods through to it. | 171 // GLSurfaceAdapter, thereby forwarding GLSurface methods through to it. |
171 class PassThroughImageTransportSurface | 172 class PassThroughImageTransportSurface |
172 : public gfx::GLSurfaceAdapter, | 173 : public gfx::GLSurfaceAdapter, |
(...skipping 26 matching lines...) Expand all Loading... |
199 | 200 |
200 // If updated vsync parameters can be determined, send this information to | 201 // If updated vsync parameters can be determined, send this information to |
201 // the browser. | 202 // the browser. |
202 virtual void SendVSyncUpdateIfAvailable(); | 203 virtual void SendVSyncUpdateIfAvailable(); |
203 | 204 |
204 ImageTransportHelper* GetHelper() { return helper_.get(); } | 205 ImageTransportHelper* GetHelper() { return helper_.get(); } |
205 | 206 |
206 private: | 207 private: |
207 scoped_ptr<ImageTransportHelper> helper_; | 208 scoped_ptr<ImageTransportHelper> helper_; |
208 bool did_set_swap_interval_; | 209 bool did_set_swap_interval_; |
209 std::vector<ui::LatencyInfo> latency_info_; | |
210 | 210 |
211 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 211 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
212 }; | 212 }; |
213 | 213 |
214 } // namespace content | 214 } // namespace content |
215 | 215 |
216 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 216 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |