mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-09 04:25:38 +00:00
Bug 588690 - Part 1: Expose ClearCachedResources on BasicLayerManagers. r=roc
This commit is contained in:
parent
0b6b520e81
commit
cb632a9c1b
@ -112,6 +112,13 @@ public:
|
||||
float aOpacity) {}
|
||||
|
||||
virtual ShadowableLayer* AsShadowableLayer() { return nsnull; }
|
||||
|
||||
/**
|
||||
* Layers will get this call when their layer manager is destroyed, this
|
||||
* indicates they should clear resources they don't really need after their
|
||||
* LayerManager ceases to exist.
|
||||
*/
|
||||
virtual void ClearCachedResources() {}
|
||||
};
|
||||
|
||||
static BasicImplData*
|
||||
@ -290,6 +297,8 @@ public:
|
||||
LayerManager::DrawThebesLayerCallback aCallback,
|
||||
void* aCallbackData,
|
||||
float aOpacity);
|
||||
|
||||
virtual void ClearCachedResources() { mBuffer.Clear(); mValidRegion.SetEmpty(); }
|
||||
|
||||
virtual already_AddRefed<gfxASurface>
|
||||
CreateBuffer(Buffer::ContentType aType, const nsIntSize& aSize)
|
||||
@ -856,6 +865,8 @@ BasicLayerManager::~BasicLayerManager()
|
||||
{
|
||||
NS_ASSERTION(!InTransaction(), "Died during transaction?");
|
||||
|
||||
ClearCachedResources();
|
||||
|
||||
mRoot = nsnull;
|
||||
|
||||
MOZ_COUNT_DTOR(BasicLayerManager);
|
||||
@ -1078,6 +1089,25 @@ BasicLayerManager::PaintLayer(Layer* aLayer,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BasicLayerManager::ClearCachedResources()
|
||||
{
|
||||
if (mRoot) {
|
||||
ClearLayer(mRoot);
|
||||
}
|
||||
|
||||
mCachedSurface.Expire();
|
||||
}
|
||||
void
|
||||
BasicLayerManager::ClearLayer(Layer* aLayer)
|
||||
{
|
||||
ToData(aLayer)->ClearResources();
|
||||
for (Layer* child = aLayer->GetFirstChild(); child;
|
||||
child = child->GetNextSibling()) {
|
||||
ClearLayer(child);
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<ThebesLayer>
|
||||
BasicLayerManager::CreateThebesLayer()
|
||||
{
|
||||
|
@ -156,6 +156,9 @@ public:
|
||||
virtual const char* Name() const { return "Basic"; }
|
||||
#endif // MOZ_LAYERS_HAVE_LOG
|
||||
|
||||
// Clear the cached contents of this layer.
|
||||
void ClearCachedResources();
|
||||
|
||||
protected:
|
||||
#ifdef DEBUG
|
||||
enum TransactionPhase {
|
||||
@ -171,6 +174,9 @@ private:
|
||||
void* aCallbackData,
|
||||
float aOpacity);
|
||||
|
||||
// Clear the contents of a layer
|
||||
void ClearLayer(Layer* aLayer);
|
||||
|
||||
already_AddRefed<gfxContext> PushGroupWithCachedSurface(gfxContext *aTarget,
|
||||
gfxASurface::gfxContentType aContent,
|
||||
gfxPoint *aSavedOffset);
|
||||
|
Loading…
x
Reference in New Issue
Block a user