Bug 773469 - Remove unnecessary layer transactions when using async-video. r=roc

This commit is contained in:
Nicolas Silva 2012-08-10 11:42:53 -04:00
parent e2cd029b19
commit e3b4b9229b
2 changed files with 13 additions and 1 deletions

View File

@ -49,6 +49,14 @@ double VideoFrameContainer::GetFrameDelay()
void VideoFrameContainer::Invalidate()
{
NS_ASSERTION(NS_IsMainThread(), "Must call on main thread");
if (!mNeedInvalidation) {
return;
}
if (mImageContainer && mImageContainer->IsAsync()) {
mNeedInvalidation = false;
}
if (!mElement) {
// Element has been destroyed
return;

View File

@ -37,11 +37,13 @@ public:
already_AddRefed<ImageContainer> aContainer)
: mElement(aElement),
mImageContainer(aContainer), mMutex("nsVideoFrameContainer"),
mIntrinsicSizeChanged(false), mImageSizeChanged(false)
mIntrinsicSizeChanged(false), mImageSizeChanged(false),
mNeedInvalidation(true)
{
NS_ASSERTION(aElement, "aElement must not be null");
NS_ASSERTION(mImageContainer, "aContainer must not be null");
}
// Call on any thread
void SetCurrentFrame(const gfxIntSize& aIntrinsicSize, Image* aImage,
TimeStamp aTargetTime);
@ -86,6 +88,8 @@ protected:
// frame is fully invalidated instead of just invalidating for the image change
// in the ImageLayer.
bool mImageSizeChanged;
bool mNeedInvalidation;
};
}