OLD | NEW |
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 #include "content/common/input/web_input_event_traits.h" | 10 #include "content/common/input/web_input_event_traits.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 ~QueuedWebMouseWheelEvent() { | 28 ~QueuedWebMouseWheelEvent() { |
29 TRACE_EVENT_ASYNC_END0("input", "MouseWheelEventQueue::QueueEvent", this); | 29 TRACE_EVENT_ASYNC_END0("input", "MouseWheelEventQueue::QueueEvent", this); |
30 } | 30 } |
31 | 31 |
32 private: | 32 private: |
33 DISALLOW_COPY_AND_ASSIGN(QueuedWebMouseWheelEvent); | 33 DISALLOW_COPY_AND_ASSIGN(QueuedWebMouseWheelEvent); |
34 }; | 34 }; |
35 | 35 |
36 MouseWheelEventQueue::MouseWheelEventQueue(MouseWheelEventQueueClient* client, | 36 MouseWheelEventQueue::MouseWheelEventQueue(MouseWheelEventQueueClient* client, |
37 int64_t scroll_transaction_ms) | 37 bool enable_scroll_latching) |
38 : client_(client), | 38 : client_(client), |
39 needs_scroll_begin_(true), | 39 needs_scroll_begin_(true), |
40 needs_scroll_end_(false), | 40 needs_scroll_end_(false), |
41 scroll_transaction_ms_(scroll_transaction_ms), | 41 enable_scroll_latching_(enable_scroll_latching), |
42 scrolling_device_(blink::WebGestureDeviceUninitialized) { | 42 scrolling_device_(blink::WebGestureDeviceUninitialized) { |
43 DCHECK(client); | 43 DCHECK(client); |
| 44 scroll_transaction_ms_ = |
| 45 enable_scroll_latching_ ? kDefaultWheelScrollLatchingTransactionMs : 0; |
44 } | 46 } |
45 | 47 |
46 MouseWheelEventQueue::~MouseWheelEventQueue() { | 48 MouseWheelEventQueue::~MouseWheelEventQueue() { |
47 if (!wheel_queue_.empty()) | 49 if (!wheel_queue_.empty()) |
48 base::STLDeleteElements(&wheel_queue_); | 50 base::STLDeleteElements(&wheel_queue_); |
49 } | 51 } |
50 | 52 |
51 void MouseWheelEventQueue::QueueEvent( | 53 void MouseWheelEventQueue::QueueEvent( |
52 const MouseWheelEventWithLatencyInfo& event) { | 54 const MouseWheelEventWithLatencyInfo& event) { |
53 TRACE_EVENT0("input", "MouseWheelEventQueue::QueueEvent"); | 55 TRACE_EVENT0("input", "MouseWheelEventQueue::QueueEvent"); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 scroll_begin.data.scrollBegin.targetViewport = false; | 286 scroll_begin.data.scrollBegin.targetViewport = false; |
285 scroll_begin.data.scrollBegin.deltaHintUnits = | 287 scroll_begin.data.scrollBegin.deltaHintUnits = |
286 gesture_update.data.scrollUpdate.deltaUnits; | 288 gesture_update.data.scrollUpdate.deltaUnits; |
287 | 289 |
288 needs_scroll_begin_ = false; | 290 needs_scroll_begin_ = false; |
289 needs_scroll_end_ = true; | 291 needs_scroll_end_ = true; |
290 client_->ForwardGestureEventWithLatencyInfo(scroll_begin, ui::LatencyInfo()); | 292 client_->ForwardGestureEventWithLatencyInfo(scroll_begin, ui::LatencyInfo()); |
291 } | 293 } |
292 | 294 |
293 } // namespace content | 295 } // namespace content |
OLD | NEW |