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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 287 if (!ui::LatencyInfo::Verify(params.latency_info, |
288 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) | 288 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) |
289 return; | 289 return; |
290 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 290 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
291 ack_params.mailbox_name = params.mailbox_name; | 291 ack_params.mailbox = params.mailbox; |
292 ack_params.sync_point = 0; | 292 ack_params.sync_point = 0; |
293 ScopedSendOnIOThread delayed_send( | 293 ScopedSendOnIOThread delayed_send( |
294 host_id_, | 294 host_id_, |
295 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, | 295 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, |
296 ack_params)); | 296 ack_params)); |
297 | 297 |
298 if (!params.mailbox_name.empty() && | |
299 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM) | |
300 return; | |
301 | |
302 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( | 298 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( |
303 params.surface_id); | 299 params.surface_id); |
304 if (!view) | 300 if (!view) |
305 return; | 301 return; |
306 | 302 |
307 delayed_send.Cancel(); | 303 delayed_send.Cancel(); |
308 | 304 |
309 static const base::TimeDelta swap_delay = GetSwapDelay(); | 305 static const base::TimeDelta swap_delay = GetSwapDelay(); |
310 if (swap_delay.ToInternalValue()) | 306 if (swap_delay.ToInternalValue()) |
311 base::PlatformThread::Sleep(swap_delay); | 307 base::PlatformThread::Sleep(swap_delay); |
(...skipping 19 matching lines...) Expand all Loading... |
331 } | 327 } |
332 | 328 |
333 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( | 329 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( |
334 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { | 330 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { |
335 TRACE_EVENT0("renderer", | 331 TRACE_EVENT0("renderer", |
336 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer"); | 332 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer"); |
337 if (!ui::LatencyInfo::Verify(params.latency_info, | 333 if (!ui::LatencyInfo::Verify(params.latency_info, |
338 "GpuHostMsg_AcceleratedSurfacePostSubBuffer")) | 334 "GpuHostMsg_AcceleratedSurfacePostSubBuffer")) |
339 return; | 335 return; |
340 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 336 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
341 ack_params.mailbox_name = params.mailbox_name; | 337 ack_params.mailbox = params.mailbox; |
342 ack_params.sync_point = 0; | 338 ack_params.sync_point = 0; |
343 ScopedSendOnIOThread delayed_send( | 339 ScopedSendOnIOThread delayed_send( |
344 host_id_, | 340 host_id_, |
345 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, | 341 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, |
346 ack_params)); | 342 ack_params)); |
347 | 343 |
348 if (!params.mailbox_name.empty() && | |
349 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM) | |
350 return; | |
351 | |
352 RenderWidgetHostViewPort* view = | 344 RenderWidgetHostViewPort* view = |
353 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); | 345 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); |
354 if (!view) | 346 if (!view) |
355 return; | 347 return; |
356 | 348 |
357 delayed_send.Cancel(); | 349 delayed_send.Cancel(); |
358 | 350 |
359 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params view_params = params; | 351 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params view_params = params; |
360 | 352 |
361 RenderWidgetHostImpl* impl = | 353 RenderWidgetHostImpl* impl = |
(...skipping 27 matching lines...) Expand all Loading... |
389 view->AcceleratedSurfaceRelease(); | 381 view->AcceleratedSurfaceRelease(); |
390 } | 382 } |
391 | 383 |
392 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 384 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
393 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 385 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
394 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 386 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
395 video_memory_usage_stats); | 387 video_memory_usage_stats); |
396 } | 388 } |
397 | 389 |
398 } // namespace content | 390 } // namespace content |
OLD | NEW |