Bug 897452 - Part 7 - Implement TextureChild::ActorDestroy to notify its TextureClient - r=nical

This commit is contained in:
Benoit Jacob 2013-12-11 13:05:21 -05:00
Родитель 124e78fd76
Коммит 513ae59f87
2 изменённых файлов: 21 добавлений и 0 удалений

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

@ -56,6 +56,7 @@ public:
TextureChild()
: mForwarder(nullptr)
, mTextureData(nullptr)
, mTextureClient(nullptr)
{
MOZ_COUNT_CTOR(TextureChild);
}
@ -83,9 +84,15 @@ public:
ISurfaceAllocator* GetAllocator() { return mForwarder; }
void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
private:
CompositableForwarder* mForwarder;
TextureClientData* mTextureData;
TextureClient* mTextureClient;
friend class TextureClient;
};
void
@ -105,6 +112,14 @@ TextureChild::Recv__delete__()
return true;
}
void
TextureChild::ActorDestroy(ActorDestroyReason why)
{
if (mTextureClient) {
mTextureClient->mActor = nullptr;
}
}
// static
PTextureChild*
TextureClient::CreateIPDLActor()
@ -133,6 +148,7 @@ TextureClient::InitIPDLActor(CompositableForwarder* aForwarder)
mActor = static_cast<TextureChild*>(aForwarder->CreateEmptyTextureChild());
mActor->mForwarder = aForwarder;
mActor->mTextureClient = this;
mShared = true;
return mActor->SendInit(desc, GetFlags());
}
@ -250,6 +266,9 @@ TextureClient::Finalize()
if (mActor) {
// this will call ForceRemove in the right thread, using a sync proxy if needed
mActor->GetForwarder()->RemoveTexture(this);
// mActor has a raw pointer to us, mActor->mTextureClient. Null it before we die.
mActor->mTextureClient = nullptr;
}
}

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

@ -299,6 +299,8 @@ protected:
TextureFlags mFlags;
bool mShared;
bool mValid;
friend class TextureChild;
};
/**