| 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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSuspend, | 196 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSuspend, |
| 197 OnAcceleratedSurfaceSuspend) | 197 OnAcceleratedSurfaceSuspend) |
| 198 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, | 198 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, |
| 199 OnGraphicsInfoCollected) | 199 OnGraphicsInfoCollected) |
| 200 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew, | 200 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew, |
| 201 OnAcceleratedSurfaceNew) | 201 OnAcceleratedSurfaceNew) |
| 202 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease, | 202 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease, |
| 203 OnAcceleratedSurfaceRelease) | 203 OnAcceleratedSurfaceRelease) |
| 204 IPC_MESSAGE_HANDLER(GpuHostMsg_VideoMemoryUsageStats, | 204 IPC_MESSAGE_HANDLER(GpuHostMsg_VideoMemoryUsageStats, |
| 205 OnVideoMemoryUsageStatsReceived); | 205 OnVideoMemoryUsageStatsReceived); |
| 206 IPC_MESSAGE_HANDLER(GpuHostMsg_UpdateVSyncParameters, |
| 207 OnUpdateVSyncParameters) |
| 208 |
| 206 #if defined(TOOLKIT_GTK) || defined(OS_WIN) | 209 #if defined(TOOLKIT_GTK) || defined(OS_WIN) |
| 207 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) | 210 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) |
| 208 #endif | 211 #endif |
| 209 | 212 |
| 210 IPC_MESSAGE_UNHANDLED_ERROR() | 213 IPC_MESSAGE_UNHANDLED_ERROR() |
| 211 IPC_END_MESSAGE_MAP() | 214 IPC_END_MESSAGE_MAP() |
| 212 | 215 |
| 213 return true; | 216 return true; |
| 214 } | 217 } |
| 215 | 218 |
| 219 void GpuProcessHostUIShim::OnUpdateVSyncParameters(int surface_id, |
| 220 base::TimeTicks timebase, |
| 221 base::TimeDelta interval) { |
| 222 |
| 223 int render_process_id = 0; |
| 224 int render_widget_id = 0; |
| 225 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface( |
| 226 surface_id, &render_process_id, &render_widget_id)) { |
| 227 return; |
| 228 } |
| 229 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id); |
| 230 if (!host) |
| 231 return; |
| 232 RenderWidgetHost* rwh = host->GetRenderWidgetHostByID(render_widget_id); |
| 233 if (!rwh) |
| 234 return; |
| 235 RenderWidgetHostImpl::From(rwh)->UpdateVSyncParameters(timebase, interval); |
| 236 } |
| 237 |
| 216 void GpuProcessHostUIShim::OnLogMessage( | 238 void GpuProcessHostUIShim::OnLogMessage( |
| 217 int level, | 239 int level, |
| 218 const std::string& header, | 240 const std::string& header, |
| 219 const std::string& message) { | 241 const std::string& message) { |
| 220 GpuDataManagerImpl::GetInstance()->AddLogMessage( | 242 GpuDataManagerImpl::GetInstance()->AddLogMessage( |
| 221 level, header, message); | 243 level, header, message); |
| 222 } | 244 } |
| 223 | 245 |
| 224 void GpuProcessHostUIShim::OnGraphicsInfoCollected(const GPUInfo& gpu_info) { | 246 void GpuProcessHostUIShim::OnGraphicsInfoCollected(const GPUInfo& gpu_info) { |
| 225 // OnGraphicsInfoCollected is sent back after the GPU process successfully | 247 // OnGraphicsInfoCollected is sent back after the GPU process successfully |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 view->AcceleratedSurfaceRelease(params.identifier); | 381 view->AcceleratedSurfaceRelease(params.identifier); |
| 360 } | 382 } |
| 361 | 383 |
| 362 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 384 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
| 363 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 385 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
| 364 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 386 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
| 365 video_memory_usage_stats); | 387 video_memory_usage_stats); |
| 366 } | 388 } |
| 367 | 389 |
| 368 } // namespace content | 390 } // namespace content |
| OLD | NEW |