зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1119019 - Avoid destroying a SharedSurface before its TextureClient/Host pair. r=sotaro
This commit is contained in:
Родитель
5600f01996
Коммит
0b465c61eb
|
@ -403,5 +403,20 @@ CanvasClientSharedSurface::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
|||
forwarder->UseTexture(this, mFrontTex);
|
||||
}
|
||||
|
||||
void
|
||||
CanvasClientSharedSurface::ClearSurfaces()
|
||||
{
|
||||
if (mFrontTex && (mFront || mPrevFront)) {
|
||||
// Force a synchronous destruction so that the TextureHost does not
|
||||
// outlive the SharedSurface. This won't be needed once TextureClient/Host
|
||||
// and SharedSurface are merged.
|
||||
mFrontTex->ForceRemove(true /* sync */);
|
||||
mFrontTex = nullptr;
|
||||
}
|
||||
// It is important to destroy the SharedSurface *after* the TextureClient.
|
||||
mFront = nullptr;
|
||||
mPrevFront = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,25 +119,30 @@ private:
|
|||
|
||||
RefPtr<TextureClient> mFrontTex;
|
||||
|
||||
void ClearSurfaces();
|
||||
|
||||
public:
|
||||
CanvasClientSharedSurface(CompositableForwarder* aLayerForwarder,
|
||||
TextureFlags aFlags);
|
||||
|
||||
~CanvasClientSharedSurface()
|
||||
{
|
||||
ClearSurfaces();
|
||||
}
|
||||
|
||||
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE {
|
||||
return TextureInfo(CompositableType::IMAGE);
|
||||
}
|
||||
|
||||
virtual void Clear() MOZ_OVERRIDE {
|
||||
mFront = nullptr;
|
||||
mPrevFront = nullptr;
|
||||
mFrontTex = nullptr;
|
||||
ClearSurfaces();
|
||||
}
|
||||
|
||||
virtual void Update(gfx::IntSize aSize,
|
||||
ClientCanvasLayer* aLayer) MOZ_OVERRIDE;
|
||||
|
||||
virtual void OnDetach() MOZ_OVERRIDE {
|
||||
CanvasClientSharedSurface::Clear();
|
||||
ClearSurfaces();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -503,10 +503,10 @@ TextureClient::KeepUntilFullDeallocation(KeepAlive* aKeep)
|
|||
mActor->mKeep = aKeep;
|
||||
}
|
||||
|
||||
void TextureClient::ForceRemove()
|
||||
void TextureClient::ForceRemove(bool sync)
|
||||
{
|
||||
if (mValid && mActor) {
|
||||
if (GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
|
||||
if (sync || GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
|
||||
MOZ_PERFORMANCE_WARNING("gfx", "TextureClient/Host pair requires synchronous deallocation");
|
||||
if (mActor->IPCOpen()) {
|
||||
mActor->SendClearTextureHostSync();
|
||||
|
|
|
@ -426,8 +426,10 @@ public:
|
|||
* If the texture flags contain TextureFlags::DEALLOCATE_CLIENT, the destruction
|
||||
* will be synchronously coordinated with the compositor side, otherwise it
|
||||
* will be done asynchronously.
|
||||
* If sync is true, the destruction will be synchronous regardless of the
|
||||
* texture's flags (bad for performance, use with care).
|
||||
*/
|
||||
void ForceRemove();
|
||||
void ForceRemove(bool sync = false);
|
||||
|
||||
virtual void SetReleaseFenceHandle(FenceHandle aReleaseFenceHandle)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче