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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 2457503002: Send input message acks for swapped out renderers. (Closed)
Patch Set: Add histogram Created 4 years, 1 month 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
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 1293
1294 // IPC::Listener implementation ---------------------------------------------- 1294 // IPC::Listener implementation ----------------------------------------------
1295 1295
1296 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { 1296 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) {
1297 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; 1297 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL;
1298 if (main_frame && main_frame->isWebLocalFrame()) 1298 if (main_frame && main_frame->isWebLocalFrame())
1299 GetContentClient()->SetActiveURL(main_frame->document().url()); 1299 GetContentClient()->SetActiveURL(main_frame->document().url());
1300 1300
1301 // Input IPC messages must not be processed if the RenderView is in 1301 // Input IPC messages must not be processed if the RenderView is in
1302 // swapped out state. 1302 // swapped out state.
1303 if (is_swapped_out_ && IPC_MESSAGE_ID_CLASS(message.type()) == InputMsgStart) 1303 bool discard_input =
1304 is_swapped_out_ && IPC_MESSAGE_ID_CLASS(message.type()) == InputMsgStart;
1305
1306 // TODO(dtapuska): Remove this histogram once we have seen that it actually
1307 // produces results true. See crbug.com/615090
1308 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.
1309 if (discard_input) {
1310 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message)
1311 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnDiscardInputEvent)
1312 IPC_END_MESSAGE_MAP()
1304 return false; 1313 return false;
1314 }
1305 1315
1306 for (auto& observer : observers_) { 1316 for (auto& observer : observers_) {
1307 if (observer.OnMessageReceived(message)) 1317 if (observer.OnMessageReceived(message))
1308 return true; 1318 return true;
1309 } 1319 }
1310 1320
1311 bool handled = true; 1321 bool handled = true;
1312 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) 1322 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message)
1313 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) 1323 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand)
1314 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) 1324 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret)
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after
3030 return; 3040 return;
3031 if (IsUseZoomForDSFEnabled()) { 3041 if (IsUseZoomForDSFEnabled()) {
3032 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); 3042 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_);
3033 } else { 3043 } else {
3034 webview()->setDeviceScaleFactor(device_scale_factor_); 3044 webview()->setDeviceScaleFactor(device_scale_factor_);
3035 } 3045 }
3036 webview()->settings()->setPreferCompositingToLCDTextEnabled( 3046 webview()->settings()->setPreferCompositingToLCDTextEnabled(
3037 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); 3047 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_));
3038 } 3048 }
3039 3049
3050 void RenderViewImpl::OnDiscardInputEvent(
3051 const blink::WebInputEvent* input_event,
3052 const ui::LatencyInfo& latency_info,
3053 InputEventDispatchType dispatch_type) {
3054 if (!input_event || (dispatch_type != DISPATCH_TYPE_BLOCKING &&
3055 dispatch_type != DISPATCH_TYPE_BLOCKING_NOTIFY_MAIN)) {
3056 return;
3057 }
3058
3059 if (dispatch_type == DISPATCH_TYPE_BLOCKING_NOTIFY_MAIN) {
3060 NotifyInputEventHandled(input_event->type,
3061 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
3062 }
3063
3064 std::unique_ptr<InputEventAck> ack(
3065 new InputEventAck(input_event->type, INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
3066 OnInputEventAck(std::move(ack));
3067 }
3068
3040 } // namespace content 3069 } // namespace content
OLDNEW
« 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