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

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: 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/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 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 ack_params); 1491 ack_params);
1492 return; 1492 return;
1493 } 1493 }
1494 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; 1494 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params;
1495 gpu_params.surface_id = params.surface_id; 1495 gpu_params.surface_id = params.surface_id;
1496 gpu_params.surface_handle = params.surface_handle; 1496 gpu_params.surface_handle = params.surface_handle;
1497 gpu_params.route_id = params.route_id; 1497 gpu_params.route_id = params.route_id;
1498 gpu_params.size = params.size; 1498 gpu_params.size = params.size;
1499 gpu_params.scale_factor = params.scale_factor; 1499 gpu_params.scale_factor = params.scale_factor;
1500 gpu_params.latency_info = params.latency_info; 1500 gpu_params.latency_info = params.latency_info;
1501 gpu_params.latency_info.FixMissingComponentIds(GetLatencyComponentId());
1501 view_->AcceleratedSurfaceBuffersSwapped(gpu_params, 1502 view_->AcceleratedSurfaceBuffersSwapped(gpu_params,
1502 params.gpu_process_host_id); 1503 params.gpu_process_host_id);
1503 view_->DidReceiveRendererFrame(); 1504 view_->DidReceiveRendererFrame();
1504 } 1505 }
1505 #endif // OS_MACOSX 1506 #endif // OS_MACOSX
1506 1507
1507 bool RenderWidgetHostImpl::OnSwapCompositorFrame( 1508 bool RenderWidgetHostImpl::OnSwapCompositorFrame(
1508 const IPC::Message& message) { 1509 const IPC::Message& message) {
1509 ViewHostMsg_SwapCompositorFrame::Param param; 1510 ViewHostMsg_SwapCompositorFrame::Param param;
1510 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, &param)) 1511 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, &param))
1511 return false; 1512 return false;
1512 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); 1513 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame);
1513 uint32 output_surface_id = param.a; 1514 uint32 output_surface_id = param.a;
1514 param.b.AssignTo(frame.get()); 1515 param.b.AssignTo(frame.get());
1515 1516
1517 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) {
1518 frame->metadata.latency_info[i].FixMissingComponentIds(
1519 GetLatencyComponentId());
1520 }
1521
1516 input_router_->OnViewUpdated( 1522 input_router_->OnViewUpdated(
1517 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata)); 1523 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata));
1518 1524
1519 if (view_) { 1525 if (view_) {
1520 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); 1526 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass());
1521 view_->DidReceiveRendererFrame(); 1527 view_->DidReceiveRendererFrame();
1522 } else { 1528 } else {
1523 cc::CompositorFrameAck ack; 1529 cc::CompositorFrameAck ack;
1524 if (frame->gl_frame_data) { 1530 if (frame->gl_frame_data) {
1525 ack.gl_frame_data = frame->gl_frame_data.Pass(); 1531 ack.gl_frame_data = frame->gl_frame_data.Pass();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 NotificationService::NoDetails()); 1676 NotificationService::NoDetails());
1671 1677
1672 // We don't need to update the view if the view is hidden. We must do this 1678 // We don't need to update the view if the view is hidden. We must do this
1673 // early return after the ACK is sent, however, or the renderer will not send 1679 // early return after the ACK is sent, however, or the renderer will not send
1674 // us more data. 1680 // us more data.
1675 if (is_hidden_) 1681 if (is_hidden_)
1676 return; 1682 return;
1677 1683
1678 // Now paint the view. Watch out: it might be destroyed already. 1684 // Now paint the view. Watch out: it might be destroyed already.
1679 if (view_ && !is_accelerated_compositing_active_) { 1685 if (view_ && !is_accelerated_compositing_active_) {
1686
1687 std::vector<ui::LatencyInfo> latency_info;
1688 for (size_t i = 0; i < params.latency_info.size(); i++) {
1689 ui::LatencyInfo info = params.latency_info[i];
1690 info.FixMissingComponentIds(GetLatencyComponentId());
1691 latency_info.push_back(info);
1692 }
1693
1680 view_being_painted_ = true; 1694 view_being_painted_ = true;
1681 view_->DidUpdateBackingStore(params.scroll_rect, params.scroll_delta, 1695 view_->DidUpdateBackingStore(params.scroll_rect, params.scroll_delta,
1682 params.copy_rects, params.latency_info); 1696 params.copy_rects, latency_info);
1683 view_->DidReceiveRendererFrame(); 1697 view_->DidReceiveRendererFrame();
1684 view_being_painted_ = false; 1698 view_being_painted_ = false;
1685 } 1699 }
1686 1700
1687 // If we got a resize ack, then perhaps we have another resize to send? 1701 // If we got a resize ack, then perhaps we have another resize to send?
1688 bool is_resize_ack = 1702 bool is_resize_ack =
1689 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); 1703 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags);
1690 if (is_resize_ack) 1704 if (is_resize_ack)
1691 WasResized(); 1705 WasResized();
1692 1706
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 } 2520 }
2507 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); 2521 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh);
2508 if (rwhi_set.insert(rwhi).second) 2522 if (rwhi_set.insert(rwhi).second)
2509 rwhi->FrameSwapped(latency_info[i]); 2523 rwhi->FrameSwapped(latency_info[i]);
2510 } 2524 }
2511 } 2525 }
2512 } 2526 }
2513 } 2527 }
2514 2528
2515 } // namespace content 2529 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698