Backed out changeset 56fe4c3c3b04 (bug 1409871)

This commit is contained in:
Sebastian Hengst
2017-10-23 23:42:34 +02:00
parent bb46083256
commit 37096c3eab
2 changed files with 30 additions and 11 deletions

View File

@@ -114,6 +114,10 @@ ContentClient::PaintState
ContentClient::BeginPaint(PaintedLayer* aLayer,
uint32_t aFlags)
{
if (aFlags & PAINT_ASYNC) {
mInAsyncPaint = true;
}
PaintState result;
BufferDecision dest = CalculateBufferForPaint(aLayer, aFlags);
@@ -145,11 +149,8 @@ ContentClient::BeginPaint(PaintedLayer* aLayer,
if (result.mRegionToDraw.IsEmpty())
return result;
OpenMode lockMode = aFlags & PAINT_ASYNC ? OpenMode::OPEN_READ_ASYNC_WRITE
: OpenMode::OPEN_READ_WRITE;
if (mBuffer) {
if (mBuffer->Lock(lockMode)) {
if (mBuffer->Lock(LockMode())) {
// Do not modify result.mRegionToDraw or result.mContentType after this call.
// Do not modify the back buffer's bufferRect, bufferRotation, or didSelfCopy.
FinalizeFrame(result.mRegionToDraw);
@@ -217,12 +218,6 @@ ContentClient::BeginPaint(PaintedLayer* aLayer,
// If needed, copy the old buffer over to the new one
if (newBuffer) {
if (!newBuffer->Lock(lockMode)) {
gfxCriticalNote << "Failed to lock new back buffer.";
Clear();
return result;
}
if (mBuffer) {
newBuffer->UpdateDestinationFrom(*mBuffer, newBuffer->BufferRect());
}
@@ -478,6 +473,19 @@ ContentClient::BufferSizeOkFor(const IntSize& aSize)
aSize < mBuffer->BufferRect().Size()));
}
OpenMode
ContentClient::LockMode() const
{
return mInAsyncPaint ? OpenMode::OPEN_READ_ASYNC_WRITE
: OpenMode::OPEN_READ_WRITE;
}
void
ContentClient::EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates)
{
mInAsyncPaint = false;
}
void
ContentClient::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
@@ -672,6 +680,9 @@ ContentClientRemoteBuffer::CreateBuffer(gfxContentType aType,
return nullptr;
}
DebugOnly<bool> locked = buffer->Lock(LockMode());
MOZ_ASSERT(locked, "Could not lock the RemoteRotatedBuffer");
mIsNewBuffer = true;
mTextureFlags = textureFlags;