Skip to content

Commit

Permalink
Bug 855221 - Don't flush from imgFrame::ImageUpdated(), which can be …
Browse files Browse the repository at this point in the history
…called from the decoder thread. r=jrmuizel
  • Loading branch information
joedrew committed May 24, 2013
1 parent a53d243 commit 93437b6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions image/src/imgFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ nsresult imgFrame::Init(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight,

nsresult imgFrame::Optimize()
{
MOZ_ASSERT(NS_IsMainThread());

if (gDisableOptimize)
return NS_OK;

Expand Down Expand Up @@ -486,6 +488,7 @@ void imgFrame::Draw(gfxContext *aContext, gfxPattern::GraphicsFilter aFilter,
}
}

// This can be called from any thread, but not simultaneously.
nsresult imgFrame::ImageUpdated(const nsIntRect &aUpdateRect)
{
mDecoded.UnionRect(mDecoded, aUpdateRect);
Expand All @@ -495,10 +498,6 @@ nsresult imgFrame::ImageUpdated(const nsIntRect &aUpdateRect)
nsIntRect boundsRect(mOffset, mSize);
mDecoded.IntersectRect(mDecoded, boundsRect);

#ifdef XP_MACOSX
if (mQuartzSurface)
mQuartzSurface->Flush();
#endif
return NS_OK;
}

Expand Down Expand Up @@ -575,6 +574,8 @@ void imgFrame::GetPaletteData(uint32_t **aPalette, uint32_t *length) const

nsresult imgFrame::LockImageData()
{
MOZ_ASSERT(NS_IsMainThread());

NS_ABORT_IF_FALSE(mLockCount >= 0, "Unbalanced locks and unlocks");
if (mLockCount < 0) {
return NS_ERROR_FAILURE;
Expand Down Expand Up @@ -630,6 +631,8 @@ nsresult imgFrame::LockImageData()

nsresult imgFrame::UnlockImageData()
{
MOZ_ASSERT(NS_IsMainThread());

NS_ABORT_IF_FALSE(mLockCount != 0, "Unlocking an unlocked image!");
if (mLockCount == 0) {
return NS_ERROR_FAILURE;
Expand Down Expand Up @@ -672,6 +675,8 @@ nsresult imgFrame::UnlockImageData()

void imgFrame::MarkImageDataDirty()
{
MOZ_ASSERT(NS_IsMainThread());

if (mImageSurface)
mImageSurface->Flush();

Expand Down

0 comments on commit 93437b6

Please sign in to comment.