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