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

Side by Side Diff: content/browser/renderer_host/input/mouse_wheel_event_queue.cc

Issue 1922903002: Fix reporting of TouchToFirstScroll latency metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/input/mouse_wheel_event_queue.h" 5 #include "content/browser/renderer_host/input/mouse_wheel_event_queue.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 10
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 if (needs_scroll_begin_) { 165 if (needs_scroll_begin_) {
166 // If no GSB has been sent, it will be a non-synthetic GSB. 166 // If no GSB has been sent, it will be a non-synthetic GSB.
167 SendScrollBegin(scroll_update, false); 167 SendScrollBegin(scroll_update, false);
168 } else if (has_phase_info) { 168 } else if (has_phase_info) {
169 // If a GSB has been sent, generate a synthetic GSB if we have phase 169 // If a GSB has been sent, generate a synthetic GSB if we have phase
170 // information. This should be removed once crbug.com/526463 is fully 170 // information. This should be removed once crbug.com/526463 is fully
171 // implemented. 171 // implemented.
172 SendScrollBegin(scroll_update, true); 172 SendScrollBegin(scroll_update, true);
173 } 173 }
174 174
175 if (needs_update) 175 if (needs_update) {
176 client_->ForwardGestureEvent(scroll_update); 176 ui::LatencyInfo latency = ui::LatencyInfo();
177 latency.AddLatencyNumber(
178 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0,
179 0);
180 client_->ForwardGestureEventWithLatencyInfo(scroll_update, latency);
181 }
177 182
178 if (current_phase_ended) { 183 if (current_phase_ended) {
179 // Non-synthetic GSEs are sent when the current phase is canceled or 184 // Non-synthetic GSEs are sent when the current phase is canceled or
180 // ended. 185 // ended.
181 SendScrollEnd(scroll_update, false); 186 SendScrollEnd(scroll_update, false);
182 } else if (has_phase_info) { 187 } else if (has_phase_info) {
183 // Generate a synthetic GSE for every update to force hit testing so 188 // Generate a synthetic GSE for every update to force hit testing so
184 // that the non-latching behavior is preserved. Remove once 189 // that the non-latching behavior is preserved. Remove once
185 // crbug.com/526463 is fully implemented. 190 // crbug.com/526463 is fully implemented.
186 SendScrollEnd(scroll_update, true); 191 SendScrollEnd(scroll_update, true);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 scroll_end.data.scrollEnd.deltaUnits = 252 scroll_end.data.scrollEnd.deltaUnits =
248 update_event.data.scrollUpdate.deltaUnits; 253 update_event.data.scrollUpdate.deltaUnits;
249 254
250 if (!synthetic) { 255 if (!synthetic) {
251 needs_scroll_begin_ = true; 256 needs_scroll_begin_ = true;
252 needs_scroll_end_ = false; 257 needs_scroll_end_ = false;
253 258
254 if (scroll_end_timer_.IsRunning()) 259 if (scroll_end_timer_.IsRunning())
255 scroll_end_timer_.Reset(); 260 scroll_end_timer_.Reset();
256 } 261 }
257 client_->ForwardGestureEvent(scroll_end); 262 client_->ForwardGestureEventWithLatencyInfo(scroll_end, ui::LatencyInfo());
258 } 263 }
259 264
260 void MouseWheelEventQueue::SendScrollBegin( 265 void MouseWheelEventQueue::SendScrollBegin(
261 const WebGestureEvent& gesture_update, 266 const WebGestureEvent& gesture_update,
262 bool synthetic) { 267 bool synthetic) {
263 DCHECK((synthetic && !needs_scroll_begin_) || needs_scroll_begin_); 268 DCHECK((synthetic && !needs_scroll_begin_) || needs_scroll_begin_);
264 269
265 WebGestureEvent scroll_begin(gesture_update); 270 WebGestureEvent scroll_begin(gesture_update);
266 scroll_begin.type = WebInputEvent::GestureScrollBegin; 271 scroll_begin.type = WebInputEvent::GestureScrollBegin;
267 scroll_begin.data.scrollBegin.synthetic = synthetic; 272 scroll_begin.data.scrollBegin.synthetic = synthetic;
268 scroll_begin.data.scrollBegin.inertial = 273 scroll_begin.data.scrollBegin.inertial =
269 gesture_update.data.scrollUpdate.inertial; 274 gesture_update.data.scrollUpdate.inertial;
270 scroll_begin.data.scrollBegin.deltaXHint = 275 scroll_begin.data.scrollBegin.deltaXHint =
271 gesture_update.data.scrollUpdate.deltaX; 276 gesture_update.data.scrollUpdate.deltaX;
272 scroll_begin.data.scrollBegin.deltaYHint = 277 scroll_begin.data.scrollBegin.deltaYHint =
273 gesture_update.data.scrollUpdate.deltaY; 278 gesture_update.data.scrollUpdate.deltaY;
274 scroll_begin.data.scrollBegin.targetViewport = false; 279 scroll_begin.data.scrollBegin.targetViewport = false;
275 scroll_begin.data.scrollBegin.deltaHintUnits = 280 scroll_begin.data.scrollBegin.deltaHintUnits =
276 gesture_update.data.scrollUpdate.deltaUnits; 281 gesture_update.data.scrollUpdate.deltaUnits;
277 282
278 needs_scroll_begin_ = false; 283 needs_scroll_begin_ = false;
279 needs_scroll_end_ = true; 284 needs_scroll_end_ = true;
280 client_->ForwardGestureEvent(scroll_begin); 285 client_->ForwardGestureEventWithLatencyInfo(scroll_begin, ui::LatencyInfo());
281 } 286 }
282 287
283 } // namespace content 288 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698