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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2740833005: [cc] Pass on BeginFrameAcks from CompositorEBFS through RWHVAura, DFH. (Closed)
Patch Set: address security comments Created 3 years, 9 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
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 8
9 #include <set> 9 #include <set>
10 #include <tuple> 10 #include <tuple>
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 OnQueueSyntheticGesture) 546 OnQueueSyntheticGesture)
547 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCancelComposition, 547 IPC_MESSAGE_HANDLER(InputHostMsg_ImeCancelComposition,
548 OnImeCancelComposition) 548 OnImeCancelComposition)
549 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) 549 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose)
550 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateScreenRects_ACK, 550 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateScreenRects_ACK,
551 OnUpdateScreenRectsAck) 551 OnUpdateScreenRectsAck)
552 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) 552 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove)
553 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText) 553 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText)
554 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, 554 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame,
555 OnSwapCompositorFrame(msg)) 555 OnSwapCompositorFrame(msg))
556 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginFrameDidNotSwap,
557 OnBeginFrameDidNotSwap)
556 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) 558 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect)
557 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) 559 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor)
558 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, 560 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
559 OnTextInputStateChanged) 561 OnTextInputStateChanged)
560 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse) 562 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse)
561 IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse) 563 IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse)
562 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup, 564 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup,
563 OnShowDisambiguationPopup) 565 OnShowDisambiguationPopup)
564 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, 566 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged,
565 OnSelectionBoundsChanged) 567 OnSelectionBoundsChanged)
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame"); 1821 TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame");
1820 1822
1821 ViewHostMsg_SwapCompositorFrame::Param param; 1823 ViewHostMsg_SwapCompositorFrame::Param param;
1822 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, &param)) 1824 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, &param))
1823 return false; 1825 return false;
1824 cc::CompositorFrame frame(std::move(std::get<1>(param))); 1826 cc::CompositorFrame frame(std::move(std::get<1>(param)));
1825 uint32_t compositor_frame_sink_id = std::get<0>(param); 1827 uint32_t compositor_frame_sink_id = std::get<0>(param);
1826 std::vector<IPC::Message> messages_to_deliver_with_frame; 1828 std::vector<IPC::Message> messages_to_deliver_with_frame;
1827 messages_to_deliver_with_frame.swap(std::get<2>(param)); 1829 messages_to_deliver_with_frame.swap(std::get<2>(param));
1828 1830
1831 if (frame.metadata.begin_frame_ack.sequence_number <
1832 cc::BeginFrameArgs::kStartingFrameNumber) {
1833 // Received an invalid ack, renderer misbehaved.
1834 bad_message::ReceivedBadMessage(
1835 GetProcess(),
1836 bad_message::RWH_INVALID_BEGIN_FRAME_ACK_COMPOSITOR_FRAME);
1837 return false;
1838 }
1839 // |has_damage| and |remaining_frames| are not transmitted.
dcheng 2017/03/17 18:39:19 Alternatively, this could just be part of the Rece
1840 frame.metadata.begin_frame_ack.has_damage = true;
1841 frame.metadata.begin_frame_ack.remaining_frames = 0;
1842
1829 if (!ui::LatencyInfo::Verify(frame.metadata.latency_info, 1843 if (!ui::LatencyInfo::Verify(frame.metadata.latency_info,
1830 "RenderWidgetHostImpl::OnSwapCompositorFrame")) { 1844 "RenderWidgetHostImpl::OnSwapCompositorFrame")) {
1831 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info); 1845 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info);
1832 } 1846 }
1833 1847
1834 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info); 1848 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info);
1835 1849
1836 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata); 1850 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata);
1837 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); 1851 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized);
1838 if (touch_emulator_) 1852 if (touch_emulator_)
(...skipping 23 matching lines...) Expand all
1862 ++i) { 1876 ++i) {
1863 rph->OnMessageReceived(*i); 1877 rph->OnMessageReceived(*i);
1864 if (i->dispatch_error()) 1878 if (i->dispatch_error())
1865 rph->OnBadMessageReceived(*i); 1879 rph->OnBadMessageReceived(*i);
1866 } 1880 }
1867 messages_to_deliver_with_frame.clear(); 1881 messages_to_deliver_with_frame.clear();
1868 1882
1869 return true; 1883 return true;
1870 } 1884 }
1871 1885
1886 void RenderWidgetHostImpl::OnBeginFrameDidNotSwap(
1887 const cc::BeginFrameAck& ack) {
1888 if (ack.sequence_number < cc::BeginFrameArgs::kStartingFrameNumber) {
1889 // Received an invalid ack, renderer misbehaved.
1890 bad_message::ReceivedBadMessage(
1891 GetProcess(), bad_message::RWH_INVALID_BEGIN_FRAME_ACK_DID_NOT_SWAP);
1892 return;
1893 }
1894
1895 // |has_damage| and |remaining_frames| are not transmitted.
1896 cc::BeginFrameAck modified_ack = ack;
1897 modified_ack.has_damage = false;
1898 modified_ack.remaining_frames = 0;
dcheng 2017/03/17 18:39:19 Ditto.
1899
1900 if (view_)
1901 view_->OnBeginFrameDidNotSwap(modified_ack);
1902 }
1903
1872 void RenderWidgetHostImpl::OnUpdateRect( 1904 void RenderWidgetHostImpl::OnUpdateRect(
1873 const ViewHostMsg_UpdateRect_Params& params) { 1905 const ViewHostMsg_UpdateRect_Params& params) {
1874 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect"); 1906 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect");
1875 TimeTicks paint_start = TimeTicks::Now(); 1907 TimeTicks paint_start = TimeTicks::Now();
1876 1908
1877 // Update our knowledge of the RenderWidget's size. 1909 // Update our knowledge of the RenderWidget's size.
1878 current_size_ = params.view_size; 1910 current_size_ = params.view_size;
1879 1911
1880 bool is_resize_ack = 1912 bool is_resize_ack =
1881 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); 1913 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags);
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
2559 // different from the receiver's. 2591 // different from the receiver's.
2560 file_system_file.url = 2592 file_system_file.url =
2561 GURL(storage::GetIsolatedFileSystemRootURIString( 2593 GURL(storage::GetIsolatedFileSystemRootURIString(
2562 file_system_url.origin(), filesystem_id, std::string()) 2594 file_system_url.origin(), filesystem_id, std::string())
2563 .append(register_name)); 2595 .append(register_name));
2564 file_system_file.filesystem_id = filesystem_id; 2596 file_system_file.filesystem_id = filesystem_id;
2565 } 2597 }
2566 } 2598 }
2567 2599
2568 } // namespace content 2600 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698