| 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 "ui/events/blink/compositor_thread_event_queue.h" | 5 #include "ui/events/blink/compositor_thread_event_queue.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "ui/events/blink/blink_event_util.h" | 8 #include "ui/events/blink/blink_event_util.h" |
| 9 #include "ui/events/blink/web_input_event_traits.h" | 9 #include "ui/events/blink/web_input_event_traits.h" |
| 10 | 10 |
| 11 namespace ui { | 11 namespace ui { |
| 12 | 12 |
| 13 CompositorThreadEventQueue::CompositorThreadEventQueue() {} | 13 CompositorThreadEventQueue::CompositorThreadEventQueue() {} |
| 14 | 14 |
| 15 CompositorThreadEventQueue::~CompositorThreadEventQueue() {} | 15 CompositorThreadEventQueue::~CompositorThreadEventQueue() {} |
| 16 | 16 |
| 17 void CompositorThreadEventQueue::Queue( | 17 void CompositorThreadEventQueue::Queue( |
| 18 std::unique_ptr<EventWithCallback> new_event, | 18 std::unique_ptr<EventWithCallback> new_event, |
| 19 base::TimeTicks timestamp_now) { | 19 base::TimeTicks timestamp_now) { |
| 20 if (queue_.empty() || !IsContinuousGestureEvent(new_event->event().type) || | 20 if (queue_.empty() || !IsContinuousGestureEvent(new_event->event().type()) || |
| 21 !IsCompatibleScrollorPinch(ToWebGestureEvent(new_event->event()), | 21 !IsCompatibleScrollorPinch(ToWebGestureEvent(new_event->event()), |
| 22 ToWebGestureEvent(queue_.back()->event()))) { | 22 ToWebGestureEvent(queue_.back()->event()))) { |
| 23 queue_.emplace_back(std::move(new_event)); | 23 queue_.emplace_back(std::move(new_event)); |
| 24 return; | 24 return; |
| 25 } | 25 } |
| 26 | 26 |
| 27 if (queue_.back()->CanCoalesceWith(*new_event)) { | 27 if (queue_.back()->CanCoalesceWith(*new_event)) { |
| 28 queue_.back()->CoalesceWith(new_event.get(), timestamp_now); | 28 queue_.back()->CoalesceWith(new_event.get(), timestamp_now); |
| 29 return; | 29 return; |
| 30 } | 30 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 std::unique_ptr<EventWithCallback> CompositorThreadEventQueue::Pop() { | 85 std::unique_ptr<EventWithCallback> CompositorThreadEventQueue::Pop() { |
| 86 std::unique_ptr<EventWithCallback> result; | 86 std::unique_ptr<EventWithCallback> result; |
| 87 if (!queue_.empty()) { | 87 if (!queue_.empty()) { |
| 88 result = std::move(queue_.front()); | 88 result = std::move(queue_.front()); |
| 89 queue_.pop_front(); | 89 queue_.pop_front(); |
| 90 } | 90 } |
| 91 return result; | 91 return result; |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace ui | 94 } // namespace ui |
| OLD | NEW |