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 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1592 bool RenderWidgetHostImpl::OnSwapCompositorFrame( | 1592 bool RenderWidgetHostImpl::OnSwapCompositorFrame( |
1593 const IPC::Message& message) { | 1593 const IPC::Message& message) { |
1594 // This trace event is used in | 1594 // This trace event is used in |
1595 // chrome/browser/extensions/api/cast_streaming/performance_test.cc | 1595 // chrome/browser/extensions/api/cast_streaming/performance_test.cc |
1596 TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame"); | 1596 TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame"); |
1597 | 1597 |
1598 ViewHostMsg_SwapCompositorFrame::Param param; | 1598 ViewHostMsg_SwapCompositorFrame::Param param; |
1599 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) | 1599 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) |
1600 return false; | 1600 return false; |
1601 cc::CompositorFrame frame(std::move(std::get<1>(param))); | 1601 cc::CompositorFrame frame(std::move(std::get<1>(param))); |
1602 uint32_t output_surface_id = std::get<0>(param); | 1602 uint32_t compositor_frame_sink_id = std::get<0>(param); |
1603 std::vector<IPC::Message> messages_to_deliver_with_frame; | 1603 std::vector<IPC::Message> messages_to_deliver_with_frame; |
1604 messages_to_deliver_with_frame.swap(std::get<2>(param)); | 1604 messages_to_deliver_with_frame.swap(std::get<2>(param)); |
1605 | 1605 |
1606 if (!ui::LatencyInfo::Verify(frame.metadata.latency_info, | 1606 if (!ui::LatencyInfo::Verify(frame.metadata.latency_info, |
1607 "RenderWidgetHostImpl::OnSwapCompositorFrame")) { | 1607 "RenderWidgetHostImpl::OnSwapCompositorFrame")) { |
1608 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info); | 1608 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info); |
1609 } | 1609 } |
1610 | 1610 |
1611 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info); | 1611 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info); |
1612 | 1612 |
1613 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata); | 1613 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata); |
1614 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); | 1614 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); |
1615 if (touch_emulator_) | 1615 if (touch_emulator_) |
1616 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); | 1616 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
1617 | 1617 |
1618 if (view_) { | 1618 if (view_) { |
1619 view_->OnSwapCompositorFrame(output_surface_id, std::move(frame)); | 1619 view_->OnSwapCompositorFrame(compositor_frame_sink_id, std::move(frame)); |
1620 view_->DidReceiveRendererFrame(); | 1620 view_->DidReceiveRendererFrame(); |
1621 } else { | 1621 } else { |
1622 cc::ReturnedResourceArray resources; | 1622 cc::ReturnedResourceArray resources; |
1623 if (frame.delegated_frame_data) { | 1623 if (frame.delegated_frame_data) { |
1624 cc::TransferableResource::ReturnResources( | 1624 cc::TransferableResource::ReturnResources( |
1625 frame.delegated_frame_data->resource_list, &resources); | 1625 frame.delegated_frame_data->resource_list, &resources); |
1626 } | 1626 } |
1627 SendReclaimCompositorResources(routing_id_, output_surface_id, | 1627 SendReclaimCompositorResources(routing_id_, compositor_frame_sink_id, |
1628 process_->GetID(), true /* is_swap_ack */, | 1628 process_->GetID(), true /* is_swap_ack */, |
1629 resources); | 1629 resources); |
1630 } | 1630 } |
1631 | 1631 |
1632 RenderProcessHost* rph = GetProcess(); | 1632 RenderProcessHost* rph = GetProcess(); |
1633 for (std::vector<IPC::Message>::const_iterator i = | 1633 for (std::vector<IPC::Message>::const_iterator i = |
1634 messages_to_deliver_with_frame.begin(); | 1634 messages_to_deliver_with_frame.begin(); |
1635 i != messages_to_deliver_with_frame.end(); | 1635 i != messages_to_deliver_with_frame.end(); |
1636 ++i) { | 1636 ++i) { |
1637 rph->OnMessageReceived(*i); | 1637 rph->OnMessageReceived(*i); |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2056 return false; | 2056 return false; |
2057 } | 2057 } |
2058 | 2058 |
2059 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); | 2059 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); |
2060 return true; | 2060 return true; |
2061 } | 2061 } |
2062 | 2062 |
2063 // static | 2063 // static |
2064 void RenderWidgetHostImpl::SendReclaimCompositorResources( | 2064 void RenderWidgetHostImpl::SendReclaimCompositorResources( |
2065 int32_t route_id, | 2065 int32_t route_id, |
2066 uint32_t output_surface_id, | 2066 uint32_t compositor_frame_sink_id, |
2067 int renderer_host_id, | 2067 int renderer_host_id, |
2068 bool is_swap_ack, | 2068 bool is_swap_ack, |
2069 const cc::ReturnedResourceArray& resources) { | 2069 const cc::ReturnedResourceArray& resources) { |
2070 RenderProcessHost* host = RenderProcessHost::FromID(renderer_host_id); | 2070 RenderProcessHost* host = RenderProcessHost::FromID(renderer_host_id); |
2071 if (!host) | 2071 if (!host) |
2072 return; | 2072 return; |
2073 host->Send(new ViewMsg_ReclaimCompositorResources(route_id, output_surface_id, | 2073 host->Send(new ViewMsg_ReclaimCompositorResources( |
2074 is_swap_ack, resources)); | 2074 route_id, compositor_frame_sink_id, is_swap_ack, resources)); |
2075 } | 2075 } |
2076 | 2076 |
2077 void RenderWidgetHostImpl::DelayedAutoResized() { | 2077 void RenderWidgetHostImpl::DelayedAutoResized() { |
2078 gfx::Size new_size = new_auto_size_; | 2078 gfx::Size new_size = new_auto_size_; |
2079 // Clear the new_auto_size_ since the empty value is used as a flag to | 2079 // Clear the new_auto_size_ since the empty value is used as a flag to |
2080 // indicate that no callback is in progress (i.e. without this line | 2080 // indicate that no callback is in progress (i.e. without this line |
2081 // DelayedAutoResized will not get called again). | 2081 // DelayedAutoResized will not get called again). |
2082 new_auto_size_.SetSize(0, 0); | 2082 new_auto_size_.SetSize(0, 0); |
2083 if (!auto_resize_enabled_) | 2083 if (!auto_resize_enabled_) |
2084 return; | 2084 return; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2206 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; | 2206 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; |
2207 } | 2207 } |
2208 | 2208 |
2209 BrowserAccessibilityManager* | 2209 BrowserAccessibilityManager* |
2210 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2210 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { |
2211 return delegate_ ? | 2211 return delegate_ ? |
2212 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; | 2212 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; |
2213 } | 2213 } |
2214 | 2214 |
2215 } // namespace content | 2215 } // namespace content |
OLD | NEW |