| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 GetRenderWidgetHostViewFromSurfaceID(surface_id); | 277 GetRenderWidgetHostViewFromSurfaceID(surface_id); |
| 278 if (!view) | 278 if (!view) |
| 279 return; | 279 return; |
| 280 view->AcceleratedSurfaceInitialized(host_id_, route_id); | 280 view->AcceleratedSurfaceInitialized(host_id_, route_id); |
| 281 } | 281 } |
| 282 | 282 |
| 283 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( | 283 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( |
| 284 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { | 284 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { |
| 285 TRACE_EVENT0("renderer", | 285 TRACE_EVENT0("renderer", |
| 286 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); | 286 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); |
| 287 if (!ui::LatencyInfo::Verify(params.latency_info, |
| 288 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) |
| 289 return; |
| 287 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 290 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 288 ack_params.mailbox_name = params.mailbox_name; | 291 ack_params.mailbox_name = params.mailbox_name; |
| 289 ack_params.sync_point = 0; | 292 ack_params.sync_point = 0; |
| 290 ScopedSendOnIOThread delayed_send( | 293 ScopedSendOnIOThread delayed_send( |
| 291 host_id_, | 294 host_id_, |
| 292 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, | 295 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, |
| 293 ack_params)); | 296 ack_params)); |
| 294 | 297 |
| 295 if (!params.mailbox_name.empty() && | 298 if (!params.mailbox_name.empty() && |
| 296 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM) | 299 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM) |
| 297 return; | 300 return; |
| 298 | 301 |
| 299 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( | 302 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( |
| 300 params.surface_id); | 303 params.surface_id); |
| 301 if (!view) | 304 if (!view) |
| 302 return; | 305 return; |
| 303 | 306 |
| 304 delayed_send.Cancel(); | 307 delayed_send.Cancel(); |
| 305 | 308 |
| 306 static const base::TimeDelta swap_delay = GetSwapDelay(); | 309 static const base::TimeDelta swap_delay = GetSwapDelay(); |
| 307 if (swap_delay.ToInternalValue()) | 310 if (swap_delay.ToInternalValue()) |
| 308 base::PlatformThread::Sleep(swap_delay); | 311 base::PlatformThread::Sleep(swap_delay); |
| 309 | 312 |
| 310 // View must send ACK message after next composite. | 313 // View must send ACK message after next composite. |
| 311 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); | 314 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); |
| 312 view->DidReceiveRendererFrame(); | 315 view->DidReceiveRendererFrame(); |
| 313 } | 316 } |
| 314 | 317 |
| 315 void GpuProcessHostUIShim::OnFrameDrawn(const ui::LatencyInfo& latency_info) { | 318 void GpuProcessHostUIShim::OnFrameDrawn( |
| 319 const std::vector<ui::LatencyInfo>& latency_info) { |
| 320 if (!ui::LatencyInfo::Verify(latency_info, |
| 321 "GpuProcessHostUIShim::OnFrameDrawn")) |
| 322 return; |
| 316 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); | 323 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); |
| 317 } | 324 } |
| 318 | 325 |
| 319 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( | 326 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( |
| 320 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { | 327 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { |
| 321 TRACE_EVENT0("renderer", | 328 TRACE_EVENT0("renderer", |
| 322 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer"); | 329 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer"); |
| 323 | 330 if (!ui::LatencyInfo::Verify(params.latency_info, |
| 331 "GpuHostMsg_AcceleratedSurfacePostSubBuffer")) |
| 332 return; |
| 324 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 333 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 325 ack_params.mailbox_name = params.mailbox_name; | 334 ack_params.mailbox_name = params.mailbox_name; |
| 326 ack_params.sync_point = 0; | 335 ack_params.sync_point = 0; |
| 327 ScopedSendOnIOThread delayed_send( | 336 ScopedSendOnIOThread delayed_send( |
| 328 host_id_, | 337 host_id_, |
| 329 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, | 338 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, |
| 330 ack_params)); | 339 ack_params)); |
| 331 | 340 |
| 332 if (!params.mailbox_name.empty() && | 341 if (!params.mailbox_name.empty() && |
| 333 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM) | 342 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM) |
| 334 return; | 343 return; |
| 335 | 344 |
| 336 RenderWidgetHostViewPort* view = | 345 RenderWidgetHostViewPort* view = |
| 337 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); | 346 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 366 view->AcceleratedSurfaceRelease(); | 375 view->AcceleratedSurfaceRelease(); |
| 367 } | 376 } |
| 368 | 377 |
| 369 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 378 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
| 370 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 379 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
| 371 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 380 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
| 372 video_memory_usage_stats); | 381 video_memory_usage_stats); |
| 373 } | 382 } |
| 374 | 383 |
| 375 } // namespace content | 384 } // namespace content |
| OLD | NEW |