OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_EVENTS_BLINK_EVENT_WITH_CALLBACK_H_ |
| 6 #define UI_EVENTS_BLINK_EVENT_WITH_CALLBACK_H_ |
| 7 |
| 8 #include <list> |
| 9 |
| 10 #include "ui/events/blink/input_handler_proxy.h" |
| 11 #include "ui/events/latency_info.h" |
| 12 |
| 13 namespace ui { |
| 14 |
| 15 namespace test { |
| 16 class InputHandlerProxyEventQueueTest; |
| 17 } |
| 18 |
| 19 class EventWithCallback { |
| 20 public: |
| 21 EventWithCallback( |
| 22 ScopedWebInputEvent event, |
| 23 const LatencyInfo& latency, |
| 24 base::TimeTicks timestamp_now, |
| 25 const InputHandlerProxy::EventDispositionCallback& callback); |
| 26 ~EventWithCallback(); |
| 27 |
| 28 bool CanCoalesceWith(const EventWithCallback& other) const WARN_UNUSED_RESULT; |
| 29 void CoalesceWith(EventWithCallback* other, base::TimeTicks timestamp_now); |
| 30 |
| 31 void RunCallbacks(InputHandlerProxy::EventDisposition, |
| 32 const LatencyInfo& latency, |
| 33 std::unique_ptr<DidOverscrollParams>); |
| 34 |
| 35 const blink::WebInputEvent& event() const { return *event_; } |
| 36 const LatencyInfo latency_info() const { return latency_; } |
| 37 base::TimeTicks creation_timestamp() const { return creation_timestamp_; } |
| 38 base::TimeTicks last_coalesced_timestamp() const { |
| 39 return last_coalesced_timestamp_; |
| 40 } |
| 41 size_t coalesced_count() const { return original_events_.size(); } |
| 42 |
| 43 private: |
| 44 friend class test::InputHandlerProxyEventQueueTest; |
| 45 struct OriginalEventWithCallback { |
| 46 OriginalEventWithCallback( |
| 47 ScopedWebInputEvent event, |
| 48 const InputHandlerProxy::EventDispositionCallback& callback); |
| 49 ~OriginalEventWithCallback(); |
| 50 ScopedWebInputEvent event_; |
| 51 InputHandlerProxy::EventDispositionCallback callback_; |
| 52 }; |
| 53 |
| 54 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); |
| 55 |
| 56 ScopedWebInputEvent event_; |
| 57 LatencyInfo latency_; |
| 58 std::list<OriginalEventWithCallback> original_events_; |
| 59 |
| 60 base::TimeTicks creation_timestamp_; |
| 61 base::TimeTicks last_coalesced_timestamp_; |
| 62 }; |
| 63 |
| 64 } // namespace ui |
| 65 |
| 66 #endif // UI_EVENTS_BLINK_EVENT_WITH_CALLBACK_H_ |
OLD | NEW |