Bug 991513 - Part 1: Don't lock ContentClientDoubleBuffered's texture until we need the buffers. r=nrc

This commit is contained in:
Matt Woodrow 2014-04-09 21:15:18 +12:00
parent a738282fd1
commit 6f304e526d
2 changed files with 14 additions and 14 deletions

View File

@ -499,14 +499,14 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer,
result.mRegionToDraw.Sub(neededRegion, validRegion);
if (result.mRegionToDraw.IsEmpty())
return result;
// Do not modify result.mRegionToDraw or result.mContentType after this call.
// Do not modify mBufferRect, mBufferRotation, or mDidSelfCopy,
// or call CreateBuffer before this call.
FinalizeFrame(result.mRegionToDraw);
if (result.mRegionToDraw.IsEmpty())
return result;
nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
RefPtr<DrawTarget> destDTBuffer;
RefPtr<DrawTarget> destDTBufferOnWhite;

View File

@ -156,10 +156,10 @@ ContentClientRemoteBuffer::EndPaint()
}
mOldTextures.Clear();
if (mTextureClient) {
if (mTextureClient && mTextureClient->IsLocked()) {
mTextureClient->Unlock();
}
if (mTextureClientOnWhite) {
if (mTextureClientOnWhite && mTextureClientOnWhite->IsLocked()) {
mTextureClientOnWhite->Unlock();
}
}
@ -382,15 +382,6 @@ 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;
}
@ -415,6 +406,15 @@ ContentClientDoubleBuffered::PrepareFrame()
void
ContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
{
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) {
MOZ_ASSERT(!mDidSelfCopy, "If we have to copy the world, then our buffers are different, right?");
return;