Chromium Code Reviews| Index: ui/events/blink/event_with_callback.h |
| diff --git a/ui/events/blink/event_with_callback.h b/ui/events/blink/event_with_callback.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7b14898812ffa9c80143234590b83ee461eb4865 |
| --- /dev/null |
| +++ b/ui/events/blink/event_with_callback.h |
| @@ -0,0 +1,66 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_EVENTS_BLINK_EVENT_WITH_CALLBACK_H_ |
| +#define UI_EVENTS_BLINK_EVENT_WITH_CALLBACK_H_ |
| + |
| +#include <list> |
| + |
| +#include "ui/events/blink/input_handler_proxy.h" |
| +#include "ui/events/latency_info.h" |
| + |
| +namespace ui { |
| + |
| +namespace test { |
| +class InputHandlerProxyEventQueueTest; |
| +} |
| + |
| +class EventWithCallback { |
| + public: |
| + EventWithCallback( |
| + ScopedWebInputEvent event, |
| + const LatencyInfo& latency, |
| + const InputHandlerProxy::EventDispositionCallback& callback); |
| + ~EventWithCallback(); |
| + |
| + bool CanCoalesceWith(const EventWithCallback& other) const WARN_UNUSED_RESULT; |
| + void CoalesceWith(EventWithCallback* other); |
| + |
| + const blink::WebInputEvent& event() const { return *event_; } |
| + const LatencyInfo latencyInfo() const { return latency_; } |
| + base::TimeTicks creationTimestamp() const { return creation_timestamp_; } |
| + base::TimeTicks lastCoalescedTimestamp() const { |
| + return last_coalesced_timestamp_; |
| + } |
| + size_t coalescedCount() const { return original_events_.size(); } |
| + |
| + void RunCallbacks(InputHandlerProxy::EventDisposition, |
| + const LatencyInfo& latency, |
| + std::unique_ptr<DidOverscrollParams>); |
| + |
| + private: |
| + friend class test::InputHandlerProxyEventQueueTest; |
| + struct OriginalEventWithCallback { |
| + OriginalEventWithCallback( |
| + ScopedWebInputEvent event, |
| + const InputHandlerProxy::EventDispositionCallback& callback); |
| + ~OriginalEventWithCallback(); |
| + ScopedWebInputEvent event_; |
| + InputHandlerProxy::EventDispositionCallback callback_; |
| + }; |
| + |
| + ScopedWebInputEvent event_; |
| + LatencyInfo latency_; |
| + std::list<OriginalEventWithCallback> original_events_; |
| + |
| + base::TimeTicks creation_timestamp_; |
| + base::TimeTicks last_coalesced_timestamp_; |
| + |
| + // Testing only |
| + static std::unique_ptr<base::TimeTicks> testing_timestamp_now_; |
|
dtapuska
2016/11/09 21:28:05
This is kind of clunky. I'd prefer and examples I
chongz
2016/11/11 21:52:04
Done.
|
| +}; |
| + |
| +} // namespace ui |
| + |
| +#endif // UI_EVENTS_BLINK_EVENT_WITH_CALLBACK_H_ |