Index: ui/latency/latency_info.cc |
diff --git a/ui/latency/latency_info.cc b/ui/latency/latency_info.cc |
index 58d291ba3ff4441242509e3d2209b059f4106898..f0bc7c02af5dc2612faea07a00e3dd3a1a2d969b 100644 |
--- a/ui/latency/latency_info.cc |
+++ b/ui/latency/latency_info.cc |
@@ -20,39 +20,6 @@ namespace { |
const size_t kMaxLatencyInfoNumber = 100; |
-const char* GetComponentName(ui::LatencyComponentType type) { |
-#define CASE_TYPE(t) case ui::t: return #t |
- switch (type) { |
- CASE_TYPE(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT); |
- CASE_TYPE(LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_UI_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT); |
- CASE_TYPE(BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT); |
- CASE_TYPE(TAB_SHOW_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL); |
- CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_NO_SWAP_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_COMMIT_FAILED_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_COMMIT_NO_UPDATE_COMPONENT); |
- CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT); |
- default: |
- DLOG(WARNING) << "Unhandled LatencyComponentType.\n"; |
- break; |
- } |
-#undef CASE_TYPE |
- return "unknown"; |
-} |
- |
bool IsTerminalComponent(ui::LatencyComponentType type) { |
switch (type) { |
case ui::INPUT_EVENT_LATENCY_TERMINATED_NO_SWAP_COMPONENT: |
@@ -130,6 +97,39 @@ static base::LazyInstance<LatencyInfoEnabledInitializer>::Leaky |
namespace ui { |
+const char* GetComponentName(ui::LatencyComponentType type) { |
+#define CASE_TYPE(t) case ui::t: return #t |
+ switch (type) { |
+ CASE_TYPE(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT); |
+ CASE_TYPE(LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_UI_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT); |
+ CASE_TYPE(BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT); |
+ CASE_TYPE(TAB_SHOW_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT); |
+ CASE_TYPE(DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_NO_SWAP_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_COMMIT_FAILED_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_COMMIT_NO_UPDATE_COMPONENT); |
+ CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_SWAP_FAILED_COMPONENT); |
+ default: |
+ DLOG(WARNING) << "Unhandled LatencyComponentType.\n"; |
+ break; |
+ } |
+#undef CASE_TYPE |
+ return "unknown"; |
+} |
+ |
LatencyInfo::LatencyInfo() : LatencyInfo(SourceEventType::UNKNOWN) {} |
LatencyInfo::LatencyInfo(SourceEventType type) |
@@ -355,6 +355,20 @@ bool LatencyInfo::FindLatency(LatencyComponentType type, |
return true; |
} |
+bool LatencyInfo::FindLatency(LatencyComponentType type, |
+ LatencyComponent* output) const { |
+ LatencyMap::const_iterator it = latency_components_.begin(); |
+ while (it != latency_components_.end()) { |
+ if (it->first.first == type) { |
+ if (output) |
+ *output = it->second; |
+ return true; |
+ } |
+ it++; |
+ } |
+ return false; |
+} |
+ |
void LatencyInfo::RemoveLatency(LatencyComponentType type) { |
LatencyMap::iterator it = latency_components_.begin(); |
while (it != latency_components_.end()) { |