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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.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: Rebase after long weekend 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 ack_params); 1493 ack_params);
1494 return; 1494 return;
1495 } 1495 }
1496 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; 1496 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params;
1497 gpu_params.surface_id = params.surface_id; 1497 gpu_params.surface_id = params.surface_id;
1498 gpu_params.surface_handle = params.surface_handle; 1498 gpu_params.surface_handle = params.surface_handle;
1499 gpu_params.route_id = params.route_id; 1499 gpu_params.route_id = params.route_id;
1500 gpu_params.size = params.size; 1500 gpu_params.size = params.size;
1501 gpu_params.scale_factor = params.scale_factor; 1501 gpu_params.scale_factor = params.scale_factor;
1502 gpu_params.latency_info = params.latency_info; 1502 gpu_params.latency_info = params.latency_info;
1503 for (size_t i = 0; i < gpu_params.latency_info.size(); i++)
1504 AddLatencyInfoComponentIds(&gpu_params.latency_info[i]);
1503 view_->AcceleratedSurfaceBuffersSwapped(gpu_params, 1505 view_->AcceleratedSurfaceBuffersSwapped(gpu_params,
1504 params.gpu_process_host_id); 1506 params.gpu_process_host_id);
1505 view_->DidReceiveRendererFrame(); 1507 view_->DidReceiveRendererFrame();
1506 } 1508 }
1507 #endif // OS_MACOSX 1509 #endif // OS_MACOSX
1508 1510
1509 bool RenderWidgetHostImpl::OnSwapCompositorFrame( 1511 bool RenderWidgetHostImpl::OnSwapCompositorFrame(
1510 const IPC::Message& message) { 1512 const IPC::Message& message) {
1511 ViewHostMsg_SwapCompositorFrame::Param param; 1513 ViewHostMsg_SwapCompositorFrame::Param param;
1512 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, &param)) 1514 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, &param))
1513 return false; 1515 return false;
1514 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); 1516 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame);
1515 uint32 output_surface_id = param.a; 1517 uint32 output_surface_id = param.a;
1516 param.b.AssignTo(frame.get()); 1518 param.b.AssignTo(frame.get());
1517 1519
1520 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++)
1521 AddLatencyInfoComponentIds(&frame->metadata.latency_info[i]);
1522
1518 input_router_->OnViewUpdated( 1523 input_router_->OnViewUpdated(
1519 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata)); 1524 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata));
1520 1525
1521 if (view_) { 1526 if (view_) {
1522 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); 1527 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass());
1523 view_->DidReceiveRendererFrame(); 1528 view_->DidReceiveRendererFrame();
1524 } else { 1529 } else {
1525 cc::CompositorFrameAck ack; 1530 cc::CompositorFrameAck ack;
1526 if (frame->gl_frame_data) { 1531 if (frame->gl_frame_data) {
1527 ack.gl_frame_data = frame->gl_frame_data.Pass(); 1532 ack.gl_frame_data = frame->gl_frame_data.Pass();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 NotificationService::NoDetails()); 1682 NotificationService::NoDetails());
1678 1683
1679 // We don't need to update the view if the view is hidden. We must do this 1684 // We don't need to update the view if the view is hidden. We must do this
1680 // early return after the ACK is sent, however, or the renderer will not send 1685 // early return after the ACK is sent, however, or the renderer will not send
1681 // us more data. 1686 // us more data.
1682 if (is_hidden_) 1687 if (is_hidden_)
1683 return; 1688 return;
1684 1689
1685 // Now paint the view. Watch out: it might be destroyed already. 1690 // Now paint the view. Watch out: it might be destroyed already.
1686 if (view_ && !is_accelerated_compositing_active_) { 1691 if (view_ && !is_accelerated_compositing_active_) {
1692
1693 std::vector<ui::LatencyInfo> latency_info;
1694 for (size_t i = 0; i < params.latency_info.size(); i++) {
1695 ui::LatencyInfo info = params.latency_info[i];
1696 AddLatencyInfoComponentIds(&info);
1697 latency_info.push_back(info);
1698 }
1699
1687 view_being_painted_ = true; 1700 view_being_painted_ = true;
1688 view_->DidUpdateBackingStore(params.scroll_rect, params.scroll_delta, 1701 view_->DidUpdateBackingStore(params.scroll_rect, params.scroll_delta,
1689 params.copy_rects, params.latency_info); 1702 params.copy_rects, latency_info);
1690 view_->DidReceiveRendererFrame(); 1703 view_->DidReceiveRendererFrame();
1691 view_being_painted_ = false; 1704 view_being_painted_ = false;
1692 } 1705 }
1693 1706
1694 // If we got a resize ack, then perhaps we have another resize to send? 1707 // If we got a resize ack, then perhaps we have another resize to send?
1695 bool is_resize_ack = 1708 bool is_resize_ack =
1696 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); 1709 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags);
1697 if (is_resize_ack) 1710 if (is_resize_ack)
1698 WasResized(); 1711 WasResized();
1699 1712
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
2512 continue; 2525 continue;
2513 } 2526 }
2514 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); 2527 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh);
2515 if (rwhi_set.insert(rwhi).second) 2528 if (rwhi_set.insert(rwhi).second)
2516 rwhi->FrameSwapped(latency_info[i]); 2529 rwhi->FrameSwapped(latency_info[i]);
2517 } 2530 }
2518 } 2531 }
2519 } 2532 }
2520 } 2533 }
2521 2534
2535 void RenderWidgetHostImpl::AddLatencyInfoComponentIds(
2536 ui::LatencyInfo* latency_info) {
2537 ui::LatencyInfo::LatencyMap new_components;
2538 ui::LatencyInfo::LatencyMap::iterator lc =
2539 latency_info->latency_components.begin();
2540 while (lc != latency_info->latency_components.end()) {
2541 ui::LatencyComponentType component_type = lc->first.first;
2542 if (component_type == ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT) {
2543 // Generate a new component entry with the correct component ID
2544 ui::LatencyInfo::LatencyMap::key_type key =
2545 std::make_pair(component_type, GetLatencyComponentId());
2546 new_components[key] = lc->second;
2547
2548 // Remove the old entry
2549 latency_info->latency_components.erase(lc++);
2550 } else {
2551 ++lc;
2552 }
2553 }
2554
2555 // Add newly generated components into the latency info
2556 for (lc = new_components.begin(); lc != new_components.end(); ++lc) {
2557 latency_info->latency_components[lc->first] = lc->second;
2558 }
2559 }
2560
2522 } // namespace content 2561 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698