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

Unified Diff: content/renderer/render_view_impl.cc

Issue 2457503002: Send input message acks for swapped out renderers. (Closed)
Patch Set: Fix nits Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b9a235403f522c88b6ad017e6dda92c3dfea3322 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1300,8 +1300,16 @@ 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)
+ if (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", true);
+ 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 +3045,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
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698