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 #include "ui/events/latency_info.h" | 5 #include "ui/events/latency_info.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 CHECK_EQ(-1, trace_id_); | 236 CHECK_EQ(-1, trace_id_); |
237 trace_id_ = component_sequence_number; | 237 trace_id_ = component_sequence_number; |
238 | 238 |
239 if (*latency_info_enabled) { | 239 if (*latency_info_enabled) { |
240 // The timestamp for ASYNC_BEGIN trace event is used for drawing the | 240 // The timestamp for ASYNC_BEGIN trace event is used for drawing the |
241 // beginning of the trace event in trace viewer. For better visualization, | 241 // beginning of the trace event in trace viewer. For better visualization, |
242 // for an input event, we want to draw the beginning as when the event is | 242 // for an input event, we want to draw the beginning as when the event is |
243 // originally created, e.g. the timestamp of its ORIGINAL/UI_COMPONENT, | 243 // originally created, e.g. the timestamp of its ORIGINAL/UI_COMPONENT, |
244 // not when we actually issue the ASYNC_BEGIN trace event. | 244 // not when we actually issue the ASYNC_BEGIN trace event. |
245 LatencyComponent begin_component; | 245 LatencyComponent begin_component; |
246 int64_t ts = 0; | 246 base::TimeTicks ts; |
247 if (FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, | 247 if (FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, |
248 0, | 248 0, |
249 &begin_component) || | 249 &begin_component) || |
250 FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, | 250 FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, |
251 0, | 251 0, |
252 &begin_component)) { | 252 &begin_component)) { |
253 ts = begin_component.event_time.ToInternalValue(); | 253 ts = begin_component.event_time; |
254 } else { | 254 } else { |
255 ts = base::TimeTicks::Now().ToInternalValue(); | 255 ts = base::TimeTicks::Now(); |
256 } | 256 } |
257 | 257 |
258 if (trace_name_str) { | 258 if (trace_name_str) { |
259 if (IsInputLatencyBeginComponent(component)) | 259 if (IsInputLatencyBeginComponent(component)) |
260 trace_name_ = std::string("InputLatency::") + trace_name_str; | 260 trace_name_ = std::string("InputLatency::") + trace_name_str; |
261 else | 261 else |
262 trace_name_ = std::string("Latency::") + trace_name_str; | 262 trace_name_ = std::string("Latency::") + trace_name_str; |
263 } | 263 } |
264 | 264 |
265 TRACE_EVENT_COPY_ASYNC_BEGIN_WITH_TIMESTAMP0( | 265 TRACE_EVENT_COPY_ASYNC_BEGIN_WITH_TIMESTAMP0( |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 372 } |
373 | 373 |
374 bool LatencyInfo::AddInputCoordinate(const gfx::PointF& input_coordinate) { | 374 bool LatencyInfo::AddInputCoordinate(const gfx::PointF& input_coordinate) { |
375 if (input_coordinates_size_ >= kMaxInputCoordinates) | 375 if (input_coordinates_size_ >= kMaxInputCoordinates) |
376 return false; | 376 return false; |
377 input_coordinates_[input_coordinates_size_++] = input_coordinate; | 377 input_coordinates_[input_coordinates_size_++] = input_coordinate; |
378 return true; | 378 return true; |
379 } | 379 } |
380 | 380 |
381 } // namespace ui | 381 } // namespace ui |
OLD | NEW |