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