| 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 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 | 1803 |
| 1804 bool RenderWidgetHostImpl::OnSwapCompositorFrame( | 1804 bool RenderWidgetHostImpl::OnSwapCompositorFrame( |
| 1805 const IPC::Message& message) { | 1805 const IPC::Message& message) { |
| 1806 // This trace event is used in | 1806 // This trace event is used in |
| 1807 // chrome/browser/extensions/api/cast_streaming/performance_test.cc | 1807 // chrome/browser/extensions/api/cast_streaming/performance_test.cc |
| 1808 TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame"); | 1808 TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame"); |
| 1809 | 1809 |
| 1810 ViewHostMsg_SwapCompositorFrame::Param param; | 1810 ViewHostMsg_SwapCompositorFrame::Param param; |
| 1811 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) | 1811 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) |
| 1812 return false; | 1812 return false; |
| 1813 cc::CompositorFrame frame(std::move(std::get<1>(param))); | |
| 1814 uint32_t compositor_frame_sink_id = std::get<0>(param); | 1813 uint32_t compositor_frame_sink_id = std::get<0>(param); |
| 1814 cc::LocalSurfaceId local_surface_id = std::get<1>(param); |
| 1815 cc::CompositorFrame frame(std::move(std::get<2>(param))); |
| 1815 std::vector<IPC::Message> messages_to_deliver_with_frame; | 1816 std::vector<IPC::Message> messages_to_deliver_with_frame; |
| 1816 messages_to_deliver_with_frame.swap(std::get<2>(param)); | 1817 messages_to_deliver_with_frame.swap(std::get<3>(param)); |
| 1817 | 1818 |
| 1818 if (!ui::LatencyInfo::Verify(frame.metadata.latency_info, | 1819 if (!ui::LatencyInfo::Verify(frame.metadata.latency_info, |
| 1819 "RenderWidgetHostImpl::OnSwapCompositorFrame")) { | 1820 "RenderWidgetHostImpl::OnSwapCompositorFrame")) { |
| 1820 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info); | 1821 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info); |
| 1821 } | 1822 } |
| 1822 | 1823 |
| 1823 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info); | 1824 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info); |
| 1824 | 1825 |
| 1825 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata); | 1826 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata); |
| 1826 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); | 1827 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); |
| 1827 if (touch_emulator_) | 1828 if (touch_emulator_) |
| 1828 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); | 1829 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
| 1829 | 1830 |
| 1830 // Ignore this frame if its content has already been unloaded. Source ID | 1831 // Ignore this frame if its content has already been unloaded. Source ID |
| 1831 // is always zero for an OOPIF because we are only concerned with displaying | 1832 // is always zero for an OOPIF because we are only concerned with displaying |
| 1832 // stale graphics on top-level frames. We accept frames that have a source ID | 1833 // stale graphics on top-level frames. We accept frames that have a source ID |
| 1833 // greater than |current_content_source_id_| because in some cases the first | 1834 // greater than |current_content_source_id_| because in some cases the first |
| 1834 // compositor frame can arrive before the navigation commit message that | 1835 // compositor frame can arrive before the navigation commit message that |
| 1835 // updates that value. | 1836 // updates that value. |
| 1836 if (view_ && frame.metadata.content_source_id >= current_content_source_id_) { | 1837 if (view_ && frame.metadata.content_source_id >= current_content_source_id_) { |
| 1837 view_->OnSwapCompositorFrame(compositor_frame_sink_id, std::move(frame)); | 1838 view_->OnSwapCompositorFrame(compositor_frame_sink_id, local_surface_id, |
| 1839 std::move(frame)); |
| 1838 view_->DidReceiveRendererFrame(); | 1840 view_->DidReceiveRendererFrame(); |
| 1839 } else { | 1841 } else { |
| 1840 cc::ReturnedResourceArray resources; | 1842 cc::ReturnedResourceArray resources; |
| 1841 cc::TransferableResource::ReturnResources(frame.resource_list, &resources); | 1843 cc::TransferableResource::ReturnResources(frame.resource_list, &resources); |
| 1842 SendReclaimCompositorResources(routing_id_, compositor_frame_sink_id, | 1844 SendReclaimCompositorResources(routing_id_, compositor_frame_sink_id, |
| 1843 process_->GetID(), true /* is_swap_ack */, | 1845 process_->GetID(), true /* is_swap_ack */, |
| 1844 resources); | 1846 resources); |
| 1845 } | 1847 } |
| 1846 | 1848 |
| 1847 RenderProcessHost* rph = GetProcess(); | 1849 RenderProcessHost* rph = GetProcess(); |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2547 // different from the receiver's. | 2549 // different from the receiver's. |
| 2548 file_system_file.url = | 2550 file_system_file.url = |
| 2549 GURL(storage::GetIsolatedFileSystemRootURIString( | 2551 GURL(storage::GetIsolatedFileSystemRootURIString( |
| 2550 file_system_url.origin(), filesystem_id, std::string()) | 2552 file_system_url.origin(), filesystem_id, std::string()) |
| 2551 .append(register_name)); | 2553 .append(register_name)); |
| 2552 file_system_file.filesystem_id = filesystem_id; | 2554 file_system_file.filesystem_id = filesystem_id; |
| 2553 } | 2555 } |
| 2554 } | 2556 } |
| 2555 | 2557 |
| 2556 } // namespace content | 2558 } // namespace content |
| OLD | NEW |