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