From 6eeab25befec3b8f2e9b1ab3032eb51a082e108e Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Mon, 23 Apr 2012 20:08:18 -0400 Subject: [PATCH] Bug 739679 - Part 6: Fix unlocking gfxReusableSurface. r=pcwalton --- gfx/layers/TiledLayerBuffer.h | 2 -- gfx/layers/basic/BasicTiledThebesLayer.h | 3 +++ gfx/layers/opengl/TiledThebesLayerOGL.cpp | 6 ++++++ gfx/thebes/gfxReusableSurfaceWrapper.cpp | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gfx/layers/TiledLayerBuffer.h b/gfx/layers/TiledLayerBuffer.h index 7aee83e6acaa..087b30100a1c 100644 --- a/gfx/layers/TiledLayerBuffer.h +++ b/gfx/layers/TiledLayerBuffer.h @@ -116,8 +116,6 @@ protected: int mRetainedHeight; // in tiles private: - TiledLayerBuffer(const TiledLayerBuffer&) MOZ_DELETE; - const Derived& AsDerived() const { return *static_cast(this); } Derived& AsDerived() { return *static_cast(this); } diff --git a/gfx/layers/basic/BasicTiledThebesLayer.h b/gfx/layers/basic/BasicTiledThebesLayer.h index ba96e08b820d..e5cdaaf4829a 100644 --- a/gfx/layers/basic/BasicTiledThebesLayer.h +++ b/gfx/layers/basic/BasicTiledThebesLayer.h @@ -79,6 +79,9 @@ class BasicTiledLayerBuffer : public TiledLayerBuffer; public: + BasicTiledLayerBuffer() + {} + void PaintThebes(BasicTiledThebesLayer* aLayer, const nsIntRegion& aNewValidRegion, const nsIntRegion& aPaintRegion, diff --git a/gfx/layers/opengl/TiledThebesLayerOGL.cpp b/gfx/layers/opengl/TiledThebesLayerOGL.cpp index 9407346bfb77..888a818f0964 100644 --- a/gfx/layers/opengl/TiledThebesLayerOGL.cpp +++ b/gfx/layers/opengl/TiledThebesLayerOGL.cpp @@ -136,6 +136,12 @@ TiledThebesLayerOGL::ProcessUploadQueue() mValidRegion = mVideoMemoryTiledBuffer.GetValidRegion(); mMainMemoryTiledBuffer.ReadUnlock(); + // Release all the tiles by replacing the tile buffer with an empty + // tiled buffer. This will prevent us from doing a double unlock when + // calling ~TiledThebesLayerOGL. + // FIXME: This wont be needed when we do progressive upload and lock + // tile by tile. + mMainMemoryTiledBuffer = BasicTiledLayerBuffer(); mRegionToUpload = nsIntRegion(); } diff --git a/gfx/thebes/gfxReusableSurfaceWrapper.cpp b/gfx/thebes/gfxReusableSurfaceWrapper.cpp index 817c1446a542..19d0b9513f88 100644 --- a/gfx/thebes/gfxReusableSurfaceWrapper.cpp +++ b/gfx/thebes/gfxReusableSurfaceWrapper.cpp @@ -48,6 +48,7 @@ void gfxReusableSurfaceWrapper::ReadUnlock() { PR_ATOMIC_DECREMENT(&mReadCount); + NS_ABORT_IF_FALSE(mReadCount >= 0, "Should not be negative"); } gfxReusableSurfaceWrapper*