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

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

Issue 1898033003: Revert https://codereview.chromium.org/1871233002 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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/ipc/latency_info_param_traits_unittest.cc ('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_LATENCY_INFO_LATENCY_INFO_H_ 5 #ifndef UI_EVENTS_LATENCY_INFO_H_
6 #define UI_LATENCY_INFO_LATENCY_INFO_H_ 6 #define UI_EVENTS_LATENCY_INFO_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/containers/small_map.h" 15 #include "base/containers/small_map.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
18 #include "ui/latency_info/latency_info_export.h" 18 #include "ui/events/events_base_export.h"
19 19
20 #if !defined(OS_IOS) 20 #if !defined(OS_IOS)
21 #include "ipc/ipc_param_traits.h" // nogncheck 21 #include "ipc/ipc_param_traits.h" // nogncheck
22 #endif 22 #endif
23 23
24 namespace ui { 24 namespace ui {
25 25
26 // When adding new components, or new metrics based on LatencyInfo, 26 // When adding new components, or new metrics based on LatencyInfo,
27 // please update latency_info.dot. 27 // please update latency_info.dot.
28 enum LatencyComponentType { 28 enum LatencyComponentType {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // This component indicates that the input causes a commit to be scheduled 90 // This component indicates that the input causes a commit to be scheduled
91 // but the commit failed. 91 // but the commit failed.
92 INPUT_EVENT_LATENCY_TERMINATED_COMMIT_FAILED_COMPONENT, 92 INPUT_EVENT_LATENCY_TERMINATED_COMMIT_FAILED_COMPONENT,
93 // This component indicates that the input causes a commit to be scheduled 93 // This component indicates that the input causes a commit to be scheduled
94 // but the commit was aborted since it carried no new information. 94 // but the commit was aborted since it carried no new information.
95 INPUT_EVENT_LATENCY_TERMINATED_COMMIT_NO_UPDATE_COMPONENT, 95 INPUT_EVENT_LATENCY_TERMINATED_COMMIT_NO_UPDATE_COMPONENT,
96 // This component indicates that the input causes a swap to be scheduled 96 // This component indicates that the input causes a swap to be scheduled
97 // but the swap failed. 97 // but the swap failed.
98 INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT, 98 INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT,
99 LATENCY_COMPONENT_TYPE_LAST = 99 LATENCY_COMPONENT_TYPE_LAST =
100 INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT, 100 INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT,
101 }; 101 };
102 102
103 class LATENCY_INFO_EXPORT LatencyInfo { 103 class EVENTS_BASE_EXPORT LatencyInfo {
104 public: 104 public:
105 struct LatencyComponent { 105 struct LatencyComponent {
106 // Nondecreasing number that can be used to determine what events happened 106 // Nondecreasing number that can be used to determine what events happened
107 // in the component at the time this struct was sent on to the next 107 // in the component at the time this struct was sent on to the next
108 // component. 108 // component.
109 int64_t sequence_number; 109 int64_t sequence_number;
110 // Average time of events that happened in this component. 110 // Average time of events that happened in this component.
111 base::TimeTicks event_time; 111 base::TimeTicks event_time;
112 // Count of events that happened in this component 112 // Count of events that happened in this component
113 uint32_t event_count; 113 uint32_t event_count;
114 }; 114 };
115 115
116 struct LATENCY_INFO_EXPORT InputCoordinate { 116 struct EVENTS_BASE_EXPORT InputCoordinate {
117 InputCoordinate(); 117 InputCoordinate();
118 InputCoordinate(float x, float y); 118 InputCoordinate(float x, float y);
119 119
120 float x; 120 float x;
121 float y; 121 float y;
122 }; 122 };
123 123
124 // Empirically determined constant based on a typical scroll sequence. 124 // Empirically determined constant based on a typical scroll sequence.
125 enum { kTypicalMaxComponentsPerLatencyInfo = 10 }; 125 enum { kTypicalMaxComponentsPerLatencyInfo = 10 };
126 126
127 enum { kMaxInputCoordinates = 2 }; 127 enum { kMaxInputCoordinates = 2 };
128 128
129 // Map a Latency Component (with a component-specific int64_t id) to a 129 // Map a Latency Component (with a component-specific int64_t id) to a
130 // component info. 130 // component info.
131 typedef base::SmallMap< 131 typedef base::SmallMap<
132 std::map<std::pair<LatencyComponentType, int64_t>, LatencyComponent>, 132 std::map<std::pair<LatencyComponentType, int64_t>, LatencyComponent>,
133 kTypicalMaxComponentsPerLatencyInfo> 133 kTypicalMaxComponentsPerLatencyInfo> LatencyMap;
134 LatencyMap;
135 134
136 LatencyInfo(); 135 LatencyInfo();
137 LatencyInfo(const LatencyInfo& other); 136 LatencyInfo(const LatencyInfo& other);
138 ~LatencyInfo(); 137 ~LatencyInfo();
139 138
140 // For test only. 139 // For test only.
141 LatencyInfo(int64_t trace_id, bool terminated); 140 LatencyInfo(int64_t trace_id, bool terminated);
142 141
143 // Returns true if the vector |latency_info| is valid. Returns false 142 // Returns true if the vector |latency_info| is valid. Returns false
144 // if it is not valid and log the |referring_msg|. 143 // if it is not valid and log the |referring_msg|.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // Whether a terminal component has been added. 233 // Whether a terminal component has been added.
235 bool terminated_; 234 bool terminated_;
236 235
237 #if !defined(OS_IOS) 236 #if !defined(OS_IOS)
238 friend struct IPC::ParamTraits<ui::LatencyInfo>; 237 friend struct IPC::ParamTraits<ui::LatencyInfo>;
239 #endif 238 #endif
240 }; 239 };
241 240
242 } // namespace ui 241 } // namespace ui
243 242
244 #endif // UI_LATENCY_INFO_LATENCY_INFO_H_ 243 #endif // UI_EVENTS_LATENCY_INFO_H_
OLDNEW
« no previous file with comments | « ui/events/ipc/latency_info_param_traits_unittest.cc ('k') | ui/events/latency_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698