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

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

Issue 2429953002: Implement compositor thread VSync aligned event queue (Closed)
Patch Set: dtapuska's review: Non-template CompositorThreadEventQueue; Added blink_features.h; UMA only when e… 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/compositor_thread_event_queue.h
diff --git a/ui/events/blink/compositor_thread_event_queue.h b/ui/events/blink/compositor_thread_event_queue.h
new file mode 100644
index 0000000000000000000000000000000000000000..9ebc4e0eaaa20e25320638807e280a36da20537d
--- /dev/null
+++ b/ui/events/blink/compositor_thread_event_queue.h
@@ -0,0 +1,46 @@
+// 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_COMPOSITOR_THREAD_EVENT_QUEUE_H_
+#define UI_EVENTS_BLINK_COMPOSITOR_THREAD_EVENT_QUEUE_H_
+
+#include <deque>
+#include <memory>
+
+#include "ui/events/blink/event_with_callback.h"
+
+namespace ui {
+
+namespace test {
+class InputHandlerProxyEventQueueTest;
+}
+
+// CompositorThreadEventQueue is a coalescing queue. It will examine
+// the current events in the queue and will attempt to coalesce with
+// the last event.
+class CompositorThreadEventQueue {
+ public:
+ CompositorThreadEventQueue();
+ ~CompositorThreadEventQueue();
+
+ // Adds an event to the queue. The event may be coalesced with the last event.
+ void Queue(std::unique_ptr<EventWithCallback> event);
+
+ std::unique_ptr<EventWithCallback> Pop();
+
+ bool empty() const { return queue_.empty(); }
+
+ size_t size() const { return queue_.size(); }
+
+ private:
+ friend class test::InputHandlerProxyEventQueueTest;
+ typedef std::deque<std::unique_ptr<EventWithCallback>> EventQueue;
+ EventQueue queue_;
+
+ DISALLOW_COPY_AND_ASSIGN(CompositorThreadEventQueue);
+};
+
+} // namespace ui
+
+#endif // UI_EVENTS_BLINK_COMPOSITOR_THREAD_EVENT_QUEUE_H_

Powered by Google App Engine
This is Rietveld 408576698