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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 TRACE_EVENT0("renderer", | 315 TRACE_EVENT0("renderer", |
316 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); | 316 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); |
317 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 317 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
318 ack_params.mailbox_name = params.mailbox_name; | 318 ack_params.mailbox_name = params.mailbox_name; |
319 ack_params.sync_point = 0; | 319 ack_params.sync_point = 0; |
320 ScopedSendOnIOThread delayed_send( | 320 ScopedSendOnIOThread delayed_send( |
321 host_id_, | 321 host_id_, |
322 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, | 322 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, |
323 ack_params)); | 323 ack_params)); |
324 | 324 |
| 325 if (!params.mailbox_name.empty() && |
| 326 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM) |
| 327 return; |
| 328 |
325 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( | 329 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( |
326 params.surface_id); | 330 params.surface_id); |
327 if (!view) | 331 if (!view) |
328 return; | 332 return; |
329 | 333 |
330 delayed_send.Cancel(); | 334 delayed_send.Cancel(); |
331 | 335 |
332 static const base::TimeDelta swap_delay = GetSwapDelay(); | 336 static const base::TimeDelta swap_delay = GetSwapDelay(); |
333 if (swap_delay.ToInternalValue()) | 337 if (swap_delay.ToInternalValue()) |
334 base::PlatformThread::Sleep(swap_delay); | 338 base::PlatformThread::Sleep(swap_delay); |
335 | 339 |
336 // View must send ACK message after next composite. | 340 // View must send ACK message after next composite. |
337 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); | 341 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); |
338 } | 342 } |
339 | 343 |
340 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( | 344 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( |
341 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { | 345 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { |
342 TRACE_EVENT0("renderer", | 346 TRACE_EVENT0("renderer", |
343 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer"); | 347 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer"); |
344 | 348 |
345 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 349 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
346 ack_params.mailbox_name = params.mailbox_name; | 350 ack_params.mailbox_name = params.mailbox_name; |
347 ack_params.sync_point = 0; | 351 ack_params.sync_point = 0; |
348 ScopedSendOnIOThread delayed_send( | 352 ScopedSendOnIOThread delayed_send( |
349 host_id_, | 353 host_id_, |
350 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, | 354 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, |
351 ack_params)); | 355 ack_params)); |
352 | 356 |
| 357 if (!params.mailbox_name.empty() && |
| 358 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM) |
| 359 return; |
| 360 |
353 RenderWidgetHostViewPort* view = | 361 RenderWidgetHostViewPort* view = |
354 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); | 362 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); |
355 if (!view) | 363 if (!view) |
356 return; | 364 return; |
357 | 365 |
358 delayed_send.Cancel(); | 366 delayed_send.Cancel(); |
359 | 367 |
360 // View must send ACK message after next composite. | 368 // View must send ACK message after next composite. |
361 view->AcceleratedSurfacePostSubBuffer(params, host_id_); | 369 view->AcceleratedSurfacePostSubBuffer(params, host_id_); |
362 } | 370 } |
(...skipping 19 matching lines...) Expand all Loading... |
382 view->AcceleratedSurfaceRelease(); | 390 view->AcceleratedSurfaceRelease(); |
383 } | 391 } |
384 | 392 |
385 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 393 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
386 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 394 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
387 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 395 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
388 video_memory_usage_stats); | 396 video_memory_usage_stats); |
389 } | 397 } |
390 | 398 |
391 } // namespace content | 399 } // namespace content |
OLD | NEW |