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

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

Issue 2429953002: Implement compositor thread VSync aligned event queue (Closed)
Patch Set: dtapuska&enne's review: Call |Now()| once per loop; Chromium style; Remove parameterized test 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
« no previous file with comments | « ui/events/blink/compositor_thread_event_queue.h ('k') | ui/events/blink/event_with_callback.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/blink/compositor_thread_event_queue.cc
diff --git a/ui/events/blink/compositor_thread_event_queue.cc b/ui/events/blink/compositor_thread_event_queue.cc
new file mode 100644
index 0000000000000000000000000000000000000000..58290fd98b2e01e27b0da3a6c4806be98293a0a5
--- /dev/null
+++ b/ui/events/blink/compositor_thread_event_queue.cc
@@ -0,0 +1,34 @@
+// 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.
+
+#include "ui/events/blink/compositor_thread_event_queue.h"
+
+namespace ui {
+
+CompositorThreadEventQueue::CompositorThreadEventQueue() {}
+
+CompositorThreadEventQueue::~CompositorThreadEventQueue() {}
+
+// TODO(chongz): Support coalescing events across interleaved boundaries.
+// https://crbug.com/661601
+void CompositorThreadEventQueue::Queue(std::unique_ptr<EventWithCallback> event,
+ base::TimeTicks timestamp_now) {
+ if (!queue_.empty() && queue_.back()->CanCoalesceWith(*event)) {
+ queue_.back()->CoalesceWith(event.get(), timestamp_now);
+ return;
+ }
+
+ queue_.emplace_back(std::move(event));
+}
+
+std::unique_ptr<EventWithCallback> CompositorThreadEventQueue::Pop() {
+ std::unique_ptr<EventWithCallback> result;
+ if (!queue_.empty()) {
+ result.reset(queue_.front().release());
+ queue_.pop_front();
+ }
+ return result;
+}
+
+} // namespace ui
« no previous file with comments | « ui/events/blink/compositor_thread_event_queue.h ('k') | ui/events/blink/event_with_callback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698