mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Bug 897452 - Part 7 - Implement TextureChild::ActorDestroy to notify its TextureClient - r=nical
This commit is contained in:
parent
9e7e683c5a
commit
c590710a23
@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user