b=574481; fix layers lifetime issues; part 1 - add API; r=roc

This commit is contained in:
Vladimir Vukicevic
2010-08-06 22:09:17 -07:00
parent 6413c5473f
commit ed161c1754
2 changed files with 22 additions and 2 deletions

View File

@@ -172,6 +172,13 @@ public:
*/
virtual gfxIntSize GetCurrentSize() = 0;
/**
* Set a new layer manager for this image container. It must be
* either of the same type as the container's current layer manager,
* or null. TRUE is returned on success.
*/
virtual PRBool SetLayerManager(LayerManager *aManager) = 0;
protected:
LayerManager* mManager;

View File

@@ -142,12 +142,21 @@ public:
LAYERS_D3D9
};
LayerManager() : mUserData(nsnull)
LayerManager() : mUserData(nsnull), mDestroyed(PR_FALSE)
{
InitLog();
}
virtual ~LayerManager() {}
/**
* Release layers and resources held by this layer manager, and mark
* it as destroyed. Should do any cleanup necessary in preparation
* for its widget going away. After this call, only user data calls
* are valid on the layer manager.
*/
virtual void Destroy() { mDestroyed = PR_TRUE; }
PRBool IsDestroyed() { return mDestroyed; }
/**
* Start a new transaction. Nested transactions are not allowed so
* there must be no transaction currently in progress.
@@ -297,6 +306,7 @@ public:
protected:
nsRefPtr<Layer> mRoot;
void* mUserData;
PRPackedBool mDestroyed;
// Print interesting information about this into aTo. Internally
// used to implement Dump*() and Log*().
@@ -328,7 +338,9 @@ public:
virtual ~Layer() {}
/**
* Returns the LayoutManager this Layer belongs to. Cannot be null.
* Returns the LayerManager this Layer belongs to. Note that the layer
* manager might be in a destroyed state, at which point it's only
* valid to set/get user data from it.
*/
LayerManager* Manager() { return mManager; }
@@ -387,6 +399,7 @@ public:
}
Mutated();
}
/**
* CONSTRUCTION PHASE ONLY
* Set a clip rect which will be applied to this layer as it is