| OLD | NEW |
| 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 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 ack_params); | 1471 ack_params); |
| 1472 return; | 1472 return; |
| 1473 } | 1473 } |
| 1474 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; | 1474 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; |
| 1475 gpu_params.surface_id = params.surface_id; | 1475 gpu_params.surface_id = params.surface_id; |
| 1476 gpu_params.surface_handle = params.surface_handle; | 1476 gpu_params.surface_handle = params.surface_handle; |
| 1477 gpu_params.route_id = params.route_id; | 1477 gpu_params.route_id = params.route_id; |
| 1478 gpu_params.size = params.size; | 1478 gpu_params.size = params.size; |
| 1479 gpu_params.scale_factor = params.scale_factor; | 1479 gpu_params.scale_factor = params.scale_factor; |
| 1480 gpu_params.latency_info = params.latency_info; | 1480 gpu_params.latency_info = params.latency_info; |
| 1481 gpu_params.latency_info.AnnotateComponentsWithProcessId(process_->GetID()); |
| 1481 view_->AcceleratedSurfaceBuffersSwapped(gpu_params, | 1482 view_->AcceleratedSurfaceBuffersSwapped(gpu_params, |
| 1482 params.gpu_process_host_id); | 1483 params.gpu_process_host_id); |
| 1483 view_->DidReceiveRendererFrame(); | 1484 view_->DidReceiveRendererFrame(); |
| 1484 } | 1485 } |
| 1485 #endif // OS_MACOSX | 1486 #endif // OS_MACOSX |
| 1486 | 1487 |
| 1487 bool RenderWidgetHostImpl::OnSwapCompositorFrame( | 1488 bool RenderWidgetHostImpl::OnSwapCompositorFrame( |
| 1488 const IPC::Message& message) { | 1489 const IPC::Message& message) { |
| 1489 ViewHostMsg_SwapCompositorFrame::Param param; | 1490 ViewHostMsg_SwapCompositorFrame::Param param; |
| 1490 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) | 1491 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) |
| 1491 return false; | 1492 return false; |
| 1492 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 1493 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
| 1493 uint32 output_surface_id = param.a; | 1494 uint32 output_surface_id = param.a; |
| 1494 param.b.AssignTo(frame.get()); | 1495 param.b.AssignTo(frame.get()); |
| 1495 | 1496 |
| 1497 ui::LatencyInfo::AnnotateWithProcessId(frame->metadata.latency_info, |
| 1498 process_->GetID()); |
| 1499 |
| 1496 bool fixed_page_scale = | 1500 bool fixed_page_scale = |
| 1497 frame->metadata.min_page_scale_factor == | 1501 frame->metadata.min_page_scale_factor == |
| 1498 frame->metadata.max_page_scale_factor; | 1502 frame->metadata.max_page_scale_factor; |
| 1499 int updated_view_flags = fixed_page_scale ? InputRouter::FIXED_PAGE_SCALE | 1503 int updated_view_flags = fixed_page_scale ? InputRouter::FIXED_PAGE_SCALE |
| 1500 : InputRouter::VIEW_FLAGS_NONE; | 1504 : InputRouter::VIEW_FLAGS_NONE; |
| 1501 input_router_->OnViewUpdated(updated_view_flags); | 1505 input_router_->OnViewUpdated(updated_view_flags); |
| 1502 | 1506 |
| 1503 if (view_) { | 1507 if (view_) { |
| 1504 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); | 1508 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); |
| 1505 view_->DidReceiveRendererFrame(); | 1509 view_->DidReceiveRendererFrame(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1654 NotificationService::NoDetails()); | 1658 NotificationService::NoDetails()); |
| 1655 | 1659 |
| 1656 // We don't need to update the view if the view is hidden. We must do this | 1660 // We don't need to update the view if the view is hidden. We must do this |
| 1657 // early return after the ACK is sent, however, or the renderer will not send | 1661 // early return after the ACK is sent, however, or the renderer will not send |
| 1658 // us more data. | 1662 // us more data. |
| 1659 if (is_hidden_) | 1663 if (is_hidden_) |
| 1660 return; | 1664 return; |
| 1661 | 1665 |
| 1662 // Now paint the view. Watch out: it might be destroyed already. | 1666 // Now paint the view. Watch out: it might be destroyed already. |
| 1663 if (view_ && !is_accelerated_compositing_active_) { | 1667 if (view_ && !is_accelerated_compositing_active_) { |
| 1668 |
| 1669 std::vector<ui::LatencyInfo> latency_info; |
| 1670 for (size_t i = 0; i < params.latency_info.size(); i++) { |
| 1671 ui::LatencyInfo info = params.latency_info[i]; |
| 1672 info.AnnotateComponentsWithProcessId(process_->GetID()); |
| 1673 latency_info.push_back(info); |
| 1674 } |
| 1675 |
| 1664 view_being_painted_ = true; | 1676 view_being_painted_ = true; |
| 1665 view_->DidUpdateBackingStore(params.scroll_rect, params.scroll_delta, | 1677 view_->DidUpdateBackingStore(params.scroll_rect, params.scroll_delta, |
| 1666 params.copy_rects, params.latency_info); | 1678 params.copy_rects, latency_info); |
| 1667 view_->DidReceiveRendererFrame(); | 1679 view_->DidReceiveRendererFrame(); |
| 1668 view_being_painted_ = false; | 1680 view_being_painted_ = false; |
| 1669 } | 1681 } |
| 1670 | 1682 |
| 1671 // If we got a resize ack, then perhaps we have another resize to send? | 1683 // If we got a resize ack, then perhaps we have another resize to send? |
| 1672 bool is_resize_ack = | 1684 bool is_resize_ack = |
| 1673 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); | 1685 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); |
| 1674 if (is_resize_ack) | 1686 if (is_resize_ack) |
| 1675 WasResized(); | 1687 WasResized(); |
| 1676 | 1688 |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2462 continue; | 2474 continue; |
| 2463 } | 2475 } |
| 2464 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); | 2476 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); |
| 2465 if (rwhi_set.insert(rwhi).second) | 2477 if (rwhi_set.insert(rwhi).second) |
| 2466 rwhi->FrameSwapped(latency_info); | 2478 rwhi->FrameSwapped(latency_info); |
| 2467 } | 2479 } |
| 2468 } | 2480 } |
| 2469 } | 2481 } |
| 2470 | 2482 |
| 2471 } // namespace content | 2483 } // namespace content |
| OLD | NEW |