| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 return; | 329 return; |
| 330 | 330 |
| 331 delayed_send.Cancel(); | 331 delayed_send.Cancel(); |
| 332 | 332 |
| 333 static const base::TimeDelta swap_delay = GetSwapDelay(); | 333 static const base::TimeDelta swap_delay = GetSwapDelay(); |
| 334 if (swap_delay.ToInternalValue()) | 334 if (swap_delay.ToInternalValue()) |
| 335 base::PlatformThread::Sleep(swap_delay); | 335 base::PlatformThread::Sleep(swap_delay); |
| 336 | 336 |
| 337 // View must send ACK message after next composite. | 337 // View must send ACK message after next composite. |
| 338 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); | 338 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); |
| 339 view->DidReceiveRendererFrame(); |
| 339 } | 340 } |
| 340 | 341 |
| 341 void GpuProcessHostUIShim::OnFrameDrawn(const ui::LatencyInfo& latency_info) { | 342 void GpuProcessHostUIShim::OnFrameDrawn(const ui::LatencyInfo& latency_info) { |
| 342 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); | 343 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); |
| 343 } | 344 } |
| 344 | 345 |
| 345 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( | 346 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( |
| 346 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { | 347 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { |
| 347 TRACE_EVENT0("renderer", | 348 TRACE_EVENT0("renderer", |
| 348 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer"); | 349 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer"); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 361 | 362 |
| 362 RenderWidgetHostViewPort* view = | 363 RenderWidgetHostViewPort* view = |
| 363 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); | 364 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); |
| 364 if (!view) | 365 if (!view) |
| 365 return; | 366 return; |
| 366 | 367 |
| 367 delayed_send.Cancel(); | 368 delayed_send.Cancel(); |
| 368 | 369 |
| 369 // View must send ACK message after next composite. | 370 // View must send ACK message after next composite. |
| 370 view->AcceleratedSurfacePostSubBuffer(params, host_id_); | 371 view->AcceleratedSurfacePostSubBuffer(params, host_id_); |
| 372 view->DidReceiveRendererFrame(); |
| 371 } | 373 } |
| 372 | 374 |
| 373 void GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend(int32 surface_id) { | 375 void GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend(int32 surface_id) { |
| 374 TRACE_EVENT0("renderer", | 376 TRACE_EVENT0("renderer", |
| 375 "GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend"); | 377 "GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend"); |
| 376 | 378 |
| 377 RenderWidgetHostViewPort* view = | 379 RenderWidgetHostViewPort* view = |
| 378 GetRenderWidgetHostViewFromSurfaceID(surface_id); | 380 GetRenderWidgetHostViewFromSurfaceID(surface_id); |
| 379 if (!view) | 381 if (!view) |
| 380 return; | 382 return; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 391 view->AcceleratedSurfaceRelease(); | 393 view->AcceleratedSurfaceRelease(); |
| 392 } | 394 } |
| 393 | 395 |
| 394 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 396 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
| 395 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 397 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
| 396 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 398 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
| 397 video_memory_usage_stats); | 399 video_memory_usage_stats); |
| 398 } | 400 } |
| 399 | 401 |
| 400 } // namespace content | 402 } // namespace content |
| OLD | NEW |