зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1055821 - Add layer construction logging. r=mattwoodrow
--HG-- extra : rebase_source : 318ea4b96780830fd5665fc0b0cd610b67392113
This commit is contained in:
Родитель
a132c51b61
Коммит
b7e0b48dc5
|
@ -1320,6 +1320,13 @@ Layer::Dump(std::stringstream& aStream, const char* aPrefix, bool aDumpHtml)
|
|||
mask->Dump(aStream, pfx.get(), aDumpHtml);
|
||||
}
|
||||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
for (size_t i = 0; i < mExtraDumpInfo.Length(); i++) {
|
||||
const nsCString& str = mExtraDumpInfo[i];
|
||||
aStream << aPrefix << " Info:\n" << str.get();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Layer* kid = GetFirstChild()) {
|
||||
nsAutoCString pfx(aPrefix);
|
||||
pfx += " ";
|
||||
|
|
|
@ -1504,6 +1504,26 @@ public:
|
|||
|
||||
RenderTargetRect TransformRectToRenderTarget(const LayerIntRect& aRect);
|
||||
|
||||
/**
|
||||
* Add debugging information to the layer dump.
|
||||
*/
|
||||
void AddExtraDumpInfo(const nsACString& aStr)
|
||||
{
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
mExtraDumpInfo.AppendElement(aStr);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear debugging information. Useful for recycling.
|
||||
*/
|
||||
void ClearExtraDumpInfo()
|
||||
{
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
mExtraDumpInfo.Clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
Layer(LayerManager* aManager, void* aImplData);
|
||||
|
||||
|
@ -1606,6 +1626,9 @@ protected:
|
|||
// This is empty unless this is a scrollable ContainerLayer and the
|
||||
// apz.printtree pref is turned on.
|
||||
std::string mContentDescription;
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
nsTArray<nsCString> mExtraDumpInfo;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -370,6 +370,20 @@ public:
|
|||
return mFixedPosFrameForLayerData != nullptr;
|
||||
}
|
||||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
|
||||
/**
|
||||
* Keep track of important decisions for debugging.
|
||||
*/
|
||||
nsAutoCString mLog;
|
||||
|
||||
#define FLB_LOG_THEBES_DECISION(tld, ...) \
|
||||
tld->mLog.AppendPrintf("\t\t\t\t"); \
|
||||
tld->mLog.AppendPrintf(__VA_ARGS__);
|
||||
#else
|
||||
#define FLB_LOG_THEBES_DECISION(...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The region of visible content in the layer, relative to the
|
||||
* container layer (which is at the snapped top-left of the display
|
||||
|
@ -501,6 +515,7 @@ private:
|
|||
* as infinite, and all display items should be considered 'above' this layer.
|
||||
*/
|
||||
bool mAllDrawingAbove;
|
||||
|
||||
};
|
||||
|
||||
struct NewLayerEntry {
|
||||
|
@ -1455,6 +1470,7 @@ ContainerState::CreateOrRecycleColorLayer(ThebesLayer *aThebes)
|
|||
nsRefPtr<ColorLayer> layer = data->mColorLayer;
|
||||
if (layer) {
|
||||
layer->SetMaskLayer(nullptr);
|
||||
layer->ClearExtraDumpInfo();
|
||||
} else {
|
||||
// Create a new layer
|
||||
layer = mManager->CreateColorLayer();
|
||||
|
@ -1478,6 +1494,7 @@ ContainerState::CreateOrRecycleImageLayer(ThebesLayer *aThebes)
|
|||
nsRefPtr<ImageLayer> layer = data->mImageLayer;
|
||||
if (layer) {
|
||||
layer->SetMaskLayer(nullptr);
|
||||
layer->ClearExtraDumpInfo();
|
||||
} else {
|
||||
// Create a new layer
|
||||
layer = mManager->CreateImageLayer();
|
||||
|
@ -1499,6 +1516,7 @@ ContainerState::CreateOrRecycleMaskImageLayerFor(Layer* aLayer)
|
|||
nsRefPtr<ImageLayer> result = mRecycledMaskImageLayers.Get(aLayer);
|
||||
if (result) {
|
||||
mRecycledMaskImageLayers.Remove(aLayer);
|
||||
aLayer->ClearExtraDumpInfo();
|
||||
// XXX if we use clip on mask layers, null it out here
|
||||
} else {
|
||||
// Create a new layer
|
||||
|
@ -1601,6 +1619,7 @@ ContainerState::CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot
|
|||
// Clear clip rect and mask layer so we don't accidentally stay clipped.
|
||||
// We will reapply any necessary clipping.
|
||||
layer->SetMaskLayer(nullptr);
|
||||
layer->ClearExtraDumpInfo();
|
||||
|
||||
data = static_cast<ThebesDisplayItemLayerUserData*>
|
||||
(layer->GetUserData(&gThebesDisplayItemLayerUserData));
|
||||
|
@ -2049,6 +2068,12 @@ ContainerState::PopThebesLayerData()
|
|||
NewLayerEntry* newLayerEntry = &mNewChildLayers[data->mNewChildLayersIndex];
|
||||
nsRefPtr<Layer> layer;
|
||||
nsRefPtr<ImageContainer> imageContainer = data->CanOptimizeImageLayer(mBuilder);
|
||||
|
||||
FLB_LOG_THEBES_DECISION(data, "Selecting layer for tld=%p\n", data);
|
||||
FLB_LOG_THEBES_DECISION(data, " Solid=%i, hasImage=%i, canOptimizeAwayThebes=%i\n",
|
||||
data->mIsSolidColorInVisibleRegion, !!imageContainer,
|
||||
CanOptimizeAwayThebesLayer(data, mLayerBuilder));
|
||||
|
||||
if ((data->mIsSolidColorInVisibleRegion || imageContainer) &&
|
||||
CanOptimizeAwayThebesLayer(data, mLayerBuilder)) {
|
||||
NS_ASSERTION(!(data->mIsSolidColorInVisibleRegion && imageContainer),
|
||||
|
@ -2069,6 +2094,7 @@ ContainerState::PopThebesLayerData()
|
|||
layer = imageLayer;
|
||||
mLayerBuilder->StoreOptimizedLayerForFrame(data->mImage,
|
||||
imageLayer);
|
||||
FLB_LOG_THEBES_DECISION(data, " Selected image layer=%p\n", layer.get());
|
||||
} else {
|
||||
nsRefPtr<ColorLayer> colorLayer = CreateOrRecycleColorLayer(data->mLayer);
|
||||
colorLayer->SetColor(data->mSolidColor);
|
||||
|
@ -2082,6 +2108,7 @@ ContainerState::PopThebesLayerData()
|
|||
colorLayer->SetBounds(visibleRect);
|
||||
|
||||
layer = colorLayer;
|
||||
FLB_LOG_THEBES_DECISION(data, " Selected color layer=%p\n", layer.get());
|
||||
}
|
||||
|
||||
NS_ASSERTION(FindIndexOfLayerIn(mNewChildLayers, layer) < 0,
|
||||
|
@ -2106,6 +2133,7 @@ ContainerState::PopThebesLayerData()
|
|||
layer = data->mLayer;
|
||||
imageContainer = nullptr;
|
||||
layer->SetClipRect(nullptr);
|
||||
FLB_LOG_THEBES_DECISION(data, " Selected thebes layer=%p\n", layer.get());
|
||||
}
|
||||
|
||||
if (mLayerBuilder->IsBuildingRetainedLayers()) {
|
||||
|
@ -2122,6 +2150,10 @@ ContainerState::PopThebesLayerData()
|
|||
SetOuterVisibleRegionForLayer(layer, data->mVisibleRegion);
|
||||
}
|
||||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
layer->AddExtraDumpInfo(nsCString(data->mLog));
|
||||
#endif
|
||||
|
||||
nsIntRegion transparentRegion;
|
||||
transparentRegion.Sub(data->mVisibleRegion, data->mOpaqueRegion);
|
||||
bool isOpaque = transparentRegion.IsEmpty();
|
||||
|
@ -2276,6 +2308,8 @@ ThebesLayerData::Accumulate(ContainerState* aState,
|
|||
const nsIntRect& aDrawRect,
|
||||
const DisplayItemClip& aClip)
|
||||
{
|
||||
FLB_LOG_THEBES_DECISION(this, "Accumulating dp=%s(%p), f=%p against tld=%p\n", aItem->Name(), aItem, aItem->Frame(), this);
|
||||
|
||||
if (aState->mBuilder->NeedToForceTransparentSurfaceForItem(aItem)) {
|
||||
mForceTransparentSurface = true;
|
||||
}
|
||||
|
@ -2292,7 +2326,9 @@ ThebesLayerData::Accumulate(ContainerState* aState,
|
|||
if (mVisibleRegion.IsEmpty() &&
|
||||
aItem->SupportsOptimizingToImage()) {
|
||||
mImage = static_cast<nsDisplayImageContainer*>(aItem);
|
||||
} else {
|
||||
FLB_LOG_THEBES_DECISION(this, " Tracking image\n");
|
||||
} else if (mImage) {
|
||||
FLB_LOG_THEBES_DECISION(this, " No longer tracking image\n");
|
||||
mImage = nullptr;
|
||||
}
|
||||
bool clipMatches = mItemClip == aClip;
|
||||
|
@ -2327,6 +2363,7 @@ ThebesLayerData::Accumulate(ContainerState* aState,
|
|||
nsRect bounds = aItem->GetBounds(aState->mBuilder, &snap);
|
||||
if (!aState->ScaleToInsidePixels(bounds, snap).Contains(aVisibleRect)) {
|
||||
isUniform = false;
|
||||
FLB_LOG_THEBES_DECISION(this, " Display item does not cover the visible rect\n");
|
||||
}
|
||||
}
|
||||
if (isUniform) {
|
||||
|
@ -2340,9 +2377,11 @@ ThebesLayerData::Accumulate(ContainerState* aState,
|
|||
// we can just blend the colors together
|
||||
mSolidColor = NS_ComposeColors(mSolidColor, uniformColor);
|
||||
} else {
|
||||
FLB_LOG_THEBES_DECISION(this, " Layer not a solid color: Can't blend colors togethers\n");
|
||||
mIsSolidColorInVisibleRegion = false;
|
||||
}
|
||||
} else {
|
||||
FLB_LOG_THEBES_DECISION(this, " Layer is not a solid color: Display item is not uniform over the visible bound\n");
|
||||
mIsSolidColorInVisibleRegion = false;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче