Index: content/browser/renderer_host/render_widget_host_impl.cc |
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc |
index 175f1687e6f05778a8a79f281bf0831e8737ec5e..c54d7c072417f4a945a389ce7193cd52ca7c7a4b 100644 |
--- a/content/browser/renderer_host/render_widget_host_impl.cc |
+++ b/content/browser/renderer_host/render_widget_host_impl.cc |
@@ -553,6 +553,8 @@ bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) { |
IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText) |
IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, |
OnSwapCompositorFrame(msg)) |
+ IPC_MESSAGE_HANDLER(ViewHostMsg_BeginFrameDidNotSwap, |
+ OnBeginFrameDidNotSwap) |
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) |
IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) |
IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, |
@@ -1838,6 +1840,20 @@ bool RenderWidgetHostImpl::OnSwapCompositorFrame( |
if (touch_emulator_) |
touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
+ // |has_damage| is not transmitted. |
+ frame.metadata.begin_frame_ack.has_damage = true; |
+ // |remaining_frames| is not transmitted, but 0 by default. |
+ DCHECK_EQ(0u, frame.metadata.begin_frame_ack.remaining_frames); |
+ |
+ if (frame.metadata.begin_frame_ack.sequence_number < |
+ cc::BeginFrameArgs::kStartingFrameNumber) { |
+ // Received an invalid ack, renderer misbehaved. |
+ bad_message::ReceivedBadMessage( |
+ GetProcess(), |
+ 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
|
+ return false; |
+ } |
+ |
// Ignore this frame if its content has already been unloaded. Source ID |
// is always zero for an OOPIF because we are only concerned with displaying |
// stale graphics on top-level frames. We accept frames that have a source ID |
@@ -1869,6 +1885,24 @@ bool RenderWidgetHostImpl::OnSwapCompositorFrame( |
return true; |
} |
+void RenderWidgetHostImpl::OnBeginFrameDidNotSwap( |
+ const cc::BeginFrameAck& ack) { |
+ if (ack.sequence_number < cc::BeginFrameArgs::kStartingFrameNumber) { |
+ // Received an invalid ack, renderer misbehaved. |
+ bad_message::ReceivedBadMessage( |
+ 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.
|
+ return; |
+ } |
+ |
+ // |has_damage| is not transmitted but false by default. |
+ DCHECK(!ack.has_damage); |
+ // |remaining_frames| is not transmitted, but 0 by default. |
+ 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
|
+ |
+ if (view_) |
+ view_->OnBeginFrameDidNotSwap(ack); |
+} |
+ |
void RenderWidgetHostImpl::OnUpdateRect( |
const ViewHostMsg_UpdateRect_Params& params) { |
TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect"); |