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

Side by Side Diff: content/common/input/web_input_event_queue.h

Issue 2166703003: Implement Main Thread RAF Aligned Input (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_main_thread_queue
Patch Set: Rename NeedsMainFrame to SetNeedsMainFrame and move it to the render_widget Created 4 years, 3 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/public/common/content_features.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_QUEUE_H_ 5 #ifndef CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_QUEUE_H_
6 #define CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_QUEUE_H_ 6 #define CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_QUEUE_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 18 matching lines...) Expand all
29 29
30 if ((*last_event_iter)->CanCoalesceWith(*event.get())) { 30 if ((*last_event_iter)->CanCoalesceWith(*event.get())) {
31 (*last_event_iter)->CoalesceWith(*event.get()); 31 (*last_event_iter)->CoalesceWith(*event.get());
32 return; 32 return;
33 } 33 }
34 break; 34 break;
35 } 35 }
36 queue_.emplace_back(std::move(event)); 36 queue_.emplace_back(std::move(event));
37 } 37 }
38 38
39 const std::unique_ptr<T>& front() const { return queue_.front(); }
40 const std::unique_ptr<T>& at(size_t pos) const { return queue_.at(pos); }
41
39 std::unique_ptr<T> Pop() { 42 std::unique_ptr<T> Pop() {
40 std::unique_ptr<T> result; 43 std::unique_ptr<T> result;
41 if (!queue_.empty()) { 44 if (!queue_.empty()) {
42 result.reset(queue_.front().release()); 45 result.reset(queue_.front().release());
43 queue_.pop_front(); 46 queue_.pop_front();
44 } 47 }
45 return result; 48 return result;
46 } 49 }
47 50
48 bool empty() const { return queue_.empty(); } 51 bool empty() const { return queue_.empty(); }
49 52
50 size_t size() const { return queue_.size(); } 53 size_t size() const { return queue_.size(); }
51 54
52 private: 55 private:
53 typedef std::deque<std::unique_ptr<T>> EventQueue; 56 typedef std::deque<std::unique_ptr<T>> EventQueue;
54 EventQueue queue_; 57 EventQueue queue_;
55 58
56 DISALLOW_COPY_AND_ASSIGN(WebInputEventQueue); 59 DISALLOW_COPY_AND_ASSIGN(WebInputEventQueue);
57 }; 60 };
58 61
59 } // namespace content 62 } // namespace content
60 63
61 #endif // CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_QUEUE_H_ 64 #endif // CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_QUEUE_H_
OLDNEW
« no previous file with comments | « no previous file | content/public/common/content_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698