From cf7fa5891db83f4dfeb99b58bab4c5d8cac5a5bd Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 10 Dec 2014 16:32:51 -0800 Subject: [PATCH] Bug 1050770 - add paint details to timeline; r=smaug,mattwoodrow --- docshell/base/nsDocShell.cpp | 15 +++++-- docshell/base/nsDocShell.h | 5 +++ .../browser/browser_timelineMarkers-02.js | 22 +++++++++++ dom/webidl/ProfileTimelineMarker.webidl | 9 +++++ layout/base/FrameLayerBuilder.cpp | 39 ++++++++++++++++++- 5 files changed, 86 insertions(+), 4 deletions(-) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 6b6fc0b5c9f..4238a2c67b9 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -2893,6 +2893,11 @@ nsDocShell::PopProfileTimelineMarkers(JSContext* aCx, const char* startMarkerName = startPayload->GetName(); bool hasSeenPaintedLayer = false; + bool isPaint = strcmp(startMarkerName, "Paint") == 0; + + // If we are processing a Paint marker, we append information from + // all the embedded Layer markers to this array. + mozilla::dom::Sequence layerRectangles; if (startPayload->GetMetaData() == TRACING_INTERVAL_START) { bool hasSeenEnd = false; @@ -2910,14 +2915,14 @@ nsDocShell::PopProfileTimelineMarkers(JSContext* aCx, const char* endMarkerName = endPayload->GetName(); // Look for Layer markers to stream out paint markers. - if (strcmp(endMarkerName, "Layer") == 0) { + if (isPaint && strcmp(endMarkerName, "Layer") == 0) { hasSeenPaintedLayer = true; + endPayload->AddLayerRectangles(layerRectangles); } if (!startPayload->Equals(endPayload)) { continue; } - bool isPaint = strcmp(startMarkerName, "Paint") == 0; // Pair start and end markers. if (endPayload->GetMetaData() == TRACING_INTERVAL_START) { @@ -2933,7 +2938,11 @@ nsDocShell::PopProfileTimelineMarkers(JSContext* aCx, marker.mName = NS_ConvertUTF8toUTF16(startPayload->GetName()); marker.mStart = startPayload->GetTime(); marker.mEnd = endPayload->GetTime(); - startPayload->AddDetails(marker); + if (isPaint) { + marker.mRectangles.Construct(layerRectangles); + } else { + startPayload->AddDetails(marker); + } profileTimelineMarkers.AppendElement(marker); } diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 13e99360bd3..f4e1f77e0f5 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -305,6 +305,11 @@ public: { } + virtual void AddLayerRectangles(mozilla::dom::Sequence&) + { + MOZ_ASSERT_UNREACHABLE("can only be called on layer markers"); + } + const char* GetName() const { return mName; diff --git a/docshell/test/browser/browser_timelineMarkers-02.js b/docshell/test/browser/browser_timelineMarkers-02.js index 94968c11398..a6e112377d3 100644 --- a/docshell/test/browser/browser_timelineMarkers-02.js +++ b/docshell/test/browser/browser_timelineMarkers-02.js @@ -7,6 +7,7 @@ // restyles, reflows and paints occur let URL = '