| OLD | NEW |
| 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_functions.h" | 10 #include "base/metrics/histogram_functions.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 void UpdateLatencyCoordinatesImpl(const WebGestureEvent& gesture, | 40 void UpdateLatencyCoordinatesImpl(const WebGestureEvent& gesture, |
| 41 LatencyInfo* latency, | 41 LatencyInfo* latency, |
| 42 float device_scale_factor) { | 42 float device_scale_factor) { |
| 43 latency->AddInputCoordinate(gfx::PointF(gesture.x * device_scale_factor, | 43 latency->AddInputCoordinate(gfx::PointF(gesture.x * device_scale_factor, |
| 44 gesture.y * device_scale_factor)); | 44 gesture.y * device_scale_factor)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void UpdateLatencyCoordinatesImpl(const WebMouseEvent& mouse, | 47 void UpdateLatencyCoordinatesImpl(const WebMouseEvent& mouse, |
| 48 LatencyInfo* latency, | 48 LatencyInfo* latency, |
| 49 float device_scale_factor) { | 49 float device_scale_factor) { |
| 50 latency->AddInputCoordinate(gfx::PointF(mouse.x * device_scale_factor, | 50 latency->AddInputCoordinate( |
| 51 mouse.y * device_scale_factor)); | 51 gfx::PointF(mouse.positionInWidget().x * device_scale_factor, |
| 52 mouse.positionInWidget().y * device_scale_factor)); |
| 52 } | 53 } |
| 53 | 54 |
| 54 void UpdateLatencyCoordinatesImpl(const WebMouseWheelEvent& wheel, | 55 void UpdateLatencyCoordinatesImpl(const WebMouseWheelEvent& wheel, |
| 55 LatencyInfo* latency, | 56 LatencyInfo* latency, |
| 56 float device_scale_factor) { | 57 float device_scale_factor) { |
| 57 latency->AddInputCoordinate(gfx::PointF(wheel.x * device_scale_factor, | 58 latency->AddInputCoordinate( |
| 58 wheel.y * device_scale_factor)); | 59 gfx::PointF(wheel.positionInWidget().x * device_scale_factor, |
| 60 wheel.positionInWidget().y * device_scale_factor)); |
| 59 } | 61 } |
| 60 | 62 |
| 61 void UpdateLatencyCoordinates(const WebInputEvent& event, | 63 void UpdateLatencyCoordinates(const WebInputEvent& event, |
| 62 float device_scale_factor, | 64 float device_scale_factor, |
| 63 LatencyInfo* latency) { | 65 LatencyInfo* latency) { |
| 64 if (WebInputEvent::isMouseEventType(event.type())) { | 66 if (WebInputEvent::isMouseEventType(event.type())) { |
| 65 UpdateLatencyCoordinatesImpl(static_cast<const WebMouseEvent&>(event), | 67 UpdateLatencyCoordinatesImpl(static_cast<const WebMouseEvent&>(event), |
| 66 latency, device_scale_factor); | 68 latency, device_scale_factor); |
| 67 } else if (WebInputEvent::isGestureEventType(event.type())) { | 69 } else if (WebInputEvent::isGestureEventType(event.type())) { |
| 68 UpdateLatencyCoordinatesImpl(static_cast<const WebGestureEvent&>(event), | 70 UpdateLatencyCoordinatesImpl(static_cast<const WebGestureEvent&>(event), |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 latency_component_id_, latency); | 587 latency_component_id_, latency); |
| 586 } | 588 } |
| 587 } | 589 } |
| 588 | 590 |
| 589 void RenderWidgetHostLatencyTracker::SetDelegate( | 591 void RenderWidgetHostLatencyTracker::SetDelegate( |
| 590 RenderWidgetHostDelegate* delegate) { | 592 RenderWidgetHostDelegate* delegate) { |
| 591 render_widget_host_delegate_ = delegate; | 593 render_widget_host_delegate_ = delegate; |
| 592 } | 594 } |
| 593 | 595 |
| 594 } // namespace content | 596 } // namespace content |
| OLD | NEW |