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

Side by Side Diff: ui/events/latency_info.h

Issue 1287103004: Sync ui/events to chromium @ https://codereview.chromium.org/1210203002 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 4 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 | « ui/events/keycodes/xkb_keysym.h ('k') | ui/events/latency_info.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 UI_EVENTS_LATENCY_INFO_H_ 5 #ifndef UI_EVENTS_LATENCY_INFO_H_
6 #define UI_EVENTS_LATENCY_INFO_H_ 6 #define UI_EVENTS_LATENCY_INFO_H_
7 7
8 #include <string>
8 #include <utility> 9 #include <utility>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "base/containers/small_map.h" 13 #include "base/containers/small_map.h"
13 #include "base/time/time.h" 14 #include "base/time/time.h"
14 #include "ui/events/events_base_export.h" 15 #include "ui/events/events_base_export.h"
15 16
16 namespace ui { 17 namespace ui {
17 18
18 enum LatencyComponentType { 19 enum LatencyComponentType {
19 // ---------------------------BEGIN COMPONENT------------------------------- 20 // ---------------------------BEGIN COMPONENT-------------------------------
20 // BEGIN COMPONENT is when we show the latency begin in chrome://tracing. 21 // BEGIN COMPONENT is when we show the latency begin in chrome://tracing.
21 // Timestamp when the input event is sent from RenderWidgetHost to renderer. 22 // Timestamp when the input event is sent from RenderWidgetHost to renderer.
22 INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 23 INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
23 // Timestamp when the input event is received in plugin. 24 // Timestamp when the input event is received in plugin.
24 INPUT_EVENT_LATENCY_BEGIN_PLUGIN_COMPONENT, 25 INPUT_EVENT_LATENCY_BEGIN_PLUGIN_COMPONENT,
25 // Timestamp when a scroll update for the main thread is begun. 26 // In threaded scrolling, main thread scroll listener update is async to
26 INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT, 27 // scroll processing in impl thread. This is the timestamp when we consider
28 // the main thread scroll listener update is begun.
29 LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT,
27 // ---------------------------NORMAL COMPONENT------------------------------- 30 // ---------------------------NORMAL COMPONENT-------------------------------
28 // The original timestamp of the touch event which converts to scroll update. 31 // The original timestamp of the touch event which converts to scroll update.
29 INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, 32 INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT,
30 // The original timestamp of the touch event which converts to the *first* 33 // The original timestamp of the touch event which converts to the *first*
31 // scroll update in a scroll gesture sequence. 34 // scroll update in a scroll gesture sequence.
32 INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, 35 INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
33 // Original timestamp for input event (e.g. timestamp from kernel). 36 // Original timestamp for input event (e.g. timestamp from kernel).
34 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 37 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
35 // Timestamp when the UI event is created. 38 // Timestamp when the UI event is created.
36 INPUT_EVENT_LATENCY_UI_COMPONENT, 39 INPUT_EVENT_LATENCY_UI_COMPONENT,
37 // This is special component indicating there is rendering scheduled for 40 // This is special component indicating there is rendering scheduled for
38 // the event associated with this LatencyInfo on main thread. 41 // the event associated with this LatencyInfo on main thread.
39 INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, 42 INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT,
40 // This is special component indicating there is rendering scheduled for 43 // This is special component indicating there is rendering scheduled for
41 // the event associated with this LatencyInfo on impl thread. 44 // the event associated with this LatencyInfo on impl thread.
42 INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 45 INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT,
43 // Timestamp when a scroll update is forwarded to the main thread. 46 // Timestamp when a scroll update is forwarded to the main thread.
44 INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT, 47 INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT,
45 // Timestamp when the event's ack is received by the RWH. 48 // Timestamp when the event's ack is received by the RWH.
46 INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 49 INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT,
47 // Frame number when a window snapshot was requested. The snapshot 50 // Frame number when a window snapshot was requested. The snapshot
48 // is taken when the rendering results actually reach the screen. 51 // is taken when the rendering results actually reach the screen.
49 WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, 52 WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT,
50 // Frame number for a snapshot requested via
51 // gpuBenchmarking.beginWindowSnapshotPNG
52 // TODO(vkuzkokov): remove when patch adding this hits Stable
53 WINDOW_OLD_SNAPSHOT_FRAME_NUMBER_COMPONENT,
54 // Timestamp when a tab is requested to be shown. 53 // Timestamp when a tab is requested to be shown.
55 TAB_SHOW_COMPONENT, 54 TAB_SHOW_COMPONENT,
56 // Timestamp when the frame is swapped in renderer. 55 // Timestamp when the frame is swapped in renderer.
57 INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 56 INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT,
58 // Timestamp of when the browser process receives a buffer swap notification 57 // Timestamp of when the browser process receives a buffer swap notification
59 // from the renderer. 58 // from the renderer.
60 INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 59 INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT,
61 // Timestamp of when the gpu service began swap buffers, unlike 60 // Timestamp of when the gpu service began swap buffers, unlike
62 // INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT which measures after. 61 // INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT which measures after.
63 INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 62 INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 139
141 // Add LatencyComponents that are in |other| but not in |this|. 140 // Add LatencyComponents that are in |other| but not in |this|.
142 void AddNewLatencyFrom(const LatencyInfo& other); 141 void AddNewLatencyFrom(const LatencyInfo& other);
143 142
144 // Modifies the current sequence number for a component, and adds a new 143 // Modifies the current sequence number for a component, and adds a new
145 // sequence number with the current timestamp. 144 // sequence number with the current timestamp.
146 void AddLatencyNumber(LatencyComponentType component, 145 void AddLatencyNumber(LatencyComponentType component,
147 int64 id, 146 int64 id,
148 int64 component_sequence_number); 147 int64 component_sequence_number);
149 148
149 // Similar to |AddLatencyNumber|, and also appends |trace_name_str| to
150 // the trace event's name.
151 // This function should only be called when adding a BEGIN component.
152 void AddLatencyNumberWithTraceName(LatencyComponentType component,
153 int64 id,
154 int64 component_sequence_number,
155 const char* trace_name_str);
156
150 // Modifies the current sequence number and adds a certain number of events 157 // Modifies the current sequence number and adds a certain number of events
151 // for a specific component. 158 // for a specific component.
152 void AddLatencyNumberWithTimestamp(LatencyComponentType component, 159 void AddLatencyNumberWithTimestamp(LatencyComponentType component,
153 int64 id, 160 int64 id,
154 int64 component_sequence_number, 161 int64 component_sequence_number,
155 base::TimeTicks time, 162 base::TimeTicks time,
156 uint32 event_count); 163 uint32 event_count);
157 164
165 void AddLatencyNumberWithTimestampImpl(LatencyComponentType component,
166 int64 id,
167 int64 component_sequence_number,
168 base::TimeTicks time,
169 uint32 event_count,
170 const char* trace_name_str);
171
158 // Returns true if the a component with |type| and |id| is found in 172 // Returns true if the a component with |type| and |id| is found in
159 // the latency_components and the component is stored to |output| if 173 // the latency_components and the component is stored to |output| if
160 // |output| is not NULL. Returns false if no such component is found. 174 // |output| is not NULL. Returns false if no such component is found.
161 bool FindLatency(LatencyComponentType type, 175 bool FindLatency(LatencyComponentType type,
162 int64 id, 176 int64 id,
163 LatencyComponent* output) const; 177 LatencyComponent* output) const;
164 178
165 void RemoveLatency(LatencyComponentType type); 179 void RemoveLatency(LatencyComponentType type);
166 180
167 void Clear(); 181 void Clear();
168 182
169 // Records the |event_type| in trace buffer as TRACE_EVENT_ASYNC_STEP. 183 // Shown as part of the name of the trace event for this LatencyInfo.
170 void TraceEventType(const char* event_type); 184 // String is empty if no tracing is enabled.
185 std::string trace_name;
171 186
172 LatencyMap latency_components; 187 LatencyMap latency_components;
173 188
174 // These coordinates represent window coordinates of the original input event. 189 // These coordinates represent window coordinates of the original input event.
175 uint32 input_coordinates_size; 190 uint32 input_coordinates_size;
176 InputCoordinate input_coordinates[kMaxInputCoordinates]; 191 InputCoordinate input_coordinates[kMaxInputCoordinates];
177 192
178 // The unique id for matching the ASYNC_BEGIN/END trace event. 193 // The unique id for matching the ASYNC_BEGIN/END trace event.
179 int64 trace_id; 194 int64 trace_id;
180 // Whether a terminal component has been added. 195 // Whether a terminal component has been added.
181 bool terminated; 196 bool terminated;
182 }; 197 };
183 198
184 } // namespace ui 199 } // namespace ui
185 200
186 #endif // UI_EVENTS_LATENCY_INFO_H_ 201 #endif // UI_EVENTS_LATENCY_INFO_H_
OLDNEW
« no previous file with comments | « ui/events/keycodes/xkb_keysym.h ('k') | ui/events/latency_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698