From 42dd8dbed5774b6266934c69daf3fe03694e5de9 Mon Sep 17 00:00:00 2001 From: Patrick Brosset Date: Tue, 23 Sep 2014 01:47:00 -0400 Subject: [PATCH] Bug 1065954 - Avoid drawing start/end markers in the timeline if no layer in the inspected docshell was painted. r=BenWa --- docshell/base/nsDocShell.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 27f00a87bf1..e3a79ad4477 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -2861,22 +2861,24 @@ nsDocShell::PopProfileTimelineMarkers(JSContext* aCx, mProfileTimelineMarkers[j]->mPayload); const char* endMarkerName = mProfileTimelineMarkers[j]->mName; - // Look for Layer markers to stream out paint markers + // Look for Layer markers to stream out paint markers. if (strcmp(endMarkerName, "Layer") == 0) { hasSeenPaintedLayer = true; } bool isSameMarkerType = strcmp(startMarkerName, endMarkerName) == 0; - bool isValidType = strcmp(endMarkerName, "Paint") != 0 || - hasSeenPaintedLayer; + bool isPaint = strcmp(startMarkerName, "Paint") == 0; - if (endPayload->GetMetaData() == TRACING_INTERVAL_END && - isSameMarkerType && isValidType) { - mozilla::dom::ProfileTimelineMarker marker; - marker.mName = NS_ConvertUTF8toUTF16(startMarkerName); - marker.mStart = mProfileTimelineMarkers[i]->mTime; - marker.mEnd = mProfileTimelineMarkers[j]->mTime; - profileTimelineMarkers.AppendElement(marker); + // Pair start and end markers. + if (endPayload->GetMetaData() == TRACING_INTERVAL_END && isSameMarkerType) { + // But ignore paint start/end if no layer has been painted. + if (!isPaint || (isPaint && hasSeenPaintedLayer)) { + mozilla::dom::ProfileTimelineMarker marker; + marker.mName = NS_ConvertUTF8toUTF16(startMarkerName); + marker.mStart = mProfileTimelineMarkers[i]->mTime; + marker.mEnd = mProfileTimelineMarkers[j]->mTime; + profileTimelineMarkers.AppendElement(marker); + } break; }