Bug 907792 - Refactor texture flags so that we set the deallocate flags based on the texture type. r=nical

This commit is contained in:
Matt Woodrow
2013-08-28 08:16:03 +12:00
parent 070b5d2361
commit 95364bbe15
7 changed files with 37 additions and 10 deletions

View File

@@ -38,6 +38,7 @@ namespace layers {
TextureClient::TextureClient(TextureFlags aFlags)
: mID(0)
, mFlags(aFlags)
, mShared(false)
{}
TextureClient::~TextureClient()
@@ -46,9 +47,18 @@ TextureClient::~TextureClient()
bool
TextureClient::ShouldDeallocateInDestructor() const
{
return IsAllocated() &&
!IsSharedWithCompositor() &&
!(GetFlags() & (TEXTURE_DEALLOCATE_HOST | TEXTURE_DEALLOCATE_CLIENT));
if (!IsAllocated()) {
return false;
}
if (GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
return true;
}
// If we're meant to be deallocated by the host,
// but we haven't been shared yet, then we should
// deallocate on the client instead.
return (GetFlags() & TEXTURE_DEALLOCATE_HOST) &&
!IsSharedWithCompositor();
}
bool