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

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

Issue 2048673002: Revert of Replace ui::LatencyInfo::InputCoordinate with gfx::PointF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/render_widget_host_latency_tracker .h" 5 #include "content/browser/renderer_host/input/render_widget_host_latency_tracker .h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "content/browser/renderer_host/render_widget_host_impl.h" 12 #include "content/browser/renderer_host/render_widget_host_impl.h"
13 13
14 using blink::WebGestureEvent; 14 using blink::WebGestureEvent;
15 using blink::WebInputEvent; 15 using blink::WebInputEvent;
16 using blink::WebMouseEvent; 16 using blink::WebMouseEvent;
17 using blink::WebMouseWheelEvent; 17 using blink::WebMouseWheelEvent;
18 using blink::WebTouchEvent; 18 using blink::WebTouchEvent;
19 using ui::LatencyInfo; 19 using ui::LatencyInfo;
20 20
21 namespace content { 21 namespace content {
22 namespace { 22 namespace {
23 23
24 void UpdateLatencyCoordinatesImpl(const blink::WebTouchEvent& touch, 24 void UpdateLatencyCoordinatesImpl(const blink::WebTouchEvent& touch,
25 LatencyInfo* latency, 25 LatencyInfo* latency,
26 float device_scale_factor) { 26 float device_scale_factor) {
27 for (uint32_t i = 0; i < touch.touchesLength; ++i) { 27 for (uint32_t i = 0; i < touch.touchesLength; ++i) {
28 gfx::PointF coordinate(touch.touches[i].position.x * device_scale_factor, 28 LatencyInfo::InputCoordinate coordinate(
29 touch.touches[i].position.y * device_scale_factor); 29 touch.touches[i].position.x * device_scale_factor,
30 touch.touches[i].position.y * device_scale_factor);
30 if (!latency->AddInputCoordinate(coordinate)) 31 if (!latency->AddInputCoordinate(coordinate))
31 break; 32 break;
32 } 33 }
33 } 34 }
34 35
35 void UpdateLatencyCoordinatesImpl(const WebGestureEvent& gesture, 36 void UpdateLatencyCoordinatesImpl(const WebGestureEvent& gesture,
36 LatencyInfo* latency, 37 LatencyInfo* latency,
37 float device_scale_factor) { 38 float device_scale_factor) {
38 latency->AddInputCoordinate(gfx::PointF(gesture.x * device_scale_factor, 39 latency->AddInputCoordinate(
39 gesture.y * device_scale_factor)); 40 LatencyInfo::InputCoordinate(gesture.x * device_scale_factor,
41 gesture.y * device_scale_factor));
40 } 42 }
41 43
42 void UpdateLatencyCoordinatesImpl(const WebMouseEvent& mouse, 44 void UpdateLatencyCoordinatesImpl(const WebMouseEvent& mouse,
43 LatencyInfo* latency, 45 LatencyInfo* latency,
44 float device_scale_factor) { 46 float device_scale_factor) {
45 latency->AddInputCoordinate(gfx::PointF(mouse.x * device_scale_factor, 47 latency->AddInputCoordinate(
46 mouse.y * device_scale_factor)); 48 LatencyInfo::InputCoordinate(mouse.x * device_scale_factor,
49 mouse.y * device_scale_factor));
47 } 50 }
48 51
49 void UpdateLatencyCoordinatesImpl(const WebMouseWheelEvent& wheel, 52 void UpdateLatencyCoordinatesImpl(const WebMouseWheelEvent& wheel,
50 LatencyInfo* latency, 53 LatencyInfo* latency,
51 float device_scale_factor) { 54 float device_scale_factor) {
52 latency->AddInputCoordinate(gfx::PointF(wheel.x * device_scale_factor, 55 latency->AddInputCoordinate(
53 wheel.y * device_scale_factor)); 56 LatencyInfo::InputCoordinate(wheel.x * device_scale_factor,
57 wheel.y * device_scale_factor));
54 } 58 }
55 59
56 void UpdateLatencyCoordinates(const WebInputEvent& event, 60 void UpdateLatencyCoordinates(const WebInputEvent& event,
57 float device_scale_factor, 61 float device_scale_factor,
58 LatencyInfo* latency) { 62 LatencyInfo* latency) {
59 if (WebInputEvent::isMouseEventType(event.type)) { 63 if (WebInputEvent::isMouseEventType(event.type)) {
60 UpdateLatencyCoordinatesImpl(static_cast<const WebMouseEvent&>(event), 64 UpdateLatencyCoordinatesImpl(static_cast<const WebMouseEvent&>(event),
61 latency, device_scale_factor); 65 latency, device_scale_factor);
62 } else if (WebInputEvent::isGestureEventType(event.type)) { 66 } else if (WebInputEvent::isGestureEventType(event.type)) {
63 UpdateLatencyCoordinatesImpl(static_cast<const WebGestureEvent&>(event), 67 UpdateLatencyCoordinatesImpl(static_cast<const WebGestureEvent&>(event),
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 latency_component_id_, nullptr)) { 503 latency_component_id_, nullptr)) {
500 return; 504 return;
501 } 505 }
502 506
503 ComputeScrollLatencyHistograms(gpu_swap_begin_component, 507 ComputeScrollLatencyHistograms(gpu_swap_begin_component,
504 gpu_swap_end_component, latency_component_id_, 508 gpu_swap_end_component, latency_component_id_,
505 latency); 509 latency);
506 } 510 }
507 511
508 } // namespace content 512 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698