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 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 5 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfacePostSubBuffer, | 206 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfacePostSubBuffer, |
207 OnAcceleratedSurfacePostSubBuffer) | 207 OnAcceleratedSurfacePostSubBuffer) |
208 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSuspend, | 208 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSuspend, |
209 OnAcceleratedSurfaceSuspend) | 209 OnAcceleratedSurfaceSuspend) |
210 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, | 210 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, |
211 OnGraphicsInfoCollected) | 211 OnGraphicsInfoCollected) |
212 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease, | 212 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease, |
213 OnAcceleratedSurfaceRelease) | 213 OnAcceleratedSurfaceRelease) |
214 IPC_MESSAGE_HANDLER(GpuHostMsg_VideoMemoryUsageStats, | 214 IPC_MESSAGE_HANDLER(GpuHostMsg_VideoMemoryUsageStats, |
215 OnVideoMemoryUsageStatsReceived); | 215 OnVideoMemoryUsageStatsReceived); |
216 IPC_MESSAGE_HANDLER(GpuHostMsg_UpdateVSyncParameters, | |
217 OnUpdateVSyncParameters) | |
218 IPC_MESSAGE_HANDLER(GpuHostMsg_FrameDrawn, OnFrameDrawn) | 216 IPC_MESSAGE_HANDLER(GpuHostMsg_FrameDrawn, OnFrameDrawn) |
219 | 217 |
220 IPC_MESSAGE_UNHANDLED_ERROR() | 218 IPC_MESSAGE_UNHANDLED_ERROR() |
221 IPC_END_MESSAGE_MAP() | 219 IPC_END_MESSAGE_MAP() |
222 | 220 |
223 return true; | 221 return true; |
224 } | 222 } |
225 | 223 |
226 void GpuProcessHostUIShim::OnUpdateVSyncParameters(int surface_id, | |
227 base::TimeTicks timebase, | |
228 base::TimeDelta interval) { | |
229 | |
230 int render_process_id = 0; | |
231 int render_widget_id = 0; | |
232 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface( | |
233 surface_id, &render_process_id, &render_widget_id)) { | |
234 return; | |
235 } | |
236 RenderWidgetHost* rwh = | |
237 RenderWidgetHost::FromID(render_process_id, render_widget_id); | |
238 if (!rwh) | |
239 return; | |
240 RenderWidgetHostImpl::From(rwh)->UpdateVSyncParameters(timebase, interval); | |
241 } | |
242 | |
243 void GpuProcessHostUIShim::OnLogMessage( | 224 void GpuProcessHostUIShim::OnLogMessage( |
244 int level, | 225 int level, |
245 const std::string& header, | 226 const std::string& header, |
246 const std::string& message) { | 227 const std::string& message) { |
247 GpuDataManagerImpl::GetInstance()->AddLogMessage( | 228 GpuDataManagerImpl::GetInstance()->AddLogMessage( |
248 level, header, message); | 229 level, header, message); |
249 } | 230 } |
250 | 231 |
251 void GpuProcessHostUIShim::OnGraphicsInfoCollected( | 232 void GpuProcessHostUIShim::OnGraphicsInfoCollected( |
252 const gpu::GPUInfo& gpu_info) { | 233 const gpu::GPUInfo& gpu_info) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 view->AcceleratedSurfaceRelease(); | 344 view->AcceleratedSurfaceRelease(); |
364 } | 345 } |
365 | 346 |
366 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 347 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
367 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 348 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
368 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 349 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
369 video_memory_usage_stats); | 350 video_memory_usage_stats); |
370 } | 351 } |
371 | 352 |
372 } // namespace content | 353 } // namespace content |
OLD | NEW |