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

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

Issue 2825853002: Improvements to uses of base::SmallMap (Closed)
Patch Set: Created 3 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
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_LATENCY_INFO_H_ 5 #ifndef UI_LATENCY_LATENCY_INFO_H_
6 #define UI_LATENCY_LATENCY_INFO_H_ 6 #define UI_LATENCY_LATENCY_INFO_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 base::TimeTicks last_event_time; 130 base::TimeTicks last_event_time;
131 }; 131 };
132 132
133 // Empirically determined constant based on a typical scroll sequence. 133 // Empirically determined constant based on a typical scroll sequence.
134 enum { kTypicalMaxComponentsPerLatencyInfo = 10 }; 134 enum { kTypicalMaxComponentsPerLatencyInfo = 10 };
135 135
136 enum : size_t { kMaxInputCoordinates = 2 }; 136 enum : size_t { kMaxInputCoordinates = 2 };
137 137
138 // Map a Latency Component (with a component-specific int64_t id) to a 138 // Map a Latency Component (with a component-specific int64_t id) to a
139 // component info. 139 // component info.
140 typedef base::SmallMap< 140 typedef base::small_map<
danakj 2017/04/18 21:35:50 typedef->using? This looks like a good contender
141 std::map<std::pair<LatencyComponentType, int64_t>, LatencyComponent>, 141 std::map<std::pair<LatencyComponentType, int64_t>, LatencyComponent>,
142 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; 142 kTypicalMaxComponentsPerLatencyInfo>
143 LatencyMap;
143 144
144 LatencyInfo(); 145 LatencyInfo();
145 LatencyInfo(const LatencyInfo& other); 146 LatencyInfo(const LatencyInfo& other);
146 LatencyInfo(SourceEventType type); 147 LatencyInfo(SourceEventType type);
147 ~LatencyInfo(); 148 ~LatencyInfo();
148 149
149 // For test only. 150 // For test only.
150 LatencyInfo(int64_t trace_id, bool terminated); 151 LatencyInfo(int64_t trace_id, bool terminated);
151 152
152 // Returns true if the vector |latency_info| is valid. Returns false 153 // Returns true if the vector |latency_info| is valid. Returns false
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 266
266 // This is declared here for use in gtest-based unit tests, but is defined in 267 // This is declared here for use in gtest-based unit tests, but is defined in
267 // //ui/latency:test_support target. 268 // //ui/latency:test_support target.
268 // Without this the default PrintTo template in gtest tries to pass LatencyInfo 269 // Without this the default PrintTo template in gtest tries to pass LatencyInfo
269 // by value, which leads to an alignment compile error on Windows. 270 // by value, which leads to an alignment compile error on Windows.
270 void PrintTo(const LatencyInfo& latency, ::std::ostream* os); 271 void PrintTo(const LatencyInfo& latency, ::std::ostream* os);
271 272
272 } // namespace ui 273 } // namespace ui
273 274
274 #endif // UI_LATENCY_LATENCY_INFO_H_ 275 #endif // UI_LATENCY_LATENCY_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698