| 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 <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/containers/small_map.h" | 12 #include "base/containers/small_map.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "ui/events/events_base_export.h" | 14 #include "ui/events/events_base_export.h" |
| 15 #include "ui/gfx/point_f.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, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // Nondecreasing number that can be used to determine what events happened | 89 // Nondecreasing number that can be used to determine what events happened |
| 89 // in the component at the time this struct was sent on to the next | 90 // in the component at the time this struct was sent on to the next |
| 90 // component. | 91 // component. |
| 91 int64 sequence_number; | 92 int64 sequence_number; |
| 92 // Average time of events that happened in this component. | 93 // Average time of events that happened in this component. |
| 93 base::TimeTicks event_time; | 94 base::TimeTicks event_time; |
| 94 // Count of events that happened in this component | 95 // Count of events that happened in this component |
| 95 uint32 event_count; | 96 uint32 event_count; |
| 96 }; | 97 }; |
| 97 | 98 |
| 99 typedef std::vector<gfx::PointF> InputCoordinates; |
| 100 |
| 98 // Empirically determined constant based on a typical scroll sequence. | 101 // Empirically determined constant based on a typical scroll sequence. |
| 99 enum { kTypicalMaxComponentsPerLatencyInfo = 6 }; | 102 enum { kTypicalMaxComponentsPerLatencyInfo = 6 }; |
| 100 | 103 |
| 101 // Map a Latency Component (with a component-specific int64 id) to a | 104 // Map a Latency Component (with a component-specific int64 id) to a |
| 102 // component info. | 105 // component info. |
| 103 typedef base::SmallMap< | 106 typedef base::SmallMap< |
| 104 std::map<std::pair<LatencyComponentType, int64>, LatencyComponent>, | 107 std::map<std::pair<LatencyComponentType, int64>, LatencyComponent>, |
| 105 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; | 108 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; |
| 106 | 109 |
| 107 LatencyInfo(); | 110 LatencyInfo(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 LatencyComponent* output) const; | 149 LatencyComponent* output) const; |
| 147 | 150 |
| 148 void RemoveLatency(LatencyComponentType type); | 151 void RemoveLatency(LatencyComponentType type); |
| 149 | 152 |
| 150 void Clear(); | 153 void Clear(); |
| 151 | 154 |
| 152 // Records the |event_type| in trace buffer as TRACE_EVENT_ASYNC_STEP. | 155 // Records the |event_type| in trace buffer as TRACE_EVENT_ASYNC_STEP. |
| 153 void TraceEventType(const char* event_type); | 156 void TraceEventType(const char* event_type); |
| 154 | 157 |
| 155 LatencyMap latency_components; | 158 LatencyMap latency_components; |
| 159 |
| 160 // These coordinates represent window coordinates. |
| 161 InputCoordinates coordinates; |
| 162 |
| 156 // The unique id for matching the ASYNC_BEGIN/END trace event. | 163 // The unique id for matching the ASYNC_BEGIN/END trace event. |
| 157 int64 trace_id; | 164 int64 trace_id; |
| 158 // Whether a terminal component has been added. | 165 // Whether a terminal component has been added. |
| 159 bool terminated; | 166 bool terminated; |
| 160 }; | 167 }; |
| 161 | 168 |
| 162 } // namespace ui | 169 } // namespace ui |
| 163 | 170 |
| 164 #endif // UI_EVENTS_LATENCY_INFO_H_ | 171 #endif // UI_EVENTS_LATENCY_INFO_H_ |
| OLD | NEW |