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

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

Powered by Google App Engine
This is Rietveld 408576698