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 "base/debug/trace_event.h" | 5 #include "base/debug/trace_event.h" |
6 #include "base/json/json_writer.h" | 6 #include "base/json/json_writer.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "ui/events/latency_info.h" | 9 #include "ui/events/latency_info.h" |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 | 12 |
13 namespace { | 13 namespace { |
14 const char* GetComponentName(ui::LatencyComponentType type) { | 14 const char* GetComponentName(ui::LatencyComponentType type) { |
15 #define CASE_TYPE(t) case ui::t: return #t | 15 #define CASE_TYPE(t) case ui::t: return #t |
16 switch (type) { | 16 switch (type) { |
17 CASE_TYPE(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT); | 17 CASE_TYPE(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT); |
18 CASE_TYPE(INPUT_EVENT_LATENCY_SCROLL_UPDATE_RWH_COMPONENT); | 18 CASE_TYPE(INPUT_EVENT_LATENCY_SCROLL_UPDATE_RWH_COMPONENT); |
19 CASE_TYPE(INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT); | 19 CASE_TYPE(INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT); |
20 CASE_TYPE(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT); | 20 CASE_TYPE(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT); |
21 CASE_TYPE(INPUT_EVENT_LATENCY_UI_COMPONENT); | 21 CASE_TYPE(INPUT_EVENT_LATENCY_UI_COMPONENT); |
22 CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT); | 22 CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT); |
23 CASE_TYPE(INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT); | 23 CASE_TYPE(INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT); |
24 CASE_TYPE(WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT); | |
25 CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT); | 24 CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT); |
26 CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT); | 25 CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT); |
27 CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT); | 26 CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT); |
28 CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT); | 27 CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT); |
29 CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_COMMIT_FAILED_COMPONENT); | |
30 CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT); | |
31 CASE_TYPE(LATENCY_INFO_LIST_TERMINATED_OVERFLOW_COMPONENT); | |
32 default: | 28 default: |
33 DLOG(WARNING) << "Unhandled LatencyComponentType.\n"; | 29 DLOG(WARNING) << "Unhandled LatencyComponentType.\n"; |
34 break; | 30 break; |
35 } | 31 } |
36 #undef CASE_TYPE | 32 #undef CASE_TYPE |
37 return "unknown"; | 33 return "unknown"; |
38 } | 34 } |
39 | 35 |
40 bool IsTerminalComponent(ui::LatencyComponentType type) { | 36 bool IsTerminalComponent(ui::LatencyComponentType type) { |
41 switch (type) { | 37 switch (type) { |
42 case ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT: | 38 case ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT: |
43 case ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT: | 39 case ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT: |
44 case ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT: | 40 case ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT: |
45 case ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT: | 41 case ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT: |
46 case ui::INPUT_EVENT_LATENCY_TERMINATED_COMMIT_FAILED_COMPONENT: | |
47 case ui::INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT: | |
48 case ui::LATENCY_INFO_LIST_TERMINATED_OVERFLOW_COMPONENT: | |
49 return true; | 42 return true; |
50 default: | 43 default: |
51 return false; | 44 return false; |
52 } | 45 } |
53 } | 46 } |
54 | 47 |
55 bool IsBeginComponent(ui::LatencyComponentType type) { | 48 bool IsBeginComponent(ui::LatencyComponentType type) { |
56 return (type == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT); | 49 return (type == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT); |
57 } | 50 } |
58 | 51 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 it++; | 215 it++; |
223 } | 216 } |
224 } | 217 } |
225 } | 218 } |
226 | 219 |
227 void LatencyInfo::Clear() { | 220 void LatencyInfo::Clear() { |
228 latency_components.clear(); | 221 latency_components.clear(); |
229 } | 222 } |
230 | 223 |
231 } // namespace ui | 224 } // namespace ui |
OLD | NEW |