diff --git a/image/src/imgFrame.cpp b/image/src/imgFrame.cpp index e0ecaf6608952..d024914e688f1 100644 --- a/image/src/imgFrame.cpp +++ b/image/src/imgFrame.cpp @@ -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; @@ -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); @@ -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; } @@ -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; @@ -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; @@ -672,6 +675,8 @@ nsresult imgFrame::UnlockImageData() void imgFrame::MarkImageDataDirty() { + MOZ_ASSERT(NS_IsMainThread()); + if (mImageSurface) mImageSurface->Flush();