mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 897452 - Part 10 - adapt post landing of bug 893301 - r=nical,nrc
This commit is contained in:
parent
50dc540401
commit
4002af5009
@ -233,18 +233,6 @@ CompositableClient::CreateTextureClientForDrawing(SurfaceFormat aFormat,
|
||||
return result;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
CompositableClient::NextTextureID()
|
||||
{
|
||||
++mNextTextureID;
|
||||
// 0 is always an invalid ID
|
||||
if (mNextTextureID == 0) {
|
||||
++mNextTextureID;
|
||||
}
|
||||
|
||||
return mNextTextureID;
|
||||
}
|
||||
|
||||
bool
|
||||
CompositableClient::AddTextureClient(TextureClient* aClient)
|
||||
{
|
||||
|
@ -148,9 +148,6 @@ public:
|
||||
virtual void OnActorDestroy() = 0;
|
||||
|
||||
protected:
|
||||
// return the next texture ID
|
||||
uint64_t NextTextureID();
|
||||
|
||||
CompositableChild* mCompositableChild;
|
||||
CompositableForwarder* mForwarder;
|
||||
};
|
||||
|
@ -148,9 +148,6 @@ ContentClientRemoteBuffer::EndPaint()
|
||||
// decided we didn't need one yet because the region to draw was empty.
|
||||
SetBufferProvider(nullptr);
|
||||
SetBufferProviderOnWhite(nullptr);
|
||||
for (size_t i = 0; i < mOldTextures.Length(); ++i) {
|
||||
RemoveTextureClient(mOldTextures[i]);
|
||||
}
|
||||
mOldTextures.Clear();
|
||||
|
||||
if (mTextureClient) {
|
||||
@ -307,9 +304,6 @@ ContentClientRemoteBuffer::OnActorDestroy()
|
||||
if (mTextureClientOnWhite) {
|
||||
mTextureClientOnWhite->OnActorDestroy();
|
||||
}
|
||||
for (size_t i = 0; i < mOldTextures.Length(); ++i) {
|
||||
mOldTextures[i]->OnActorDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -507,9 +501,6 @@ DeprecatedContentClientRemoteBuffer::OnActorDestroy()
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
mDeprecatedTextureClientOnWhite->OnActorDestroy();
|
||||
}
|
||||
for (size_t i = 0; i < mOldTextures.Length(); ++i) {
|
||||
mOldTextures[i]->OnActorDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -675,9 +666,6 @@ ContentClientDoubleBuffered::OnActorDestroy()
|
||||
if (mTextureClientOnWhite) {
|
||||
mTextureClientOnWhite->OnActorDestroy();
|
||||
}
|
||||
for (size_t i = 0; i < mOldTextures.Length(); ++i) {
|
||||
mOldTextures[i]->OnActorDestroy();
|
||||
}
|
||||
if (mFrontClient) {
|
||||
mFrontClient->OnActorDestroy();
|
||||
}
|
||||
@ -795,9 +783,6 @@ DeprecatedContentClientDoubleBuffered::OnActorDestroy()
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
mDeprecatedTextureClientOnWhite->OnActorDestroy();
|
||||
}
|
||||
for (size_t i = 0; i < mOldTextures.Length(); ++i) {
|
||||
mOldTextures[i]->OnActorDestroy();
|
||||
}
|
||||
if (mFrontClient) {
|
||||
mFrontClient->OnActorDestroy();
|
||||
}
|
||||
|
@ -48,16 +48,6 @@ CompositableHost::UseTextureHost(TextureHost* aTexture)
|
||||
aTexture->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
|
||||
}
|
||||
|
||||
void
|
||||
CompositableHost::OnActorDestroy()
|
||||
{
|
||||
TextureHost* it = mFirstTexture;
|
||||
while (it) {
|
||||
it->OnActorDestroy();
|
||||
it = it->GetNextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CompositableHost::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
@ -214,13 +204,6 @@ void
|
||||
CompositableParent::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
if (mHost) {
|
||||
// XXX: sadness warning. We should be able to do this whenever we get ActorDestroy,
|
||||
// not just for abnormal shutdowns (which is the only case we _need_ to - so that
|
||||
// we don't double release our shmems). But, for some reason, that causes a
|
||||
// crash, we don't know why. (Bug 925773).
|
||||
if (why == AbnormalShutdown) {
|
||||
mHost->OnActorDestroy();
|
||||
}
|
||||
mHost->Detach(nullptr, CompositableHost::FORCE_DETACH);
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +301,6 @@ protected:
|
||||
Compositor* mCompositor;
|
||||
Layer* mLayer;
|
||||
RefPtr<CompositableBackendSpecificData> mBackendData;
|
||||
RefPtr<TextureHost> mFirstTexture;
|
||||
bool mAttached;
|
||||
bool mKeepAttached;
|
||||
};
|
||||
|
@ -45,47 +45,15 @@ ContentHostBase::GetAsTextureHost()
|
||||
void
|
||||
ContentHostBase::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
|
||||
// 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.
|
||||
if (mTextureHost &&
|
||||
mTextureHost->GetFlags() & TEXTURE_DEALLOCATE_DEFERRED &&
|
||||
!GetTextureHost(mTextureHost->GetID())) {
|
||||
MOZ_ASSERT(!(mTextureHost->GetFlags() & TEXTURE_DEALLOCATE_CLIENT));
|
||||
mTextureHost->DeallocateSharedData();
|
||||
}
|
||||
mTextureHost = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
ContentHostBase::DestroyTextureHostOnWhite()
|
||||
{
|
||||
if (mTextureHostOnWhite &&
|
||||
mTextureHostOnWhite->GetFlags() & TEXTURE_DEALLOCATE_DEFERRED &&
|
||||
!GetTextureHost(mTextureHostOnWhite->GetID())) {
|
||||
MOZ_ASSERT(!(mTextureHostOnWhite->GetFlags() & TEXTURE_DEALLOCATE_CLIENT));
|
||||
mTextureHostOnWhite->DeallocateSharedData();
|
||||
}
|
||||
mTextureHostOnWhite = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
ContentHostBase::RemoveTextureHost(TextureHost* aTexture)
|
||||
{
|
||||
if ((aTexture->GetFlags() & TEXTURE_DEALLOCATE_DEFERRED) &&
|
||||
!(mTextureHost && mTextureHost == aTexture) &&
|
||||
!(mTextureHostOnWhite && mTextureHostOnWhite == aTexture)) {
|
||||
MOZ_ASSERT(!(aTexture->GetFlags() & TEXTURE_DEALLOCATE_CLIENT));
|
||||
aTexture->DeallocateSharedData();
|
||||
}
|
||||
|
||||
CompositableHost::RemoveTextureHost(aTexture);
|
||||
}
|
||||
|
||||
class MOZ_STACK_CLASS AutoLockTextureHost
|
||||
{
|
||||
public:
|
||||
@ -338,12 +306,6 @@ ContentHostBase::Dump(FILE* aFile,
|
||||
void
|
||||
ContentHostBase::OnActorDestroy()
|
||||
{
|
||||
if (mTextureHost) {
|
||||
mTextureHost->OnActorDestroy();
|
||||
}
|
||||
if (mTextureHostOnWhite) {
|
||||
mTextureHostOnWhite->OnActorDestroy();
|
||||
}
|
||||
CompositableHost::OnActorDestroy();
|
||||
}
|
||||
|
||||
@ -376,18 +338,6 @@ DeprecatedContentHostBase::DestroyFrontHost()
|
||||
void
|
||||
DeprecatedContentHostBase::OnActorDestroy()
|
||||
{
|
||||
if (mDeprecatedTextureHost) {
|
||||
mDeprecatedTextureHost->OnActorDestroy();
|
||||
}
|
||||
if (mDeprecatedTextureHostOnWhite) {
|
||||
mDeprecatedTextureHostOnWhite->OnActorDestroy();
|
||||
}
|
||||
if (mNewFrontHost) {
|
||||
mNewFrontHost->OnActorDestroy();
|
||||
}
|
||||
if (mNewFrontHostOnWhite) {
|
||||
mNewFrontHostOnWhite->OnActorDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -851,24 +801,6 @@ DeprecatedContentHostDoubleBuffered::DestroyTextures()
|
||||
void
|
||||
DeprecatedContentHostDoubleBuffered::OnActorDestroy()
|
||||
{
|
||||
if (mDeprecatedTextureHost) {
|
||||
mDeprecatedTextureHost->OnActorDestroy();
|
||||
}
|
||||
if (mDeprecatedTextureHostOnWhite) {
|
||||
mDeprecatedTextureHostOnWhite->OnActorDestroy();
|
||||
}
|
||||
if (mNewFrontHost) {
|
||||
mNewFrontHost->OnActorDestroy();
|
||||
}
|
||||
if (mNewFrontHostOnWhite) {
|
||||
mNewFrontHostOnWhite->OnActorDestroy();
|
||||
}
|
||||
if (mBackHost) {
|
||||
mBackHost->OnActorDestroy();
|
||||
}
|
||||
if (mBackHostOnWhite) {
|
||||
mBackHostOnWhite->OnActorDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -117,8 +117,6 @@ public:
|
||||
|
||||
virtual void UseTextureHost(TextureHost* aTexture) MOZ_OVERRIDE;
|
||||
|
||||
virtual void RemoveTextureHost(TextureHost* aTexture) MOZ_OVERRIDE;
|
||||
|
||||
virtual void SetPaintWillResample(bool aResample) { mPaintWillResample = aResample; }
|
||||
|
||||
virtual void OnActorDestroy() MOZ_OVERRIDE;
|
||||
|
@ -127,12 +127,7 @@ public:
|
||||
|
||||
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
||||
|
||||
virtual void OnActorDestroy() MOZ_OVERRIDE
|
||||
{
|
||||
if (mDeprecatedTextureHost) {
|
||||
mDeprecatedTextureHost->OnActorDestroy();
|
||||
}
|
||||
}
|
||||
virtual void OnActorDestroy() MOZ_OVERRIDE {}
|
||||
|
||||
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
|
||||
|
||||
|
@ -43,10 +43,10 @@ public:
|
||||
|
||||
virtual bool RecvRemoveTextureSync() MOZ_OVERRIDE;
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
||||
|
||||
TextureHost* GetTextureHost() { return mTextureHost; }
|
||||
|
||||
void ActorDestroy(ActorDestroyReason why);
|
||||
|
||||
ISurfaceAllocator* mAllocator;
|
||||
RefPtr<TextureHost> mTextureHost;
|
||||
};
|
||||
@ -212,13 +212,23 @@ TextureHost::SetCompositableBackendSpecificData(CompositableBackendSpecificData*
|
||||
|
||||
|
||||
TextureHost::TextureHost(TextureFlags aFlags)
|
||||
: mFlags(aFlags)
|
||||
: mRefCount(0)
|
||||
, mFlags(aFlags)
|
||||
{}
|
||||
|
||||
TextureHost::~TextureHost()
|
||||
{
|
||||
}
|
||||
|
||||
void TextureHost::Finalize()
|
||||
{
|
||||
if (GetFlags() & TEXTURE_DEALLOCATE_DEFERRED) {
|
||||
MOZ_ASSERT(!(GetFlags() & TEXTURE_DEALLOCATE_CLIENT));
|
||||
DeallocateSharedData();
|
||||
DeallocateDeviceData();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TextureHost::PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
{
|
||||
@ -300,7 +310,7 @@ DeprecatedTextureHost::SwapTextures(const SurfaceDescriptor& aImage,
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedTextureHost::OnActorDestroy()
|
||||
DeprecatedTextureHost::OnShutdown()
|
||||
{
|
||||
if (ISurfaceAllocator::IsShmem(mBuffer)) {
|
||||
*mBuffer = SurfaceDescriptor();
|
||||
@ -593,7 +603,7 @@ ShmemTextureHost::ForgetSharedData()
|
||||
}
|
||||
|
||||
void
|
||||
ShmemTextureHost::OnActorDestroy()
|
||||
ShmemTextureHost::OnShutdown()
|
||||
{
|
||||
delete mShmem;
|
||||
mShmem = nullptr;
|
||||
@ -690,14 +700,15 @@ TextureParent::ActorDestroy(ActorDestroyReason why)
|
||||
NS_WARNING("PTexture deleted after ancestor");
|
||||
// fall-through to deletion path
|
||||
case Deletion:
|
||||
if (!(mTextureHost->GetFlags() & TEXTURE_DEALLOCATE_CLIENT)) {
|
||||
if (!(mTextureHost->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) &&
|
||||
!(mTextureHost->GetFlags() & TEXTURE_DEALLOCATE_DEFERRED)) {
|
||||
mTextureHost->DeallocateSharedData();
|
||||
}
|
||||
break;
|
||||
|
||||
case NormalShutdown:
|
||||
case AbnormalShutdown:
|
||||
mTextureHost->OnActorDestroy();
|
||||
mTextureHost->OnShutdown();
|
||||
break;
|
||||
|
||||
case FailedConstructor:
|
||||
|
@ -258,13 +258,39 @@ private:
|
||||
* The Lock/Unlock mecanism here mirrors Lock/Unlock in TextureClient.
|
||||
*
|
||||
*/
|
||||
class TextureHost : public RefCounted<TextureHost>
|
||||
class TextureHost
|
||||
{
|
||||
Atomic<int> mRefCount;
|
||||
|
||||
/**
|
||||
* Called once, just before the destructor.
|
||||
*
|
||||
* Here goes the shut-down code that uses virtual methods.
|
||||
* Must only be called by Release().
|
||||
*/
|
||||
void Finalize();
|
||||
|
||||
public:
|
||||
TextureHost(TextureFlags aFlags);
|
||||
|
||||
virtual ~TextureHost();
|
||||
|
||||
void AddRef() {
|
||||
MOZ_ASSERT(mRefCount >= 0);
|
||||
++mRefCount;
|
||||
}
|
||||
|
||||
void Release() {
|
||||
MOZ_ASSERT(mRefCount > 0);
|
||||
if (0 == --mRefCount) {
|
||||
#ifdef DEBUG
|
||||
mRefCount = detail::DEAD;
|
||||
#endif
|
||||
Finalize();
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method.
|
||||
*/
|
||||
@ -394,7 +420,7 @@ public:
|
||||
|
||||
// If a texture host holds a reference to shmem, it should override this method
|
||||
// to forget about the shmem _without_ releasing it.
|
||||
virtual void OnActorDestroy() {}
|
||||
virtual void OnShutdown() {}
|
||||
|
||||
virtual const char *Name() { return "TextureHost"; }
|
||||
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
|
||||
@ -490,7 +516,7 @@ public:
|
||||
|
||||
virtual const char *Name() MOZ_OVERRIDE { return "ShmemTextureHost"; }
|
||||
|
||||
virtual void OnActorDestroy() MOZ_OVERRIDE;
|
||||
virtual void OnShutdown() MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
mozilla::ipc::Shmem* mShmem;
|
||||
@ -718,7 +744,7 @@ public:
|
||||
// see bug 865908 about fixing this.
|
||||
virtual void ForgetBuffer() {}
|
||||
|
||||
void OnActorDestroy();
|
||||
void OnShutdown();
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -119,15 +119,7 @@ public:
|
||||
mCompositor = aCompositor;
|
||||
}
|
||||
|
||||
void OnActorDestroy()
|
||||
{
|
||||
Iterator end = TilesEnd();
|
||||
for (Iterator it = TilesBegin(); it != end; ++it) {
|
||||
if (it->mDeprecatedTextureHost) {
|
||||
it->mDeprecatedTextureHost->OnActorDestroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
void OnActorDestroy() {}
|
||||
|
||||
protected:
|
||||
TiledTexture ValidateTile(TiledTexture aTile,
|
||||
|
Loading…
Reference in New Issue
Block a user