Backout Bug 907463 for causing bug 930575

This commit is contained in:
Gregor Wagner 2013-10-25 14:44:03 -07:00
Родитель 7d6127ba34
Коммит 54baf977db
21 изменённых файлов: 7 добавлений и 288 удалений

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

@ -105,14 +105,6 @@ CanvasClient2D::CreateBufferTextureClient(gfx::SurfaceFormat aFormat, TextureFla
mTextureInfo.mTextureFlags | aFlags);
}
void
CanvasClient2D::OnActorDestroy()
{
if (mBuffer) {
mBuffer->OnActorDestroy();
}
}
void
DeprecatedCanvasClient2D::Updated()
{
@ -164,14 +156,6 @@ DeprecatedCanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
mDeprecatedTextureClient->Unlock();
}
void
DeprecatedCanvasClient2D::OnActorDestroy()
{
if (mDeprecatedTextureClient) {
mDeprecatedTextureClient->OnActorDestroy();
}
}
void
DeprecatedCanvasClientSurfaceStream::Updated()
{
@ -240,13 +224,5 @@ DeprecatedCanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLaye
aLayer->Painted();
}
void
DeprecatedCanvasClientSurfaceStream::OnActorDestroy()
{
if (mDeprecatedTextureClient) {
mDeprecatedTextureClient->OnActorDestroy();
}
}
}
}

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

@ -91,12 +91,9 @@ public:
mBuffer = nullptr;
}
virtual void OnActorDestroy() MOZ_OVERRIDE;
private:
RefPtr<TextureClient> mBuffer;
};
class DeprecatedCanvasClient2D : public CanvasClient
{
public:
@ -117,8 +114,6 @@ public:
mDeprecatedTextureClient->SetDescriptorFromReply(aDescriptor);
}
virtual void OnActorDestroy() MOZ_OVERRIDE;
private:
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
};
@ -145,8 +140,6 @@ public:
mDeprecatedTextureClient->SetDescriptorFromReply(aDescriptor);
}
virtual void OnActorDestroy() MOZ_OVERRIDE;
private:
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
};

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

@ -35,6 +35,7 @@ CompositableClient::~CompositableClient()
Destroy();
FlushTexturesToRemoveCallbacks();
MOZ_ASSERT(mTexturesToRemove.Length() == 0, "would leak textures pending for deletion");
}
@ -86,7 +87,6 @@ CompositableClient::Destroy()
if (!mCompositableChild) {
return;
}
mCompositableChild->SetClient(nullptr);
mCompositableChild->Destroy();
mCompositableChild = nullptr;
}
@ -257,13 +257,5 @@ CompositableClient::OnTransaction()
mTexturesToRemove.Clear();
}
void
CompositableChild::ActorDestroy(ActorDestroyReason why)
{
if (mCompositableClient) {
mCompositableClient->OnActorDestroy();
}
}
} // namespace layers
} // namespace mozilla

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

@ -161,12 +161,6 @@ public:
* Only call this if you know what you are doing.
*/
void FlushTexturesToRemoveCallbacks();
/**
* Our IPDL actor is being destroyed, get rid of any shmem resources now.
*/
virtual void OnActorDestroy() = 0;
protected:
struct TextureIDAndFlags {
TextureIDAndFlags(uint64_t aID, TextureFlags aFlags)
@ -213,8 +207,6 @@ public:
return mCompositableClient;
}
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
void SetAsyncID(uint64_t aID) { mID = aID; }
uint64_t GetAsyncID() const
{

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

@ -327,21 +327,6 @@ ContentClientRemoteBuffer::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
}
}
void
ContentClientRemoteBuffer::OnActorDestroy()
{
if (mDeprecatedTextureClient) {
mDeprecatedTextureClient->OnActorDestroy();
}
if (mDeprecatedTextureClientOnWhite) {
mDeprecatedTextureClientOnWhite->OnActorDestroy();
}
for (size_t i = 0; i < mOldTextures.Length(); ++i) {
mOldTextures[i]->OnActorDestroy();
}
}
ContentClientDoubleBuffered::~ContentClientDoubleBuffered()
{
if (mDeprecatedTextureClient) {
@ -442,26 +427,6 @@ ContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
ContentClientRemoteBuffer::SwapBuffers(aFrontUpdatedRegion);
}
void
ContentClientDoubleBuffered::OnActorDestroy()
{
if (mDeprecatedTextureClient) {
mDeprecatedTextureClient->OnActorDestroy();
}
if (mDeprecatedTextureClientOnWhite) {
mDeprecatedTextureClientOnWhite->OnActorDestroy();
}
for (size_t i = 0; i < mOldTextures.Length(); ++i) {
mOldTextures[i]->OnActorDestroy();
}
if (mFrontClient) {
mFrontClient->OnActorDestroy();
}
if (mFrontClientOnWhite) {
mFrontClientOnWhite->OnActorDestroy();
}
}
struct AutoDeprecatedTextureClient {
AutoDeprecatedTextureClient()
: mTexture(nullptr)

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

@ -163,8 +163,6 @@ public:
MOZ_CRASH("Should not be called on non-remote ContentClient");
}
virtual void OnActorDestroy() MOZ_OVERRIDE {}
private:
BasicLayerManager* mManager;
};
@ -249,8 +247,6 @@ public:
return mTextureInfo;
}
virtual void OnActorDestroy() MOZ_OVERRIDE;
protected:
virtual nsIntRegion GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
const nsIntRegion& aVisibleRegion,
@ -314,8 +310,6 @@ protected:
virtual void DestroyFrontBuffer() MOZ_OVERRIDE;
virtual void LockFrontBuffer() MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE;
private:
void UpdateDestinationFrom(const RotatedBuffer& aSource,
const nsIntRegion& aUpdateRegion);
@ -401,8 +395,6 @@ public:
}
}
virtual void OnActorDestroy() MOZ_OVERRIDE {}
private:
enum BufferType{

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

@ -280,25 +280,6 @@ ImageClientBuffered::UpdateImage(ImageContainer* aContainer,
return ImageClientSingle::UpdateImage(aContainer, aContentFlags);
}
void
ImageClientSingle::OnActorDestroy()
{
if (mFrontBuffer) {
mFrontBuffer->OnActorDestroy();
}
}
void
ImageClientBuffered::OnActorDestroy()
{
if (mFrontBuffer) {
mFrontBuffer->OnActorDestroy();
}
if (mBackBuffer) {
mBackBuffer->OnActorDestroy();
}
}
bool
ImageClientSingle::AddTextureClient(TextureClient* aTexture)
{
@ -484,14 +465,6 @@ ImageClientBridge::ImageClientBridge(CompositableForwarder* aFwd,
{
}
void
DeprecatedImageClientSingle::OnActorDestroy()
{
if (mDeprecatedTextureClient) {
mDeprecatedTextureClient->OnActorDestroy();
}
}
bool
ImageClientBridge::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags)
{

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

@ -102,8 +102,6 @@ public:
virtual void FlushAllImages(bool aExceptFront) MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE;
protected:
RefPtr<TextureClient> mFrontBuffer;
// Some layers may want to enforce some flags to all their textures
@ -127,8 +125,6 @@ public:
virtual void FlushAllImages(bool aExceptFront) MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE;
protected:
RefPtr<TextureClient> mBackBuffer;
};
@ -173,8 +169,6 @@ public:
virtual already_AddRefed<Image> CreateImage(const uint32_t *aFormats,
uint32_t aNumFormats) MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE;
private:
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
TextureInfo mTextureInfo;
@ -216,8 +210,6 @@ public:
return nullptr;
}
virtual void OnActorDestroy() MOZ_OVERRIDE {}
protected:
uint64_t mAsyncContainerID;
ShadowableLayer* mLayer;

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

@ -388,15 +388,6 @@ DeprecatedTextureClient::~DeprecatedTextureClient()
MOZ_ASSERT(mDescriptor.type() == SurfaceDescriptor::T__None, "Need to release surface!");
}
void
DeprecatedTextureClient::OnActorDestroy()
{
if (ISurfaceAllocator::IsShmem(&mDescriptor)) {
mDescriptor = SurfaceDescriptor();
}
}
DeprecatedTextureClientShmem::DeprecatedTextureClientShmem(CompositableForwarder* aForwarder,
const TextureInfo& aTextureInfo)
: DeprecatedTextureClient(aForwarder, aTextureInfo)

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

@ -216,10 +216,6 @@ public:
*/
void MarkInvalid() { mValid = false; }
// If a texture client holds a reference to shmem, it should override this
// method to forget about the shmem _without_ releasing it.
virtual void OnActorDestroy() {}
protected:
void AddFlags(TextureFlags aFlags)
{
@ -320,11 +316,6 @@ public:
ipc::Shmem& GetShmem() { return mShmem; }
virtual void OnActorDestroy() MOZ_OVERRIDE
{
mShmem = ipc::Shmem();
}
protected:
ipc::Shmem mShmem;
ISurfaceAllocator* mAllocator;
@ -501,8 +492,6 @@ public:
virtual gfxContentType GetContentType() = 0;
void OnActorDestroy();
protected:
DeprecatedTextureClient(CompositableForwarder* aForwarder,
const TextureInfo& aTextureInfo);

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

@ -201,14 +201,6 @@ public:
static BasicTiledLayerBuffer OpenDescriptor(ISurfaceAllocator* aAllocator,
const SurfaceDescriptorTiles& aDescriptor);
void OnActorDestroy()
{
for (size_t i = 0; i < mRetainedTiles.Length(); i++) {
if (mRetainedTiles[i].IsPlaceholderTile()) continue;
mRetainedTiles[i].mDeprecatedTextureClient->OnActorDestroy();
}
}
protected:
BasicTiledLayerTile ValidateTile(BasicTiledLayerTile aTile,
const nsIntPoint& aTileRect,
@ -298,12 +290,6 @@ public:
};
void LockCopyAndWrite(TiledBufferType aType);
virtual void OnActorDestroy() MOZ_OVERRIDE
{
mTiledBuffer.OnActorDestroy();
mLowPrecisionTiledBuffer.OnActorDestroy();
}
private:
BasicTiledLayerBuffer mTiledBuffer;
BasicTiledLayerBuffer mLowPrecisionTiledBuffer;

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

@ -237,14 +237,7 @@ 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);
mHost->Detach();
}
}

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

@ -110,12 +110,6 @@ public:
mBackendData = aBackendData;
}
/**
* Our IPDL actor is being destroyed, get rid of any shmem resources now and
* don't worry about compositing anymore.
*/
virtual void OnActorDestroy() = 0;
// If base class overrides, it should still call the parent implementation
virtual void SetCompositor(Compositor* aCompositor);
@ -247,7 +241,6 @@ public:
static const AttachFlags NO_FLAGS = 0;
static const AttachFlags ALLOW_REATTACH = 1;
static const AttachFlags KEEP_ATTACHED = 2;
static const AttachFlags FORCE_DETACH = 2;
virtual void Attach(Layer* aLayer,
Compositor* aCompositor,
@ -268,12 +261,10 @@ public:
// attached to that layer. If we are part of a normal layer, then we will be
// detached in any case. if aLayer is null, then we will only detach if we are
// not async.
// Only force detach if the IPDL tree is being shutdown.
void Detach(Layer* aLayer = nullptr, AttachFlags aFlags = NO_FLAGS)
void Detach(Layer* aLayer = nullptr)
{
if (!mKeepAttached ||
aLayer == mLayer ||
aFlags & FORCE_DETACH) {
aLayer == mLayer) {
SetLayer(nullptr);
SetCompositor(nullptr);
mAttached = false;

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

@ -52,23 +52,6 @@ ContentHostBase::DestroyFrontHost()
mDeprecatedTextureHostOnWhite = nullptr;
}
void
ContentHostBase::OnActorDestroy()
{
if (mDeprecatedTextureHost) {
mDeprecatedTextureHost->OnActorDestroy();
}
if (mDeprecatedTextureHostOnWhite) {
mDeprecatedTextureHostOnWhite->OnActorDestroy();
}
if (mNewFrontHost) {
mNewFrontHost->OnActorDestroy();
}
if (mNewFrontHostOnWhite) {
mNewFrontHostOnWhite->OnActorDestroy();
}
}
void
ContentHostBase::Composite(EffectChain& aEffectChain,
float aOpacity,
@ -427,16 +410,19 @@ ContentHostDoubleBuffered::DestroyTextures()
"We won't be able to destroy our SurfaceDescriptor");
mNewFrontHost = nullptr;
}
if (mNewFrontHostOnWhite) {
MOZ_ASSERT(mNewFrontHostOnWhite->GetDeAllocator(),
"We won't be able to destroy our SurfaceDescriptor");
mNewFrontHostOnWhite = nullptr;
}
if (mBackHost) {
MOZ_ASSERT(mBackHost->GetDeAllocator(),
"We won't be able to destroy our SurfaceDescriptor");
mBackHost = nullptr;
}
if (mBackHostOnWhite) {
MOZ_ASSERT(mBackHostOnWhite->GetDeAllocator(),
"We won't be able to destroy our SurfaceDescriptor");
@ -446,29 +432,6 @@ ContentHostDoubleBuffered::DestroyTextures()
// don't touch mDeprecatedTextureHost, we might need it for compositing
}
void
ContentHostDoubleBuffered::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
ContentHostDoubleBuffered::UpdateThebes(const ThebesBufferData& aData,
const nsIntRegion& aUpdated,

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

@ -128,8 +128,6 @@ public:
// destroy our front buffer so that we can continue to composite.
virtual void DestroyTextures() = 0;
virtual void OnActorDestroy() MOZ_OVERRIDE;
protected:
virtual nsIntPoint GetOriginOffset()
{
@ -180,8 +178,6 @@ public:
const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
virtual void DestroyTextures() MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE;
#ifdef MOZ_DUMP_PAINTING
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",

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

@ -69,13 +69,6 @@ public:
virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE
{
if (mFrontBuffer) {
mFrontBuffer->OnActorDestroy();
}
}
#ifdef MOZ_LAYERS_HAVE_LOG
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
#endif
@ -139,13 +132,6 @@ public:
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE
{
if (mDeprecatedTextureHost) {
mDeprecatedTextureHost->OnActorDestroy();
}
}
#ifdef MOZ_LAYERS_HAVE_LOG
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
#endif

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

@ -246,15 +246,6 @@ DeprecatedTextureHost::SwapTextures(const SurfaceDescriptor& aImage,
SetBuffer(mBuffer, mDeAllocator);
}
void
DeprecatedTextureHost::OnActorDestroy()
{
if (ISurfaceAllocator::IsShmem(mBuffer)) {
*mBuffer = SurfaceDescriptor();
mBuffer = nullptr;
}
}
#ifdef MOZ_LAYERS_HAVE_LOG
void
@ -522,13 +513,6 @@ ShmemTextureHost::DeallocateSharedData()
}
}
void
ShmemTextureHost::OnActorDestroy()
{
delete mShmem;
mShmem = nullptr;
}
uint8_t* ShmemTextureHost::GetBuffer()
{
return mShmem ? mShmem->get<uint8_t>() : nullptr;

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

@ -384,10 +384,6 @@ public:
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData);
// 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() {}
#ifdef MOZ_LAYERS_HAVE_LOG
virtual const char *Name() { return "TextureHost"; }
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
@ -488,8 +484,6 @@ public:
virtual const char *Name() MOZ_OVERRIDE { return "ShmemTextureHost"; }
#endif
virtual void OnActorDestroy() MOZ_OVERRIDE;
protected:
ipc::Shmem* mShmem;
ISurfaceAllocator* mDeallocator;
@ -724,8 +718,6 @@ public:
// see bug 865908 about fixing this.
virtual void ForgetBuffer() {}
void OnActorDestroy();
protected:
/**
* Should be implemented by the backend-specific DeprecatedTextureHost classes

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

@ -119,16 +119,6 @@ public:
mCompositor = aCompositor;
}
void OnActorDestroy()
{
Iterator end = TilesEnd();
for (Iterator it = TilesBegin(); it != end; ++it) {
if (it->mDeprecatedTextureHost) {
it->mDeprecatedTextureHost->OnActorDestroy();
}
}
}
protected:
TiledTexture ValidateTile(TiledTexture aTile,
const nsIntPoint& aTileRect,
@ -251,12 +241,6 @@ public:
Compositor* aCompositor,
AttachFlags aFlags = NO_FLAGS) MOZ_OVERRIDE;
virtual void OnActorDestroy() MOZ_OVERRIDE
{
mVideoMemoryTiledBuffer.OnActorDestroy();
mLowPrecisionVideoMemoryTiledBuffer.OnActorDestroy();
}
#ifdef MOZ_DUMP_PAINTING
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",

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

@ -109,13 +109,6 @@ ISurfaceAllocator::AllocSurfaceDescriptorWithCaps(const gfxIntSize& aSize,
return true;
}
/* static */ bool
ISurfaceAllocator::IsShmem(SurfaceDescriptor* aSurface)
{
return aSurface && (aSurface->type() == SurfaceDescriptor::TShmem ||
aSurface->type() == SurfaceDescriptor::TYCbCrImage ||
aSurface->type() == SurfaceDescriptor::TRGBImage);
}
void
ISurfaceAllocator::DestroySharedSurface(SurfaceDescriptor* aSurface)

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

@ -119,10 +119,6 @@ ISurfaceAllocator() {}
{
return nullptr;
}
// Returns true if aSurface wraps a Shmem.
static bool IsShmem(SurfaceDescriptor* aSurface);
protected:
// this method is needed for a temporary fix, will be removed after
// DeprecatedTextureClient/Host rework.