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

Side by Side Diff: ui/events/blink/compositor_thread_event_queue.cc

Issue 2695603004: [VSync Queue] Add tracing for event queuing time and coalesced count (Closed)
Patch Set: Add comments for nestable tracing and |first_original_event()| Created 3 years, 10 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 | ui/events/blink/event_with_callback.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 #include "ui/events/blink/compositor_thread_event_queue.h" 5 #include "ui/events/blink/compositor_thread_event_queue.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/trace_event/trace_event.h"
8 #include "ui/events/blink/blink_event_util.h" 9 #include "ui/events/blink/blink_event_util.h"
9 #include "ui/events/blink/web_input_event_traits.h" 10 #include "ui/events/blink/web_input_event_traits.h"
10 11
11 namespace ui { 12 namespace ui {
12 13
13 CompositorThreadEventQueue::CompositorThreadEventQueue() {} 14 CompositorThreadEventQueue::CompositorThreadEventQueue() {}
14 15
15 CompositorThreadEventQueue::~CompositorThreadEventQueue() {} 16 CompositorThreadEventQueue::~CompositorThreadEventQueue() {}
16 17
17 void CompositorThreadEventQueue::Queue( 18 void CompositorThreadEventQueue::Queue(
18 std::unique_ptr<EventWithCallback> new_event, 19 std::unique_ptr<EventWithCallback> new_event,
19 base::TimeTicks timestamp_now) { 20 base::TimeTicks timestamp_now) {
20 if (queue_.empty() || !IsContinuousGestureEvent(new_event->event().type()) || 21 if (queue_.empty() || !IsContinuousGestureEvent(new_event->event().type()) ||
21 !IsCompatibleScrollorPinch(ToWebGestureEvent(new_event->event()), 22 !IsCompatibleScrollorPinch(ToWebGestureEvent(new_event->event()),
22 ToWebGestureEvent(queue_.back()->event()))) { 23 ToWebGestureEvent(queue_.back()->event()))) {
24 if (new_event->first_original_event()) {
25 // Trace could be nested as there might be multiple events in queue.
26 // e.g. |ScrollUpdate|, |ScrollEnd|, and another scroll sequence.
27 TRACE_EVENT_NESTABLE_ASYNC_BEGIN0("input",
28 "CompositorThreadEventQueue::Queue",
29 new_event->first_original_event());
30 }
23 queue_.emplace_back(std::move(new_event)); 31 queue_.emplace_back(std::move(new_event));
24 return; 32 return;
25 } 33 }
26 34
27 if (queue_.back()->CanCoalesceWith(*new_event)) { 35 if (queue_.back()->CanCoalesceWith(*new_event)) {
28 queue_.back()->CoalesceWith(new_event.get(), timestamp_now); 36 queue_.back()->CoalesceWith(new_event.get(), timestamp_now);
29 return; 37 return;
30 } 38 }
31 39
32 // Extract the last event in queue. 40 // Extract the last event in queue.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 queue_.emplace_back(std::move(scroll_event)); 89 queue_.emplace_back(std::move(scroll_event));
82 queue_.emplace_back(std::move(pinch_event)); 90 queue_.emplace_back(std::move(pinch_event));
83 } 91 }
84 92
85 std::unique_ptr<EventWithCallback> CompositorThreadEventQueue::Pop() { 93 std::unique_ptr<EventWithCallback> CompositorThreadEventQueue::Pop() {
86 std::unique_ptr<EventWithCallback> result; 94 std::unique_ptr<EventWithCallback> result;
87 if (!queue_.empty()) { 95 if (!queue_.empty()) {
88 result = std::move(queue_.front()); 96 result = std::move(queue_.front());
89 queue_.pop_front(); 97 queue_.pop_front();
90 } 98 }
99
100 if (result->first_original_event()) {
101 TRACE_EVENT_NESTABLE_ASYNC_END2(
102 "input", "CompositorThreadEventQueue::Queue",
103 result->first_original_event(), "type", result->event().type(),
104 "coalesced_count", result->coalesced_count());
105 }
91 return result; 106 return result;
92 } 107 }
93 108
94 } // namespace ui 109 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/events/blink/event_with_callback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698