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

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: Fix unittest: Add MessageLoop attribuate 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
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_EVENT_NESTABLE_ASYNC_BEGIN0("input",
tdresser 2017/02/16 13:44:18 In what case would these nest?
chongz 2017/02/16 15:08:58 Added comments. // Trace could be nested as there
26 "CompositorThreadEventQueue::Queue",
27 new_event->first_original_event());
28 }
23 queue_.emplace_back(std::move(new_event)); 29 queue_.emplace_back(std::move(new_event));
24 return; 30 return;
25 } 31 }
26 32
27 if (queue_.back()->CanCoalesceWith(*new_event)) { 33 if (queue_.back()->CanCoalesceWith(*new_event)) {
28 queue_.back()->CoalesceWith(new_event.get(), timestamp_now); 34 queue_.back()->CoalesceWith(new_event.get(), timestamp_now);
29 return; 35 return;
30 } 36 }
31 37
32 // Extract the last event in queue. 38 // 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)); 87 queue_.emplace_back(std::move(scroll_event));
82 queue_.emplace_back(std::move(pinch_event)); 88 queue_.emplace_back(std::move(pinch_event));
83 } 89 }
84 90
85 std::unique_ptr<EventWithCallback> CompositorThreadEventQueue::Pop() { 91 std::unique_ptr<EventWithCallback> CompositorThreadEventQueue::Pop() {
86 std::unique_ptr<EventWithCallback> result; 92 std::unique_ptr<EventWithCallback> result;
87 if (!queue_.empty()) { 93 if (!queue_.empty()) {
88 result = std::move(queue_.front()); 94 result = std::move(queue_.front());
89 queue_.pop_front(); 95 queue_.pop_front();
90 } 96 }
97
98 if (result->first_original_event()) {
99 TRACE_EVENT_NESTABLE_ASYNC_END2(
100 "input", "CompositorThreadEventQueue::Queue",
101 result->first_original_event(), "type", result->event().type(),
102 "coalesced_count", result->coalesced_count());
103 }
91 return result; 104 return result;
92 } 105 }
93 106
94 } // namespace ui 107 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/events/blink/event_with_callback.h » ('j') | ui/events/blink/event_with_callback.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698