| OLD | NEW |
| 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 <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/events/events_base_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 #include "mojo/public/cpp/bindings/struct_traits.h" // nogncheck |
| 22 #endif | 23 #endif |
| 23 | 24 |
| 24 namespace ui { | 25 namespace ui { |
| 25 | 26 |
| 27 #if !defined(OS_IOS) |
| 28 namespace mojom { |
| 29 class LatencyInfo; |
| 30 } |
| 31 #endif |
| 32 |
| 26 // When adding new components, or new metrics based on LatencyInfo, | 33 // When adding new components, or new metrics based on LatencyInfo, |
| 27 // please update latency_info.dot. | 34 // please update latency_info.dot. |
| 28 enum LatencyComponentType { | 35 enum LatencyComponentType { |
| 29 // ---------------------------BEGIN COMPONENT------------------------------- | 36 // ---------------------------BEGIN COMPONENT------------------------------- |
| 30 // BEGIN COMPONENT is when we show the latency begin in chrome://tracing. | 37 // BEGIN COMPONENT is when we show the latency begin in chrome://tracing. |
| 31 // Timestamp when the input event is sent from RenderWidgetHost to renderer. | 38 // Timestamp when the input event is sent from RenderWidgetHost to renderer. |
| 32 INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, | 39 INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, |
| 33 // In threaded scrolling, main thread scroll listener update is async to | 40 // In threaded scrolling, main thread scroll listener update is async to |
| 34 // scroll processing in impl thread. This is the timestamp when we consider | 41 // scroll processing in impl thread. This is the timestamp when we consider |
| 35 // the main thread scroll listener update is begun. | 42 // the main thread scroll listener update is begun. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 InputCoordinate(); | 129 InputCoordinate(); |
| 123 InputCoordinate(float x, float y); | 130 InputCoordinate(float x, float y); |
| 124 | 131 |
| 125 float x; | 132 float x; |
| 126 float y; | 133 float y; |
| 127 }; | 134 }; |
| 128 | 135 |
| 129 // Empirically determined constant based on a typical scroll sequence. | 136 // Empirically determined constant based on a typical scroll sequence. |
| 130 enum { kTypicalMaxComponentsPerLatencyInfo = 10 }; | 137 enum { kTypicalMaxComponentsPerLatencyInfo = 10 }; |
| 131 | 138 |
| 132 enum { kMaxInputCoordinates = 2 }; | 139 enum : size_t { kMaxInputCoordinates = 2 }; |
| 133 | 140 |
| 134 // Map a Latency Component (with a component-specific int64_t id) to a | 141 // Map a Latency Component (with a component-specific int64_t id) to a |
| 135 // component info. | 142 // component info. |
| 136 typedef base::SmallMap< | 143 typedef base::SmallMap< |
| 137 std::map<std::pair<LatencyComponentType, int64_t>, LatencyComponent>, | 144 std::map<std::pair<LatencyComponentType, int64_t>, LatencyComponent>, |
| 138 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; | 145 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; |
| 139 | 146 |
| 140 LatencyInfo(); | 147 LatencyInfo(); |
| 141 LatencyInfo(const LatencyInfo& other); | 148 LatencyInfo(const LatencyInfo& other); |
| 142 ~LatencyInfo(); | 149 ~LatencyInfo(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 240 |
| 234 // The unique id for matching the ASYNC_BEGIN/END trace event. | 241 // The unique id for matching the ASYNC_BEGIN/END trace event. |
| 235 int64_t trace_id_; | 242 int64_t trace_id_; |
| 236 // Whether this event has been coalesced into another event. | 243 // Whether this event has been coalesced into another event. |
| 237 bool coalesced_; | 244 bool coalesced_; |
| 238 // Whether a terminal component has been added. | 245 // Whether a terminal component has been added. |
| 239 bool terminated_; | 246 bool terminated_; |
| 240 | 247 |
| 241 #if !defined(OS_IOS) | 248 #if !defined(OS_IOS) |
| 242 friend struct IPC::ParamTraits<ui::LatencyInfo>; | 249 friend struct IPC::ParamTraits<ui::LatencyInfo>; |
| 250 friend struct mojo::StructTraits<ui::mojom::LatencyInfo, ui::LatencyInfo>; |
| 243 #endif | 251 #endif |
| 244 }; | 252 }; |
| 245 | 253 |
| 246 } // namespace ui | 254 } // namespace ui |
| 247 | 255 |
| 248 #endif // UI_EVENTS_LATENCY_INFO_H_ | 256 #endif // UI_EVENTS_LATENCY_INFO_H_ |
| OLD | NEW |