Chromium Code Reviews| Index: content/renderer/render_view_impl.cc |
| diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
| index 93479bcf1bd718cd0da2355b5ca3a92d82777561..f73fc72872c6572ef073b68582aa046d2f656e71 100644 |
| --- a/content/renderer/render_view_impl.cc |
| +++ b/content/renderer/render_view_impl.cc |
| @@ -1300,8 +1300,18 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
| // Input IPC messages must not be processed if the RenderView is in |
| // swapped out state. |
| - if (is_swapped_out_ && IPC_MESSAGE_ID_CLASS(message.type()) == InputMsgStart) |
| + bool discard_input = |
| + is_swapped_out_ && IPC_MESSAGE_ID_CLASS(message.type()) == InputMsgStart; |
| + |
| + // TODO(dtapuska): Remove this histogram once we have seen that it actually |
| + // produces results true. See crbug.com/615090 |
| + UMA_HISTOGRAM_BOOLEAN("Event.RenderView.DiscardInput", discard_input); |
|
Charlie Reis
2016/10/27 16:57:00
I would recommend only sending this if discard_inp
dtapuska
2016/10/27 18:55:36
I fear shipping the dcheck/notreached because I th
Charlie Reis
2016/10/27 19:28:59
I already said yes to that in my previous reply.
|
| + if (discard_input) { |
| + IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
| + IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnDiscardInputEvent) |
| + IPC_END_MESSAGE_MAP() |
| return false; |
| + } |
| for (auto& observer : observers_) { |
| if (observer.OnMessageReceived(message)) |
| @@ -3037,4 +3047,23 @@ void RenderViewImpl::UpdateWebViewWithDeviceScaleFactor() { |
| PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| } |
| +void RenderViewImpl::OnDiscardInputEvent( |
| + const blink::WebInputEvent* input_event, |
| + const ui::LatencyInfo& latency_info, |
| + InputEventDispatchType dispatch_type) { |
| + if (!input_event || (dispatch_type != DISPATCH_TYPE_BLOCKING && |
| + dispatch_type != DISPATCH_TYPE_BLOCKING_NOTIFY_MAIN)) { |
| + return; |
| + } |
| + |
| + if (dispatch_type == DISPATCH_TYPE_BLOCKING_NOTIFY_MAIN) { |
| + NotifyInputEventHandled(input_event->type, |
| + INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| + } |
| + |
| + std::unique_ptr<InputEventAck> ack( |
| + new InputEventAck(input_event->type, INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
| + OnInputEventAck(std::move(ack)); |
| +} |
| + |
| } // namespace content |