Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(931)

Unified Diff: ui/events/blink/event_with_callback.h

Issue 2429953002: Implement compositor thread VSync aligned event queue (Closed)
Patch Set: dtapuska's review: Use TickClock; Remove compositor_event_queue_enabled_; Nits Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..90c6690652857609053841ef2be5ab77f5e4529a
--- /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,
+ base::TimeTicks timestamp_now,
+ const InputHandlerProxy::EventDispositionCallback& callback);
+ ~EventWithCallback();
+
+ bool CanCoalesceWith(const EventWithCallback& other) const WARN_UNUSED_RESULT;
+ void CoalesceWith(EventWithCallback* other, base::TimeTicks timestamp_now);
+
+ const blink::WebInputEvent& event() const { return *event_; }
+ 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.
+ 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_;
+ };
+
+ void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock);
+
+ ScopedWebInputEvent event_;
+ LatencyInfo latency_;
+ std::list<OriginalEventWithCallback> original_events_;
+
+ base::TimeTicks creation_timestamp_;
+ base::TimeTicks last_coalesced_timestamp_;
+};
+
+} // namespace ui
+
+#endif // UI_EVENTS_BLINK_EVENT_WITH_CALLBACK_H_

Powered by Google App Engine
This is Rietveld 408576698