From ce9daad020b4436cd9f94314ab1e052871d9924a Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Mon, 11 Jun 2012 16:45:38 +1200 Subject: [PATCH] Bug 539356 - Part 12 - Remove unnecessary LayerManagerLayerBuilder indirection. r=roc --- layout/base/FrameLayerBuilder.cpp | 10 +--------- layout/base/FrameLayerBuilder.h | 27 ++++++--------------------- layout/base/nsDisplayList.cpp | 2 +- 3 files changed, 8 insertions(+), 31 deletions(-) diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 1466981dcc3d..15bde41385ee 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -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) { diff --git a/layout/base/FrameLayerBuilder.h b/layout/base/FrameLayerBuilder.h index 78fb378fdd0d..0618ea93ed5a 100644 --- a/layout/base/FrameLayerBuilder.h +++ b/layout/base/FrameLayerBuilder.h @@ -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(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(aManager->GetUserData(&gLayerManagerLayerBuilder)); +} + } #endif /* FRAMELAYERBUILDER_H_ */ diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index a45908b41ce4..d73d9b54d817 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -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);