| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 return base::TimeDelta::FromMilliseconds(delay); | 300 return base::TimeDelta::FromMilliseconds(delay); |
| 301 } | 301 } |
| 302 | 302 |
| 303 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( | 303 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( |
| 304 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { | 304 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { |
| 305 TRACE_EVENT0("renderer", | 305 TRACE_EVENT0("renderer", |
| 306 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); | 306 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); |
| 307 | 307 |
| 308 ScopedSendOnIOThread delayed_send( | 308 ScopedSendOnIOThread delayed_send( |
| 309 host_id_, | 309 host_id_, |
| 310 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, 0)); | 310 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, false, 0)); |
| 311 | 311 |
| 312 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( | 312 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( |
| 313 params.surface_id); | 313 params.surface_id); |
| 314 if (!view) | 314 if (!view) |
| 315 return; | 315 return; |
| 316 | 316 |
| 317 delayed_send.Cancel(); | 317 delayed_send.Cancel(); |
| 318 | 318 |
| 319 static const base::TimeDelta swap_delay = GetSwapDelay(); | 319 static const base::TimeDelta swap_delay = GetSwapDelay(); |
| 320 if (swap_delay.ToInternalValue()) | 320 if (swap_delay.ToInternalValue()) |
| 321 base::PlatformThread::Sleep(swap_delay); | 321 base::PlatformThread::Sleep(swap_delay); |
| 322 | 322 |
| 323 // View must send ACK message after next composite. | 323 // View must send ACK message after next composite. |
| 324 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); | 324 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); |
| 325 } | 325 } |
| 326 | 326 |
| 327 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( | 327 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( |
| 328 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { | 328 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { |
| 329 TRACE_EVENT0("renderer", | 329 TRACE_EVENT0("renderer", |
| 330 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer"); | 330 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer"); |
| 331 | 331 |
| 332 ScopedSendOnIOThread delayed_send( | 332 ScopedSendOnIOThread delayed_send( |
| 333 host_id_, | 333 host_id_, |
| 334 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, 0)); | 334 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, false, 0)); |
| 335 | 335 |
| 336 RenderWidgetHostViewPort* view = | 336 RenderWidgetHostViewPort* view = |
| 337 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); | 337 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); |
| 338 if (!view) | 338 if (!view) |
| 339 return; | 339 return; |
| 340 | 340 |
| 341 delayed_send.Cancel(); | 341 delayed_send.Cancel(); |
| 342 | 342 |
| 343 // View must send ACK message after next composite. | 343 // View must send ACK message after next composite. |
| 344 view->AcceleratedSurfacePostSubBuffer(params, host_id_); | 344 view->AcceleratedSurfacePostSubBuffer(params, host_id_); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 364 return; | 364 return; |
| 365 view->AcceleratedSurfaceRelease(params.identifier); | 365 view->AcceleratedSurfaceRelease(params.identifier); |
| 366 } | 366 } |
| 367 | 367 |
| 368 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 368 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
| 369 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 369 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
| 370 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 370 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
| 371 video_memory_usage_stats); | 371 video_memory_usage_stats); |
| 372 } | 372 } |
| 373 | 373 |
| OLD | NEW |