Chromium Code Reviews| 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 const blink::WebInputEvent& event() const { return *event_; } | |
| 32 const LatencyInfo latencyInfo() const { return latency_; } | |
|
enne (OOO)
2016/11/14 23:59:46
Should this interface be in Chromium style, e.g. l
chongz
2016/11/17 21:36:13
Done.
| |
| 33 base::TimeTicks creationTimestamp() const { return creation_timestamp_; } | |
| 34 base::TimeTicks lastCoalescedTimestamp() const { | |
| 35 return last_coalesced_timestamp_; | |
| 36 } | |
| 37 size_t coalescedCount() const { return original_events_.size(); } | |
| 38 | |
| 39 void RunCallbacks(InputHandlerProxy::EventDisposition, | |
| 40 const LatencyInfo& latency, | |
| 41 std::unique_ptr<DidOverscrollParams>); | |
| 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 |