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

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

Issue 140663003: Removed requirement for the renderer to know it's process ID (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased and addressed feedback from jamesr@ Created 6 years, 11 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 params.surface_id); 303 params.surface_id);
304 if (!view) 304 if (!view)
305 return; 305 return;
306 306
307 delayed_send.Cancel(); 307 delayed_send.Cancel();
308 308
309 static const base::TimeDelta swap_delay = GetSwapDelay(); 309 static const base::TimeDelta swap_delay = GetSwapDelay();
310 if (swap_delay.ToInternalValue()) 310 if (swap_delay.ToInternalValue())
311 base::PlatformThread::Sleep(swap_delay); 311 base::PlatformThread::Sleep(swap_delay);
312 312
313 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params view_params = params;
314
315 RenderWidgetHostImpl* impl =
316 RenderWidgetHostImpl::From(view->GetRenderWidgetHost());
317 for (size_t i = 0; i < view_params.latency_info.size(); i++) {
318 view_params.latency_info[i].FixMissingComponentIds(
319 impl->GetLatencyComponentId());
320 }
321
313 // View must send ACK message after next composite. 322 // View must send ACK message after next composite.
314 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); 323 view->AcceleratedSurfaceBuffersSwapped(view_params, host_id_);
315 view->DidReceiveRendererFrame(); 324 view->DidReceiveRendererFrame();
316 } 325 }
317 326
318 void GpuProcessHostUIShim::OnFrameDrawn( 327 void GpuProcessHostUIShim::OnFrameDrawn(
319 const std::vector<ui::LatencyInfo>& latency_info) { 328 const std::vector<ui::LatencyInfo>& latency_info) {
320 if (!ui::LatencyInfo::Verify(latency_info, 329 if (!ui::LatencyInfo::Verify(latency_info,
321 "GpuProcessHostUIShim::OnFrameDrawn")) 330 "GpuProcessHostUIShim::OnFrameDrawn"))
322 return; 331 return;
323 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); 332 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
324 } 333 }
(...skipping 17 matching lines...) Expand all
342 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM) 351 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM)
343 return; 352 return;
344 353
345 RenderWidgetHostViewPort* view = 354 RenderWidgetHostViewPort* view =
346 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); 355 GetRenderWidgetHostViewFromSurfaceID(params.surface_id);
347 if (!view) 356 if (!view)
348 return; 357 return;
349 358
350 delayed_send.Cancel(); 359 delayed_send.Cancel();
351 360
361 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params view_params = params;
362
363 RenderWidgetHostImpl* impl =
364 RenderWidgetHostImpl::From(view->GetRenderWidgetHost());
365 for (size_t i = 0; i < view_params.latency_info.size(); i++) {
366 view_params.latency_info[i].FixMissingComponentIds(
367 impl->GetLatencyComponentId());
368 }
369
352 // View must send ACK message after next composite. 370 // View must send ACK message after next composite.
353 view->AcceleratedSurfacePostSubBuffer(params, host_id_); 371 view->AcceleratedSurfacePostSubBuffer(view_params, host_id_);
354 view->DidReceiveRendererFrame(); 372 view->DidReceiveRendererFrame();
355 } 373 }
356 374
357 void GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend(int32 surface_id) { 375 void GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend(int32 surface_id) {
358 TRACE_EVENT0("renderer", 376 TRACE_EVENT0("renderer",
359 "GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend"); 377 "GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend");
360 378
361 RenderWidgetHostViewPort* view = 379 RenderWidgetHostViewPort* view =
362 GetRenderWidgetHostViewFromSurfaceID(surface_id); 380 GetRenderWidgetHostViewFromSurfaceID(surface_id);
363 if (!view) 381 if (!view)
(...skipping 11 matching lines...) Expand all
375 view->AcceleratedSurfaceRelease(); 393 view->AcceleratedSurfaceRelease();
376 } 394 }
377 395
378 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( 396 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived(
379 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { 397 const GPUVideoMemoryUsageStats& video_memory_usage_stats) {
380 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( 398 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats(
381 video_memory_usage_stats); 399 video_memory_usage_stats);
382 } 400 }
383 401
384 } // namespace content 402 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_process_host_impl.cc » ('j') | ui/events/latency_info.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698