Backout changeset ce5e9fefee19 (bug 539356) because of performance and correctness regressions

This commit is contained in:
Ehsan Akhgari 2012-07-03 20:18:34 -04:00
parent 45fb0d4893
commit 8f19fe7049
3 changed files with 31 additions and 8 deletions

View File

@ -815,6 +815,14 @@ FrameLayerBuilder::RemoveDisplayItemDataForFrame(DisplayItemDataEntry* aEntry,
return PL_DHASH_REMOVE;
}
LayerManagerLayerBuilder::~LayerManagerLayerBuilder()
{
MOZ_COUNT_DTOR(LayerManagerLayerBuilder);
if (mDelete) {
delete mLayerBuilder;
}
}
/* static */ PLDHashOperator
FrameLayerBuilder::StoreNewDisplayItemData(DisplayItemDataEntry* aEntry,
void* aUserArg)
@ -2036,7 +2044,7 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayer* aLayer,
layerBuilder->Init(mDisplayListBuilder);
layerBuilder->mMaxContainerLayerGeneration = mMaxContainerLayerGeneration;
// LayerManager user data took ownership of the FrameLayerBuilder
tempManager->SetUserData(&gLayerManagerLayerBuilder, layerBuilder);
tempManager->SetUserData(&gLayerManagerLayerBuilder, new LayerManagerLayerBuilder(layerBuilder, true));
tempManager->BeginTransaction();
if (mRetainingManager) {

View File

@ -39,8 +39,28 @@ enum LayerState {
LAYER_SVG_EFFECTS
};
class LayerManagerLayerBuilder : public layers::LayerUserData {
public:
LayerManagerLayerBuilder(FrameLayerBuilder* aBuilder, bool aDelete = true)
: mLayerBuilder(aBuilder)
, mDelete(aDelete)
{
MOZ_COUNT_CTOR(LayerManagerLayerBuilder);
}
~LayerManagerLayerBuilder();
FrameLayerBuilder* mLayerBuilder;
bool mDelete;
};
extern PRUint8 gLayerManagerLayerBuilder;
static inline FrameLayerBuilder *GetLayerBuilderForManager(layers::LayerManager* aManager)
{
LayerManagerLayerBuilder *data = static_cast<LayerManagerLayerBuilder*>(aManager->GetUserData(&gLayerManagerLayerBuilder));
return data ? data->mLayerBuilder : nsnull;
}
/**
* The FrameLayerBuilder belongs to an nsDisplayListBuilder and is
* responsible for converting display lists into layer trees.
@ -80,7 +100,7 @@ extern PRUint8 gLayerManagerLayerBuilder;
* integer types (nsIntPoint/nsIntSize/nsIntRect/nsIntRegion) are all in layer
* coordinates, post-scaling, whereas appunit types are all pre-scaling.
*/
class FrameLayerBuilder : public layers::LayerUserData {
class FrameLayerBuilder {
public:
typedef layers::ContainerLayer ContainerLayer;
typedef layers::Layer Layer;
@ -683,11 +703,6 @@ protected:
PRUint32 mMaxContainerLayerGeneration;
};
static inline FrameLayerBuilder *GetLayerBuilderForManager(layers::LayerManager* aManager)
{
return static_cast<FrameLayerBuilder*>(aManager->GetUserData(&gLayerManagerLayerBuilder));
}
}
#endif /* FRAMELAYERBUILDER_H_ */

View File

@ -590,7 +590,7 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
FrameLayerBuilder *layerBuilder = new FrameLayerBuilder();
layerBuilder->Init(aBuilder);
layerManager->SetUserData(&gLayerManagerLayerBuilder, layerBuilder);
layerManager->SetUserData(&gLayerManagerLayerBuilder, new LayerManagerLayerBuilder(layerBuilder));
if (aFlags & PAINT_FLUSH_LAYERS) {
FrameLayerBuilder::InvalidateAllLayers(layerManager);