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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 params.surface_id); | 303 params.surface_id); |
304 if (!view) | 304 if (!view) |
305 return; | 305 return; |
306 | 306 |
307 delayed_send.Cancel(); | 307 delayed_send.Cancel(); |
308 | 308 |
309 static const base::TimeDelta swap_delay = GetSwapDelay(); | 309 static const base::TimeDelta swap_delay = GetSwapDelay(); |
310 if (swap_delay.ToInternalValue()) | 310 if (swap_delay.ToInternalValue()) |
311 base::PlatformThread::Sleep(swap_delay); | 311 base::PlatformThread::Sleep(swap_delay); |
312 | 312 |
| 313 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params view_params = params; |
| 314 |
| 315 RenderWidgetHostImpl* impl = |
| 316 RenderWidgetHostImpl::From(view->GetRenderWidgetHost()); |
| 317 for (size_t i = 0; i < view_params.latency_info.size(); i++) |
| 318 impl->AddLatencyInfoComponentIds(&view_params.latency_info[i]); |
| 319 |
313 // View must send ACK message after next composite. | 320 // View must send ACK message after next composite. |
314 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); | 321 view->AcceleratedSurfaceBuffersSwapped(view_params, host_id_); |
315 view->DidReceiveRendererFrame(); | 322 view->DidReceiveRendererFrame(); |
316 } | 323 } |
317 | 324 |
318 void GpuProcessHostUIShim::OnFrameDrawn( | 325 void GpuProcessHostUIShim::OnFrameDrawn( |
319 const std::vector<ui::LatencyInfo>& latency_info) { | 326 const std::vector<ui::LatencyInfo>& latency_info) { |
320 if (!ui::LatencyInfo::Verify(latency_info, | 327 if (!ui::LatencyInfo::Verify(latency_info, |
321 "GpuProcessHostUIShim::OnFrameDrawn")) | 328 "GpuProcessHostUIShim::OnFrameDrawn")) |
322 return; | 329 return; |
323 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); | 330 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); |
324 } | 331 } |
(...skipping 17 matching lines...) Expand all Loading... |
342 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM) | 349 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM) |
343 return; | 350 return; |
344 | 351 |
345 RenderWidgetHostViewPort* view = | 352 RenderWidgetHostViewPort* view = |
346 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); | 353 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); |
347 if (!view) | 354 if (!view) |
348 return; | 355 return; |
349 | 356 |
350 delayed_send.Cancel(); | 357 delayed_send.Cancel(); |
351 | 358 |
| 359 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params view_params = params; |
| 360 |
| 361 RenderWidgetHostImpl* impl = |
| 362 RenderWidgetHostImpl::From(view->GetRenderWidgetHost()); |
| 363 for (size_t i = 0; i < view_params.latency_info.size(); i++) |
| 364 impl->AddLatencyInfoComponentIds(&view_params.latency_info[i]); |
| 365 |
352 // View must send ACK message after next composite. | 366 // View must send ACK message after next composite. |
353 view->AcceleratedSurfacePostSubBuffer(params, host_id_); | 367 view->AcceleratedSurfacePostSubBuffer(view_params, host_id_); |
354 view->DidReceiveRendererFrame(); | 368 view->DidReceiveRendererFrame(); |
355 } | 369 } |
356 | 370 |
357 void GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend(int32 surface_id) { | 371 void GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend(int32 surface_id) { |
358 TRACE_EVENT0("renderer", | 372 TRACE_EVENT0("renderer", |
359 "GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend"); | 373 "GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend"); |
360 | 374 |
361 RenderWidgetHostViewPort* view = | 375 RenderWidgetHostViewPort* view = |
362 GetRenderWidgetHostViewFromSurfaceID(surface_id); | 376 GetRenderWidgetHostViewFromSurfaceID(surface_id); |
363 if (!view) | 377 if (!view) |
(...skipping 11 matching lines...) Expand all Loading... |
375 view->AcceleratedSurfaceRelease(); | 389 view->AcceleratedSurfaceRelease(); |
376 } | 390 } |
377 | 391 |
378 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 392 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
379 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 393 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
380 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 394 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
381 video_memory_usage_stats); | 395 video_memory_usage_stats); |
382 } | 396 } |
383 | 397 |
384 } // namespace content | 398 } // namespace content |
OLD | NEW |