зеркало из https://github.com/mozilla/gecko-dev.git
Bug 952507 - Fix locking in double buffered ContentClient. r=nrc
This commit is contained in:
Родитель
e8ad54c5c7
Коммит
30b89fa3e5
|
@ -148,7 +148,9 @@ ContentClientRemoteBuffer::EndPaint()
|
|||
SetBufferProvider(nullptr);
|
||||
SetBufferProviderOnWhite(nullptr);
|
||||
for (unsigned i = 0; i< mOldTextures.Length(); ++i) {
|
||||
mOldTextures[i]->Unlock();
|
||||
if (mOldTextures[i]->IsLocked()) {
|
||||
mOldTextures[i]->Unlock();
|
||||
}
|
||||
}
|
||||
mOldTextures.Clear();
|
||||
|
||||
|
@ -557,6 +559,15 @@ ContentClientDoubleBuffered::PrepareFrame()
|
|||
{
|
||||
mIsNewBuffer = false;
|
||||
|
||||
if (mTextureClient) {
|
||||
DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
|
||||
MOZ_ASSERT(locked);
|
||||
}
|
||||
if (mTextureClientOnWhite) {
|
||||
DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
|
||||
MOZ_ASSERT(locked);
|
||||
}
|
||||
|
||||
if (!mFrontAndBackBufferDiffer) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -564,7 +564,7 @@ BufferTextureClient::Lock(OpenMode aMode)
|
|||
NS_WARN_IF_FALSE(!mLocked, "The TextureClient is already Locked!");
|
||||
mOpenMode = aMode;
|
||||
mLocked = true;
|
||||
return true;
|
||||
return IsValid() && IsAllocated();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -172,6 +172,8 @@ public:
|
|||
|
||||
virtual void Unlock() {}
|
||||
|
||||
virtual bool IsLocked() const = 0;
|
||||
|
||||
/**
|
||||
* Returns true if this texture has a lock/unlock mechanism.
|
||||
* Textures that do not implement locking should be immutable or should
|
||||
|
@ -313,6 +315,8 @@ public:
|
|||
|
||||
virtual void Unlock() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsLocked() const MOZ_OVERRIDE { return mLocked; }
|
||||
|
||||
// TextureClientSurface
|
||||
|
||||
virtual TextureClientSurface* AsTextureClientSurface() MOZ_OVERRIDE { return this; }
|
||||
|
|
|
@ -154,6 +154,9 @@ TextureClientD3D11::~TextureClientD3D11()
|
|||
bool
|
||||
TextureClientD3D11::Lock(OpenMode aMode)
|
||||
{
|
||||
if (!IsValid() || !IsAllocated()) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(!mIsLocked, "The Texture is already locked!");
|
||||
LockD3DTexture(mTexture.get());
|
||||
mIsLocked = true;
|
||||
|
|
|
@ -41,6 +41,8 @@ public:
|
|||
|
||||
virtual void Unlock() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsLocked() const MOZ_OVERRIDE { return mIsLocked; }
|
||||
|
||||
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
|
||||
|
||||
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
||||
|
|
|
@ -1266,7 +1266,7 @@ bool
|
|||
CairoTextureClientD3D9::Lock(OpenMode)
|
||||
{
|
||||
MOZ_ASSERT(!mIsLocked);
|
||||
if (!IsValid()) {
|
||||
if (!IsValid() || !IsAllocated()) {
|
||||
return false;
|
||||
}
|
||||
mIsLocked = true;
|
||||
|
|
|
@ -194,6 +194,8 @@ public:
|
|||
|
||||
virtual void Unlock() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsLocked() const MOZ_OVERRIDE { return mIsLocked; }
|
||||
|
||||
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
|
||||
|
||||
virtual gfx::IntSize GetSize() const { return mSize; }
|
||||
|
@ -242,6 +244,8 @@ public:
|
|||
|
||||
virtual void Unlock() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsLocked() const MOZ_OVERRIDE { return mIsLocked; }
|
||||
|
||||
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
|
||||
|
||||
virtual gfx::IntSize GetSize() const { return mSize; }
|
||||
|
@ -287,6 +291,8 @@ public:
|
|||
|
||||
virtual void Unlock() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsLocked() const MOZ_OVERRIDE { return mIsLocked; }
|
||||
|
||||
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
|
||||
|
||||
void InitWith(IDirect3DTexture9* aTexture, HANDLE aSharedHandle, D3DSURFACE_DESC aDesc)
|
||||
|
|
|
@ -174,6 +174,9 @@ bool
|
|||
GrallocTextureClientOGL::Lock(OpenMode aMode)
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
if (!IsValid() || !IsAllocated()) {
|
||||
return false;
|
||||
}
|
||||
// XXX- it would be cleaner to take the openMode into account or to check
|
||||
// that aMode is coherent with mGrallocFlags (which carries more information
|
||||
// than OpenMode).
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace layers {
|
|||
|
||||
MacIOSurfaceTextureClientOGL::MacIOSurfaceTextureClientOGL(TextureFlags aFlags)
|
||||
: TextureClient(aFlags)
|
||||
, mIsLocked(false)
|
||||
{}
|
||||
|
||||
MacIOSurfaceTextureClientOGL::~MacIOSurfaceTextureClientOGL()
|
||||
|
@ -24,6 +25,27 @@ MacIOSurfaceTextureClientOGL::InitWith(MacIOSurface* aSurface)
|
|||
mSurface = aSurface;
|
||||
}
|
||||
|
||||
bool
|
||||
MacIOSurfaceTextureClientOGL::Lock(OpenMode aMode)
|
||||
{
|
||||
MOZ_ASSERT(!mIsLocked);
|
||||
mIsLocked = true;
|
||||
return IsValid() && IsAllocated();
|
||||
}
|
||||
|
||||
void
|
||||
MacIOSurfaceTextureClientOGL::Unlock()
|
||||
{
|
||||
MOZ_ASSERT(mIsLocked);
|
||||
mIsLocked = false;
|
||||
}
|
||||
|
||||
bool
|
||||
MacIOSurfaceTextureClientOGL::IsLocked() const
|
||||
{
|
||||
return mIsLocked;
|
||||
}
|
||||
|
||||
bool
|
||||
MacIOSurfaceTextureClientOGL::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,12 @@ public:
|
|||
|
||||
void InitWith(MacIOSurface* aSurface);
|
||||
|
||||
virtual bool Lock(OpenMode aMode) MOZ_OVERRIDE;
|
||||
|
||||
virtual void Unlock() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsLocked() const MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsAllocated() const MOZ_OVERRIDE { return !!mSurface; }
|
||||
|
||||
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
|
||||
|
@ -32,6 +38,7 @@ public:
|
|||
|
||||
protected:
|
||||
RefPtr<MacIOSurface> mSurface;
|
||||
bool mIsLocked;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -60,6 +60,24 @@ SharedTextureClientOGL::InitWith(gl::SharedTextureHandle aHandle,
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
SharedTextureClientOGL::Lock(OpenMode mode)
|
||||
{
|
||||
MOZ_ASSERT(!mIsLocked);
|
||||
if (!IsValid() || !IsAllocated()) {
|
||||
return false;
|
||||
}
|
||||
mIsLocked = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
SharedTextureClientOGL::Unlock()
|
||||
{
|
||||
MOZ_ASSERT(mIsLocked);
|
||||
mIsLocked = false;
|
||||
}
|
||||
|
||||
bool
|
||||
SharedTextureClientOGL::IsAllocated() const
|
||||
{
|
||||
|
@ -69,6 +87,7 @@ SharedTextureClientOGL::IsAllocated() const
|
|||
StreamTextureClientOGL::StreamTextureClientOGL(TextureFlags aFlags)
|
||||
: TextureClient(aFlags)
|
||||
, mStream(0)
|
||||
, mIsLocked(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -77,6 +96,24 @@ StreamTextureClientOGL::~StreamTextureClientOGL()
|
|||
// the data is owned externally.
|
||||
}
|
||||
|
||||
bool
|
||||
StreamTextureClientOGL::Lock(OpenMode mode)
|
||||
{
|
||||
MOZ_ASSERT(!mIsLocked);
|
||||
if (!IsValid() || !IsAllocated()) {
|
||||
return false;
|
||||
}
|
||||
mIsLocked = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
StreamTextureClientOGL::Unlock()
|
||||
{
|
||||
MOZ_ASSERT(mIsLocked);
|
||||
mIsLocked = false;
|
||||
}
|
||||
|
||||
bool
|
||||
StreamTextureClientOGL::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
|
||||
{
|
||||
|
|
|
@ -40,6 +40,12 @@ public:
|
|||
|
||||
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool Lock(OpenMode mode) MOZ_OVERRIDE;
|
||||
|
||||
virtual void Unlock() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsLocked() const MOZ_OVERRIDE { return mIsLocked; }
|
||||
|
||||
void InitWith(gl::SharedTextureHandle aHandle,
|
||||
gfx::IntSize aSize,
|
||||
gl::SharedTextureShareType aShareType,
|
||||
|
@ -61,6 +67,7 @@ protected:
|
|||
gfx::IntSize mSize;
|
||||
gl::SharedTextureShareType mShareType;
|
||||
bool mInverted;
|
||||
bool mIsLocked;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -75,6 +82,12 @@ public:
|
|||
|
||||
virtual bool IsAllocated() const MOZ_OVERRIDE;
|
||||
|
||||
virtual bool Lock(OpenMode mode) MOZ_OVERRIDE;
|
||||
|
||||
virtual void Unlock() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsLocked() const MOZ_OVERRIDE { return mIsLocked; }
|
||||
|
||||
virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
|
||||
|
||||
virtual TextureClientData* DropTextureData() MOZ_OVERRIDE { return nullptr; }
|
||||
|
@ -85,6 +98,7 @@ public:
|
|||
|
||||
protected:
|
||||
gfx::SurfaceStream* mStream;
|
||||
bool mIsLocked;
|
||||
};
|
||||
|
||||
class DeprecatedTextureClientSharedOGL : public DeprecatedTextureClient
|
||||
|
|
Загрузка…
Ссылка в новой задаче