Chromium Code Reviews| 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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1831 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info); | 1833 std::vector<ui::LatencyInfo>().swap(frame.metadata.latency_info); |
| 1832 } | 1834 } |
| 1833 | 1835 |
| 1834 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info); | 1836 latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info); |
| 1835 | 1837 |
| 1836 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata); | 1838 bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata); |
| 1837 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); | 1839 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); |
| 1838 if (touch_emulator_) | 1840 if (touch_emulator_) |
| 1839 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); | 1841 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
| 1840 | 1842 |
| 1843 // |has_damage| is not transmitted. | |
| 1844 frame.metadata.begin_frame_ack.has_damage = true; | |
| 1845 // |remaining_frames| is not transmitted, but 0 by default. | |
| 1846 DCHECK_EQ(0u, frame.metadata.begin_frame_ack.remaining_frames); | |
| 1847 | |
| 1848 if (frame.metadata.begin_frame_ack.sequence_number < | |
| 1849 cc::BeginFrameArgs::kStartingFrameNumber) { | |
| 1850 // Received an invalid ack, renderer misbehaved. | |
| 1851 bad_message::ReceivedBadMessage( | |
| 1852 GetProcess(), | |
| 1853 bad_message::RWH_INVALID_BEGIN_FRAME_ACK_COMPOSITOR_FRAME); | |
|
piman
2017/03/16 18:32:14
nit: ReceivedBadMessage is a bit of a big hammer.
dcheng
2017/03/17 05:54:02
I could see this going either way... with my secur
Eric Seckler
2017/03/17 11:06:45
I was pointed to ReceivedBadMessage by mkwst@, who
| |
| 1854 return false; | |
| 1855 } | |
| 1856 | |
| 1841 // Ignore this frame if its content has already been unloaded. Source ID | 1857 // Ignore this frame if its content has already been unloaded. Source ID |
| 1842 // is always zero for an OOPIF because we are only concerned with displaying | 1858 // is always zero for an OOPIF because we are only concerned with displaying |
| 1843 // stale graphics on top-level frames. We accept frames that have a source ID | 1859 // stale graphics on top-level frames. We accept frames that have a source ID |
| 1844 // greater than |current_content_source_id_| because in some cases the first | 1860 // greater than |current_content_source_id_| because in some cases the first |
| 1845 // compositor frame can arrive before the navigation commit message that | 1861 // compositor frame can arrive before the navigation commit message that |
| 1846 // updates that value. | 1862 // updates that value. |
| 1847 if (view_ && frame.metadata.content_source_id >= current_content_source_id_) { | 1863 if (view_ && frame.metadata.content_source_id >= current_content_source_id_) { |
| 1848 view_->OnSwapCompositorFrame(compositor_frame_sink_id, std::move(frame)); | 1864 view_->OnSwapCompositorFrame(compositor_frame_sink_id, std::move(frame)); |
| 1849 view_->DidReceiveRendererFrame(); | 1865 view_->DidReceiveRendererFrame(); |
| 1850 } else { | 1866 } else { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1862 ++i) { | 1878 ++i) { |
| 1863 rph->OnMessageReceived(*i); | 1879 rph->OnMessageReceived(*i); |
| 1864 if (i->dispatch_error()) | 1880 if (i->dispatch_error()) |
| 1865 rph->OnBadMessageReceived(*i); | 1881 rph->OnBadMessageReceived(*i); |
| 1866 } | 1882 } |
| 1867 messages_to_deliver_with_frame.clear(); | 1883 messages_to_deliver_with_frame.clear(); |
| 1868 | 1884 |
| 1869 return true; | 1885 return true; |
| 1870 } | 1886 } |
| 1871 | 1887 |
| 1888 void RenderWidgetHostImpl::OnBeginFrameDidNotSwap( | |
| 1889 const cc::BeginFrameAck& ack) { | |
| 1890 if (ack.sequence_number < cc::BeginFrameArgs::kStartingFrameNumber) { | |
| 1891 // Received an invalid ack, renderer misbehaved. | |
| 1892 bad_message::ReceivedBadMessage( | |
| 1893 GetProcess(), bad_message::RWH_INVALID_BEGIN_FRAME_ACK_DID_NOT_SWAP); | |
|
piman
2017/03/16 18:32:14
Ditto, ReceivedBadMessage may be overkill, and jus
Eric Seckler
2017/03/17 11:06:44
Done.
| |
| 1894 return; | |
| 1895 } | |
| 1896 | |
| 1897 // |has_damage| is not transmitted but false by default. | |
| 1898 DCHECK(!ack.has_damage); | |
| 1899 // |remaining_frames| is not transmitted, but 0 by default. | |
| 1900 DCHECK_EQ(0u, ack.remaining_frames); | |
|
dcheng
2017/03/17 05:54:03
Will anything be negatively affected if these DCHE
Eric Seckler
2017/03/17 11:06:44
Yeah, they should actually have these values, othe
| |
| 1901 | |
| 1902 if (view_) | |
| 1903 view_->OnBeginFrameDidNotSwap(ack); | |
| 1904 } | |
| 1905 | |
| 1872 void RenderWidgetHostImpl::OnUpdateRect( | 1906 void RenderWidgetHostImpl::OnUpdateRect( |
| 1873 const ViewHostMsg_UpdateRect_Params& params) { | 1907 const ViewHostMsg_UpdateRect_Params& params) { |
| 1874 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect"); | 1908 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect"); |
| 1875 TimeTicks paint_start = TimeTicks::Now(); | 1909 TimeTicks paint_start = TimeTicks::Now(); |
| 1876 | 1910 |
| 1877 // Update our knowledge of the RenderWidget's size. | 1911 // Update our knowledge of the RenderWidget's size. |
| 1878 current_size_ = params.view_size; | 1912 current_size_ = params.view_size; |
| 1879 | 1913 |
| 1880 bool is_resize_ack = | 1914 bool is_resize_ack = |
| 1881 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); | 1915 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2559 // different from the receiver's. | 2593 // different from the receiver's. |
| 2560 file_system_file.url = | 2594 file_system_file.url = |
| 2561 GURL(storage::GetIsolatedFileSystemRootURIString( | 2595 GURL(storage::GetIsolatedFileSystemRootURIString( |
| 2562 file_system_url.origin(), filesystem_id, std::string()) | 2596 file_system_url.origin(), filesystem_id, std::string()) |
| 2563 .append(register_name)); | 2597 .append(register_name)); |
| 2564 file_system_file.filesystem_id = filesystem_id; | 2598 file_system_file.filesystem_id = filesystem_id; |
| 2565 } | 2599 } |
| 2566 } | 2600 } |
| 2567 | 2601 |
| 2568 } // namespace content | 2602 } // namespace content |
| OLD | NEW |