зеркало из https://github.com/mozilla/gecko-dev.git
Bug 982339 - Get rid of TextureClientPoolMember and use nsTArray so that we releases references when we shutdown. r=Bas
This commit is contained in:
Родитель
52f31b5fb2
Коммит
8a1b866944
|
@ -37,11 +37,6 @@ using namespace mozilla::gfx;
|
|||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
TextureClientPoolMember::TextureClientPoolMember(SurfaceFormat aFormat, TextureClientPool* aTexturePool)
|
||||
: mFormat(aFormat)
|
||||
, mTexturePool(aTexturePool)
|
||||
{}
|
||||
|
||||
ClientLayerManager::ClientLayerManager(nsIWidget* aWidget)
|
||||
: mPhase(PHASE_NONE)
|
||||
, mWidget(aWidget)
|
||||
|
@ -61,8 +56,6 @@ ClientLayerManager::~ClientLayerManager()
|
|||
mRoot = nullptr;
|
||||
|
||||
MOZ_COUNT_DTOR(ClientLayerManager);
|
||||
|
||||
mTexturePools.clear();
|
||||
}
|
||||
|
||||
int32_t
|
||||
|
@ -233,9 +226,8 @@ ClientLayerManager::EndTransaction(DrawThebesLayerCallback aCallback,
|
|||
MakeSnapshotIfRequired();
|
||||
}
|
||||
|
||||
for (const TextureClientPoolMember* item = mTexturePools.getFirst();
|
||||
item; item = item->getNext()) {
|
||||
item->mTexturePool->ReturnDeferredClients();
|
||||
for (size_t i = 0; i < mTexturePools.Length(); i++) {
|
||||
mTexturePools[i]->ReturnDeferredClients();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -458,21 +450,18 @@ ClientLayerManager::SetIsFirstPaint()
|
|||
TextureClientPool*
|
||||
ClientLayerManager::GetTexturePool(SurfaceFormat aFormat)
|
||||
{
|
||||
for (const TextureClientPoolMember* item = mTexturePools.getFirst();
|
||||
item; item = item->getNext()) {
|
||||
if (item->mFormat == aFormat) {
|
||||
return item->mTexturePool;
|
||||
for (size_t i = 0; i < mTexturePools.Length(); i++) {
|
||||
if (mTexturePools[i]->GetFormat() == aFormat) {
|
||||
return mTexturePools[i];
|
||||
}
|
||||
}
|
||||
|
||||
TextureClientPoolMember* texturePoolMember =
|
||||
new TextureClientPoolMember(aFormat,
|
||||
mTexturePools.AppendElement(
|
||||
new TextureClientPool(aFormat, IntSize(TILEDLAYERBUFFER_TILE_SIZE,
|
||||
TILEDLAYERBUFFER_TILE_SIZE),
|
||||
mForwarder));
|
||||
mTexturePools.insertBack(texturePoolMember);
|
||||
|
||||
return texturePoolMember->mTexturePool;
|
||||
return mTexturePools.LastElement();
|
||||
}
|
||||
|
||||
SimpleTextureClientPool*
|
||||
|
@ -502,9 +491,8 @@ ClientLayerManager::ClearCachedResources(Layer* aSubtree)
|
|||
} else if (mRoot) {
|
||||
ClearLayer(mRoot);
|
||||
}
|
||||
for (const TextureClientPoolMember* item = mTexturePools.getFirst();
|
||||
item; item = item->getNext()) {
|
||||
item->mTexturePool->Clear();
|
||||
for (size_t i = 0; i < mTexturePools.Length(); i++) {
|
||||
mTexturePools[i]->Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,15 +36,6 @@ class PLayerChild;
|
|||
class TextureClientPool;
|
||||
class SimpleTextureClientPool;
|
||||
|
||||
class TextureClientPoolMember
|
||||
: public LinkedListElement<TextureClientPoolMember> {
|
||||
public:
|
||||
TextureClientPoolMember(gfx::SurfaceFormat aFormat, TextureClientPool* aTexturePool);
|
||||
|
||||
gfx::SurfaceFormat mFormat;
|
||||
RefPtr<TextureClientPool> mTexturePool;
|
||||
};
|
||||
|
||||
class ClientLayerManager : public LayerManager
|
||||
{
|
||||
typedef nsTArray<nsRefPtr<Layer> > LayerRefArray;
|
||||
|
@ -229,7 +220,7 @@ private:
|
|||
bool mNeedsComposite;
|
||||
|
||||
RefPtr<ShadowLayerForwarder> mForwarder;
|
||||
LinkedList<TextureClientPoolMember> mTexturePools;
|
||||
nsAutoTArray<RefPtr<TextureClientPool>,2> mTexturePools;
|
||||
|
||||
// indexed by gfx::SurfaceFormat
|
||||
nsTArray<RefPtr<SimpleTextureClientPool> > mSimpleTilePools;
|
||||
|
|
|
@ -30,6 +30,11 @@ TextureClientPool::TextureClientPool(gfx::SurfaceFormat aFormat, gfx::IntSize aS
|
|||
mTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
}
|
||||
|
||||
TextureClientPool::~TextureClientPool()
|
||||
{
|
||||
mTimer->Cancel();
|
||||
}
|
||||
|
||||
TemporaryRef<TextureClient>
|
||||
TextureClientPool::GetTextureClient()
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@ public:
|
|||
MOZ_DECLARE_REFCOUNTED_TYPENAME(TextureClientPool)
|
||||
TextureClientPool(gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
|
||||
ISurfaceAllocator *aAllocator);
|
||||
~TextureClientPool();
|
||||
|
||||
/**
|
||||
* Gets an allocated TextureClient of size and format that are determined
|
||||
|
@ -78,6 +79,8 @@ public:
|
|||
*/
|
||||
void Clear();
|
||||
|
||||
gfx::SurfaceFormat GetFormat() { return mFormat; }
|
||||
|
||||
private:
|
||||
// The time in milliseconds before the pool will be shrunk to the minimum
|
||||
// size after returning a client.
|
||||
|
|
Загрузка…
Ссылка в новой задаче