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

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

Issue 2825853002: Improvements to uses of base::SmallMap (Closed)
Patch Set: Review comments 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
« no previous file with comments | « tools/gn/value.h ('k') | ui/ozone/platform/drm/common/drm_util.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_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>
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/flat_map.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "ui/gfx/geometry/point_f.h" 17 #include "ui/gfx/geometry/point_f.h"
18 18
19 #if !defined(OS_IOS) 19 #if !defined(OS_IOS)
20 #include "ipc/ipc_param_traits.h" // nogncheck 20 #include "ipc/ipc_param_traits.h" // nogncheck
21 #include "mojo/public/cpp/bindings/struct_traits.h" // nogncheck 21 #include "mojo/public/cpp/bindings/struct_traits.h" // nogncheck
22 #endif 22 #endif
23 23
24 namespace base { 24 namespace base {
25 namespace trace_event { 25 namespace trace_event {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // Average time of events that happened in this component. 123 // Average time of events that happened in this component.
124 base::TimeTicks event_time; 124 base::TimeTicks event_time;
125 // Count of events that happened in this component 125 // Count of events that happened in this component
126 uint32_t event_count; 126 uint32_t event_count;
127 // Time of the oldest event that happened in this component. 127 // Time of the oldest event that happened in this component.
128 base::TimeTicks first_event_time; 128 base::TimeTicks first_event_time;
129 // Time of the most recent event that happened in this component. 129 // Time of the most recent event that happened in this component.
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.
134 enum { kTypicalMaxComponentsPerLatencyInfo = 10 };
135
136 enum : size_t { kMaxInputCoordinates = 2 }; 133 enum : size_t { kMaxInputCoordinates = 2 };
137 134
138 // Map a Latency Component (with a component-specific int64_t id) to a 135 // Map a Latency Component (with a component-specific int64_t id) to a
139 // component info. 136 // component info.
140 typedef base::SmallMap< 137 using LatencyMap = base::flat_map<std::pair<LatencyComponentType, int64_t>,
141 std::map<std::pair<LatencyComponentType, int64_t>, LatencyComponent>, 138 LatencyComponent>;
142 kTypicalMaxComponentsPerLatencyInfo> LatencyMap;
143 139
144 LatencyInfo(); 140 LatencyInfo();
145 LatencyInfo(const LatencyInfo& other); 141 LatencyInfo(const LatencyInfo& other);
146 LatencyInfo(SourceEventType type); 142 LatencyInfo(SourceEventType type);
147 ~LatencyInfo(); 143 ~LatencyInfo();
148 144
149 // For test only. 145 // For test only.
150 LatencyInfo(int64_t trace_id, bool terminated); 146 LatencyInfo(int64_t trace_id, bool terminated);
151 147
152 // Returns true if the vector |latency_info| is valid. Returns false 148 // Returns true if the vector |latency_info| is valid. Returns false
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 261
266 // This is declared here for use in gtest-based unit tests, but is defined in 262 // This is declared here for use in gtest-based unit tests, but is defined in
267 // //ui/latency:test_support target. 263 // //ui/latency:test_support target.
268 // Without this the default PrintTo template in gtest tries to pass LatencyInfo 264 // Without this the default PrintTo template in gtest tries to pass LatencyInfo
269 // by value, which leads to an alignment compile error on Windows. 265 // by value, which leads to an alignment compile error on Windows.
270 void PrintTo(const LatencyInfo& latency, ::std::ostream* os); 266 void PrintTo(const LatencyInfo& latency, ::std::ostream* os);
271 267
272 } // namespace ui 268 } // namespace ui
273 269
274 #endif // UI_LATENCY_LATENCY_INFO_H_ 270 #endif // UI_LATENCY_LATENCY_INFO_H_
OLDNEW
« no previous file with comments | « tools/gn/value.h ('k') | ui/ozone/platform/drm/common/drm_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698