Bug 893301. Reviewer changes. r=nical

This commit is contained in:
Nicholas Cameron 2013-11-28 10:16:34 +13:00
Родитель 26fc6718f4
Коммит 22e967bd94
6 изменённых файлов: 22 добавлений и 28 удалений

Просмотреть файл

@ -59,20 +59,19 @@ CompositableHost::AddTextureHost(TextureHost* aTexture)
}
void
CompositableHost::RemoveTextureHost(uint64_t aTextureID)
CompositableHost::RemoveTextureHost(TextureHost* aTexture)
{
if (mFirstTexture && mFirstTexture->GetID() == aTextureID) {
RefPtr<TextureHost> toRemove = mFirstTexture;
uint64_t textureID = aTexture->GetID();
if (mFirstTexture && mFirstTexture->GetID() == textureID) {
mFirstTexture = mFirstTexture->GetNextSibling();
toRemove->SetNextSibling(nullptr);
aTexture->SetNextSibling(nullptr);
}
RefPtr<TextureHost> it = mFirstTexture;
while (it) {
if (it->GetNextSibling() &&
it->GetNextSibling()->GetID() == aTextureID) {
RefPtr<TextureHost> toRemove = it->GetNextSibling();
it->GetNextSibling()->GetID() == textureID) {
it->SetNextSibling(it->GetNextSibling()->GetNextSibling());
toRemove->SetNextSibling(nullptr);
aTexture->SetNextSibling(nullptr);
}
it = it->GetNextSibling();
}

Просмотреть файл

@ -296,18 +296,13 @@ public:
void AddTextureHost(TextureHost* aTexture);
virtual void UseTextureHost(TextureHost* aTexture) {}
virtual void RemoveTextureHost(uint64_t aTextureID);
// If a texture host is flagged for deferred removal, the compositable will
// get an option to run any cleanup code early, that is when it would have
// been run if the texture host was not marked deferred. That is, this method
// is called _before_ RemoveTextureHost for deferred removal texture hosts.
// been run if the texture host was not marked deferred.
// If the compositable does not cleanup the texture host now, it is the
// compositable's responsibility to cleanup the texture host before the
// texture host dies.
virtual void RemoveTextureHostDeferred(TextureHost* aTexture)
{
MOZ_CRASH("Compositable was not expecting to handle deferred removal of texture hosts");
}
virtual void RemoveTextureHost(TextureHost* aTexture);
TextureHost* GetTextureHost(uint64_t aTextureID);
protected:

Просмотреть файл

@ -48,7 +48,7 @@ ContentHostBaseNew::DestroyTextureHost()
// The third clause in the if statement checks that we are in fact done with
// this texture. We don't want to prematurely deallocate a texture we might
// use again or double deallocate. Deallocation will happen in
// RemoveTextureHostDeferred.
// RemoveTextureHost.
// Note that GetTextureHost is linear in the number of texture hosts, but as
// long as that number is small (I expect a maximum of 6 for now) then it
// should be ok.
@ -74,13 +74,16 @@ ContentHostBaseNew::DestroyTextureHostOnWhite()
}
void
ContentHostBaseNew::RemoveTextureHostDeferred(TextureHost* aTexture)
ContentHostBaseNew::RemoveTextureHost(TextureHost* aTexture)
{
if (!(mTextureHost && mTextureHost == aTexture) &&
if ((aTexture->GetFlags() & TEXTURE_DEALLOCATE_DEFERRED) &&
!(mTextureHost && mTextureHost == aTexture) &&
!(mTextureHostOnWhite && mTextureHostOnWhite == aTexture)) {
MOZ_ASSERT(aTexture->GetFlags() & TEXTURE_DEALLOCATE_DEFERRED);
MOZ_ASSERT(!(aTexture->GetFlags() & TEXTURE_DEALLOCATE_CLIENT));
aTexture->DeallocateSharedData();
}
CompositableHost::RemoveTextureHost(aTexture);
}
class MOZ_STACK_CLASS AutoLockTextureHost

Просмотреть файл

@ -42,10 +42,10 @@ ImageHost::UseTextureHost(TextureHost* aTexture)
}
void
ImageHost::RemoveTextureHost(uint64_t aTextureID)
ImageHost::RemoveTextureHost(TextureHost* aTexture)
{
CompositableHost::RemoveTextureHost(aTextureID);
if (mFrontBuffer && mFrontBuffer->GetID() == aTextureID) {
CompositableHost::RemoveTextureHost(aTexture);
if (mFrontBuffer && mFrontBuffer->GetID() == aTexture->GetID()) {
mFrontBuffer = nullptr;
}
}

Просмотреть файл

@ -55,7 +55,7 @@ public:
virtual void UseTextureHost(TextureHost* aTexture) MOZ_OVERRIDE;
virtual void RemoveTextureHost(uint64_t aTextureID) MOZ_OVERRIDE;
virtual void RemoveTextureHost(TextureHost* aTexture) MOZ_OVERRIDE;
virtual TextureHost* GetAsTextureHost() MOZ_OVERRIDE;

Просмотреть файл

@ -271,15 +271,12 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
TextureFlags flags = texture->GetFlags();
if (flags & TEXTURE_DEALLOCATE_DEFERRED) {
MOZ_ASSERT(!(flags & TEXTURE_DEALLOCATE_CLIENT),
"textures should not be marked for deferred removal and client-side removal");
compositable->RemoveTextureHostDeferred(texture);
} else if (!(flags & TEXTURE_DEALLOCATE_CLIENT)) {
if (!(flags & TEXTURE_DEALLOCATE_CLIENT) &&
!(flags & TEXTURE_DEALLOCATE_DEFERRED)) {
texture->DeallocateSharedData();
}
compositable->RemoveTextureHost(op.textureID());
compositable->RemoveTextureHost(texture);
// if it is not the host that deallocates the shared data, then we need
// to notfy the client side to tell when it is safe to deallocate or