Bug 539356 - Part 12 - Remove unnecessary LayerManagerLayerBuilder indirection. r=roc

This commit is contained in:
Matt Woodrow 2012-06-11 16:45:38 +12:00
parent 3d5108eb76
commit ce9daad020
3 changed files with 8 additions and 31 deletions

View File

@ -776,14 +776,6 @@ 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)
@ -2001,7 +1993,7 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayer* aLayer,
layerBuilder->Init(mDisplayListBuilder);
layerBuilder->mMaxContainerLayerGeneration = mMaxContainerLayerGeneration;
// LayerManager user data took ownership of the FrameLayerBuilder
tempManager->SetUserData(&gLayerManagerLayerBuilder, new LayerManagerLayerBuilder(layerBuilder, true));
tempManager->SetUserData(&gLayerManagerLayerBuilder, layerBuilder);
tempManager->BeginTransaction();
if (mRetainingManager) {

View File

@ -39,28 +39,8 @@ 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.
@ -100,7 +80,7 @@ static inline FrameLayerBuilder *GetLayerBuilderForManager(layers::LayerManager*
* integer types (nsIntPoint/nsIntSize/nsIntRect/nsIntRegion) are all in layer
* coordinates, post-scaling, whereas appunit types are all pre-scaling.
*/
class FrameLayerBuilder {
class FrameLayerBuilder : public layers::LayerUserData {
public:
typedef layers::ContainerLayer ContainerLayer;
typedef layers::Layer Layer;
@ -694,6 +674,11 @@ 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, new LayerManagerLayerBuilder(layerBuilder));
layerManager->SetUserData(&gLayerManagerLayerBuilder, layerBuilder);
if (aFlags & PAINT_FLUSH_LAYERS) {
FrameLayerBuilder::InvalidateAllLayers(layerManager);