mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1050770 - add paint details to timeline; r=smaug,mattwoodrow
This commit is contained in:
parent
48afd85093
commit
cf7fa5891d
@ -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<mozilla::dom::ProfileTimelineLayerRect> 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);
|
||||
}
|
||||
|
||||
|
@ -305,6 +305,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void AddLayerRectangles(mozilla::dom::Sequence<mozilla::dom::ProfileTimelineLayerRect>&)
|
||||
{
|
||||
MOZ_ASSERT_UNREACHABLE("can only be called on layer markers");
|
||||
}
|
||||
|
||||
const char* GetName() const
|
||||
{
|
||||
return mName;
|
||||
|
@ -7,6 +7,7 @@
|
||||
// restyles, reflows and paints occur
|
||||
|
||||
let URL = '<!DOCTYPE html><style>' +
|
||||
'body {margin:0; padding: 0;} ' +
|
||||
'div {width:100px;height:100px;background:red;} ' +
|
||||
'.resize-change-color {width:50px;height:50px;background:blue;} ' +
|
||||
'.change-color {width:50px;height:50px;background:yellow;} ' +
|
||||
@ -21,8 +22,19 @@ let TESTS = [{
|
||||
check: function(markers) {
|
||||
ok(markers.length > 0, "markers were returned");
|
||||
console.log(markers);
|
||||
info(JSON.stringify(markers.filter(m => m.name == "Paint")));
|
||||
ok(markers.some(m => m.name == "Reflow"), "markers includes Reflow");
|
||||
ok(markers.some(m => m.name == "Paint"), "markers includes Paint");
|
||||
for (let marker of markers.filter(m => m.name == "Paint")) {
|
||||
// This change should generate a single rectangle.
|
||||
// We only verify that it contains the the div.
|
||||
ok(marker.rectangles.length == 1, "marker has one rectangle");
|
||||
let rect = marker.rectangles[0];
|
||||
ok(rect.x <= 0, "marker x");
|
||||
ok(rect.y <= 0, "marker y");
|
||||
ok(rect.width >= 100, "marker width");
|
||||
ok(rect.height >= 100, "marker height");
|
||||
}
|
||||
ok(markers.some(m => m.name == "Styles"), "markers includes Restyle");
|
||||
}
|
||||
}, {
|
||||
@ -34,6 +46,16 @@ let TESTS = [{
|
||||
ok(markers.length > 0, "markers were returned");
|
||||
ok(!markers.some(m => m.name == "Reflow"), "markers doesn't include Reflow");
|
||||
ok(markers.some(m => m.name == "Paint"), "markers includes Paint");
|
||||
for (let marker of markers.filter(m => m.name == "Paint")) {
|
||||
// This change should generate a single rectangle which is the
|
||||
// same as the div.
|
||||
ok(marker.rectangles.length == 1, "marker has one rectangle");
|
||||
let rect = marker.rectangles[0];
|
||||
ok(rect.x == 0, "marker x");
|
||||
ok(rect.y == 0, "marker y");
|
||||
ok(rect.width == 50, "marker width");
|
||||
ok(rect.height == 50, "marker height");
|
||||
}
|
||||
ok(markers.some(m => m.name == "Styles"), "markers includes Restyle");
|
||||
}
|
||||
}, {
|
||||
|
@ -4,6 +4,13 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
dictionary ProfileTimelineLayerRect {
|
||||
long x = 0;
|
||||
long y = 0;
|
||||
long width = 0;
|
||||
long height = 0;
|
||||
};
|
||||
|
||||
dictionary ProfileTimelineMarker {
|
||||
DOMString name = "";
|
||||
DOMHighResTimeStamp start = 0;
|
||||
@ -13,4 +20,6 @@ dictionary ProfileTimelineMarker {
|
||||
/* For DOMEvent markers. */
|
||||
DOMString type;
|
||||
unsigned short eventPhase;
|
||||
/* For Paint markers. */
|
||||
sequence<ProfileTimelineLayerRect> rectangles;
|
||||
};
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "nsDocShell.h"
|
||||
#include "nsImageFrame.h"
|
||||
#include "mozilla/dom/ProfileTimelineMarkerBinding.h"
|
||||
|
||||
#include "GeckoProfiler.h"
|
||||
#include "mozilla/gfx/Tools.h"
|
||||
@ -4419,6 +4420,36 @@ static void DrawForcedBackgroundColor(DrawTarget& aDrawTarget,
|
||||
}
|
||||
}
|
||||
|
||||
class LayerTimelineMarker : public nsDocShell::TimelineMarker
|
||||
{
|
||||
public:
|
||||
LayerTimelineMarker(nsDocShell* aDocShell, const nsIntRegion& aRegion)
|
||||
: nsDocShell::TimelineMarker(aDocShell, "Layer", TRACING_EVENT)
|
||||
, mRegion(aRegion)
|
||||
{
|
||||
}
|
||||
|
||||
~LayerTimelineMarker()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void AddLayerRectangles(mozilla::dom::Sequence<mozilla::dom::ProfileTimelineLayerRect>& aRectangles)
|
||||
{
|
||||
nsIntRegionRectIterator it(mRegion);
|
||||
while (const nsIntRect* iterRect = it.Next()) {
|
||||
mozilla::dom::ProfileTimelineLayerRect rect;
|
||||
rect.mX = iterRect->X();
|
||||
rect.mY = iterRect->Y();
|
||||
rect.mWidth = iterRect->Width();
|
||||
rect.mHeight = iterRect->Height();
|
||||
aRectangles.AppendElement(rect);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
nsIntRegion mRegion;
|
||||
};
|
||||
|
||||
/*
|
||||
* A note on residual transforms:
|
||||
*
|
||||
@ -4568,7 +4599,13 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
|
||||
|
||||
if (presContext && presContext->GetDocShell() && isActiveLayerManager) {
|
||||
nsDocShell* docShell = static_cast<nsDocShell*>(presContext->GetDocShell());
|
||||
docShell->AddProfileTimelineMarker("Layer", TRACING_EVENT);
|
||||
bool isRecording;
|
||||
docShell->GetRecordProfileTimelineMarkers(&isRecording);
|
||||
if (isRecording) {
|
||||
mozilla::UniquePtr<nsDocShell::TimelineMarker> marker =
|
||||
MakeUnique<LayerTimelineMarker>(docShell, aRegionToDraw);
|
||||
docShell->AddProfileTimelineMarker(marker);
|
||||
}
|
||||
}
|
||||
|
||||
if (!aRegionToInvalidate.IsEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user