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

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: Fixed Windows 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 params.surface_id); 300 params.surface_id);
301 if (!view) 301 if (!view)
302 return; 302 return;
303 303
304 delayed_send.Cancel(); 304 delayed_send.Cancel();
305 305
306 static const base::TimeDelta swap_delay = GetSwapDelay(); 306 static const base::TimeDelta swap_delay = GetSwapDelay();
307 if (swap_delay.ToInternalValue()) 307 if (swap_delay.ToInternalValue())
308 base::PlatformThread::Sleep(swap_delay); 308 base::PlatformThread::Sleep(swap_delay);
309 309
310 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params view_params = params;
311
312 RenderWidgetHostImpl* impl =
313 RenderWidgetHostImpl::From(view->GetRenderWidgetHost());
314 view_params.latency_info.AnnotateComponentsWithProcessId(
315 impl->GetProcess()->GetID());
316
310 // View must send ACK message after next composite. 317 // View must send ACK message after next composite.
311 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); 318 view->AcceleratedSurfaceBuffersSwapped(view_params, host_id_);
312 view->DidReceiveRendererFrame(); 319 view->DidReceiveRendererFrame();
313 } 320 }
314 321
315 void GpuProcessHostUIShim::OnFrameDrawn(const ui::LatencyInfo& latency_info) { 322 void GpuProcessHostUIShim::OnFrameDrawn(const ui::LatencyInfo& latency_info) {
316 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); 323 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
317 } 324 }
318 325
319 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( 326 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer(
320 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { 327 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) {
321 TRACE_EVENT0("renderer", 328 TRACE_EVENT0("renderer",
322 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer"); 329 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer");
323
324 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; 330 AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
325 ack_params.mailbox_name = params.mailbox_name; 331 ack_params.mailbox_name = params.mailbox_name;
326 ack_params.sync_point = 0; 332 ack_params.sync_point = 0;
327 ScopedSendOnIOThread delayed_send( 333 ScopedSendOnIOThread delayed_send(
328 host_id_, 334 host_id_,
329 new AcceleratedSurfaceMsg_BufferPresented(params.route_id, 335 new AcceleratedSurfaceMsg_BufferPresented(params.route_id,
330 ack_params)); 336 ack_params));
331 337
332 if (!params.mailbox_name.empty() && 338 if (!params.mailbox_name.empty() &&
333 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM) 339 params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM)
334 return; 340 return;
335 341
336 RenderWidgetHostViewPort* view = 342 RenderWidgetHostViewPort* view =
337 GetRenderWidgetHostViewFromSurfaceID(params.surface_id); 343 GetRenderWidgetHostViewFromSurfaceID(params.surface_id);
338 if (!view) 344 if (!view)
339 return; 345 return;
340 346
341 delayed_send.Cancel(); 347 delayed_send.Cancel();
342 348
349 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params view_params = params;
350
351 RenderWidgetHostImpl* impl = RenderWidgetHostImpl::From(
352 view->GetRenderWidgetHost());
353 view_params.latency_info.AnnotateComponentsWithProcessId(
354 impl->GetProcess()->GetID());
355
343 // View must send ACK message after next composite. 356 // View must send ACK message after next composite.
344 view->AcceleratedSurfacePostSubBuffer(params, host_id_); 357 view->AcceleratedSurfacePostSubBuffer(view_params, host_id_);
345 view->DidReceiveRendererFrame(); 358 view->DidReceiveRendererFrame();
346 } 359 }
347 360
348 void GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend(int32 surface_id) { 361 void GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend(int32 surface_id) {
349 TRACE_EVENT0("renderer", 362 TRACE_EVENT0("renderer",
350 "GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend"); 363 "GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend");
351 364
352 RenderWidgetHostViewPort* view = 365 RenderWidgetHostViewPort* view =
353 GetRenderWidgetHostViewFromSurfaceID(surface_id); 366 GetRenderWidgetHostViewFromSurfaceID(surface_id);
354 if (!view) 367 if (!view)
(...skipping 11 matching lines...) Expand all
366 view->AcceleratedSurfaceRelease(); 379 view->AcceleratedSurfaceRelease();
367 } 380 }
368 381
369 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( 382 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived(
370 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { 383 const GPUVideoMemoryUsageStats& video_memory_usage_stats) {
371 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( 384 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats(
372 video_memory_usage_stats); 385 video_memory_usage_stats);
373 } 386 }
374 387
375 } // namespace content 388 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_process_host_impl.cc » ('j') | content/renderer/render_view_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698