Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: content/browser/gpu/gpu_process_host_ui_shim.cc

Issue 12440005: Use gpu::Mailbox in IPCs instead of std::string (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 TRACE_EVENT0("renderer", 314 TRACE_EVENT0("renderer",
315 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); 315 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped");
316 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; 316 AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
317 ack_params.mailbox_name = params.mailbox_name; 317 ack_params.mailbox_name = params.mailbox_name;
318 ack_params.sync_point = 0; 318 ack_params.sync_point = 0;
319 ScopedSendOnIOThread delayed_send( 319 ScopedSendOnIOThread delayed_send(
320 host_id_, 320 host_id_,
321 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, 321 new AcceleratedSurfaceMsg_BufferPresented(params.route_id,
322 ack_params)); 322 ack_params));
323 323
324 if (!params.mailbox_name.empty() &&
325 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM)
326 return;
327
328 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( 324 RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID(
329 params.surface_id); 325 params.surface_id);
330 if (!view) 326 if (!view)
331 return; 327 return;
332 328
333 delayed_send.Cancel(); 329 delayed_send.Cancel();
334 330
335 static const base::TimeDelta swap_delay = GetSwapDelay(); 331 static const base::TimeDelta swap_delay = GetSwapDelay();
336 if (swap_delay.ToInternalValue()) 332 if (swap_delay.ToInternalValue())
337 base::PlatformThread::Sleep(swap_delay); 333 base::PlatformThread::Sleep(swap_delay);
338 334
339 // View must send ACK message after next composite. 335 // View must send ACK message after next composite.
340 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); 336 view->AcceleratedSurfaceBuffersSwapped(params, host_id_);
341 } 337 }
342 338
343 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( 339 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer(
344 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { 340 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) {
345 TRACE_EVENT0("renderer", 341 TRACE_EVENT0("renderer",
346 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer"); 342 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer");
347 343
348 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; 344 AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
349 ack_params.mailbox_name = params.mailbox_name; 345 ack_params.mailbox_name = params.mailbox_name;
350 ack_params.sync_point = 0; 346 ack_params.sync_point = 0;
351 ScopedSendOnIOThread delayed_send( 347 ScopedSendOnIOThread delayed_send(
352 host_id_, 348 host_id_,
353 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, 349 new AcceleratedSurfaceMsg_BufferPresented(params.route_id,
354 ack_params)); 350 ack_params));
355 351
356 if (!params.mailbox_name.empty() &&
357 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM)
358 return;
359
360 RenderWidgetHostViewPort* view = 352 RenderWidgetHostViewPort* view =
361 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); 353 GetRenderWidgetHostViewFromSurfaceID(params.surface_id);
362 if (!view) 354 if (!view)
363 return; 355 return;
364 356
365 delayed_send.Cancel(); 357 delayed_send.Cancel();
366 358
367 // View must send ACK message after next composite. 359 // View must send ACK message after next composite.
368 view->AcceleratedSurfacePostSubBuffer(params, host_id_); 360 view->AcceleratedSurfacePostSubBuffer(params, host_id_);
369 } 361 }
(...skipping 19 matching lines...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698