Backed out changeset 7f13c7a84acb (bug 1343341) for hitting a fatal assert that it added in RasterImage::OnSurfaceDiscard sometimes on android reftests.

This commit is contained in:
Timothy Nikkel 2017-03-02 02:24:29 -06:00
Родитель bf1fbf9630
Коммит d58225c24c
3 изменённых файлов: 3 добавлений и 120 удалений

Просмотреть файл

@ -28,25 +28,9 @@ namespace image {
void
AnimationState::NotifyDecodeComplete()
{
// If we weren't discarded before the decode finished then mark ourselves as
// currently decoded.
if (!mDiscarded) {
mIsCurrentlyDecoded = true;
}
mHasBeenDecoded = true;
}
void
AnimationState::SetDiscarded(bool aDiscarded)
{
if (aDiscarded) {
MOZ_ASSERT(gfxPrefs::ImageMemAnimatedDiscardable());
mIsCurrentlyDecoded = false;
mCompositedFrameInvalid = true;
}
mDiscarded = aDiscarded;
}
void
AnimationState::ResetAnimation()
{
@ -281,17 +265,13 @@ FrameAnimator::AdvanceFrame(AnimationState& aState, TimeStamp aTime)
RefreshResult
FrameAnimator::RequestRefresh(AnimationState& aState, const TimeStamp& aTime)
{
// By default, an empty RefreshResult.
RefreshResult ret;
if (aState.IsDiscarded()) {
return ret;
}
// only advance the frame if the current time is greater than or
// equal to the current frame's end time.
TimeStamp currentFrameEndTime = GetCurrentImgFrameEndTime(aState);
// By default, an empty RefreshResult.
RefreshResult ret;
while (currentFrameEndTime <= aTime) {
TimeStamp oldFrameEndTime = currentFrameEndTime;
@ -310,26 +290,12 @@ FrameAnimator::RequestRefresh(AnimationState& aState, const TimeStamp& aTime)
}
}
// Advanced to the correct frame, the composited frame is now valid to be drawn.
if (currentFrameEndTime > aTime) {
aState.mCompositedFrameInvalid = false;
}
MOZ_ASSERT(!aState.mIsCurrentlyDecoded || !aState.mCompositedFrameInvalid);
return ret;
}
LookupResult
FrameAnimator::GetCompositedFrame(AnimationState& aState)
{
if (aState.mCompositedFrameInvalid) {
MOZ_ASSERT(gfxPrefs::ImageMemAnimatedDiscardable());
MOZ_ASSERT(aState.GetHasBeenDecoded());
MOZ_ASSERT(!aState.GetIsCurrentlyDecoded());
return LookupResult(MatchType::NOT_FOUND);
}
// If we have a composited version of this frame, return that.
if (mLastCompositedFrameIndex >= 0 &&
(uint32_t(mLastCompositedFrameIndex) == aState.mCurrentAnimationFrameIndex)) {

Просмотреть файл

@ -33,9 +33,6 @@ public:
, mFirstFrameTimeout(FrameTimeout::FromRawMilliseconds(0))
, mAnimationMode(aAnimationMode)
, mHasBeenDecoded(false)
, mIsCurrentlyDecoded(false)
, mCompositedFrameInvalid(false)
, mDiscarded(false)
{ }
/**
@ -48,40 +45,6 @@ public:
*/
bool GetHasBeenDecoded() { return mHasBeenDecoded; }
/**
* Call this with true when this image is discarded. Call this with false
* when a decoder is created to decode the image.
*/
void SetDiscarded(bool aDiscarded);
/**
* Returns true if this image has been discarded and a decoded has not yet
* been created to redecode it.
*/
bool IsDiscarded() { return mDiscarded; }
/**
* Sets the composited frame as valid or invalid.
*/
void SetCompositedFrameInvalid(bool aInvalid) {
MOZ_ASSERT(!aInvalid || gfxPrefs::ImageMemAnimatedDiscardable());
mCompositedFrameInvalid = aInvalid;
}
/**
* Returns whether the composited frame is valid to draw to the screen.
*/
bool GetCompositedFrameInvalid() {
return mCompositedFrameInvalid;
}
/**
* Returns whether the image is currently full decoded..
*/
bool GetIsCurrentlyDecoded() {
return mIsCurrentlyDecoded;
}
/**
* Call when you need to re-start animating. Ensures we start from the first
* frame.
@ -182,44 +145,8 @@ private:
//! The animation mode of this image. Constants defined in imgIContainer.
uint16_t mAnimationMode;
/**
* The following four bools (mHasBeenDecoded, mIsCurrentlyDecoded,
* mCompositedFrameInvalid, mDiscarded) track the state of the image with
* regards to decoding. They all start out false, including mDiscarded,
* because we want to treat being discarded differently from "not yet decoded
* for the first time".
*
* (When we are decoding the image for the first time we want to show the
* image at the speed of data coming in from the network or the speed
* specified in the image file, whichever is slower. But when redecoding we
* want to show nothing until the frame for the current time has been
* decoded. The prevents the user from seeing the image "fast forward"
* to the expected spot.)
*
* When the image is decoded for the first time mHasBeenDecoded and
* mIsCurrentlyDecoded get set to true. When the image is discarded
* mIsCurrentlyDecoded gets set to false, and mCompositedFrameInvalid
* & mDiscarded get set to true. When we create a decoder to redecode the
* image mDiscarded gets set to false. mCompositedFrameInvalid gets set to
* false when we are able to advance to the frame that should be showing
* for the current time. mIsCurrentlyDecoded gets set to true when the
* redecode finishes.
*/
//! Whether this image has been decoded at least once.
bool mHasBeenDecoded;
//! Whether this image is currently fully decoded.
bool mIsCurrentlyDecoded;
//! Whether the composited frame is valid to draw to the screen, note that
//! the composited frame can exist and be filled with image data but not
//! valid to draw to the screen.
bool mCompositedFrameInvalid;
//! Whether this image is currently discarded. Only set to true after the
//! image has been decoded at least once.
bool mDiscarded;
};
/**

Просмотреть файл

@ -424,11 +424,6 @@ RasterImage::OnSurfaceDiscarded()
{
MOZ_ASSERT(mProgressTracker);
if (mAnimationState) {
MOZ_ASSERT(gfxPrefs::ImageMemAnimatedDiscardable());
mAnimationState->SetDiscarded(true);
}
NS_DispatchToMainThread(NewRunnableMethod("ProgressTracker::OnDiscard",
mProgressTracker, &ProgressTracker::OnDiscard));
}
@ -1033,10 +1028,6 @@ RasterImage::Discard()
// Delete all the decoded frames.
SurfaceCache::RemoveImage(ImageKey(this));
if (mAnimationState) {
mAnimationState->SetDiscarded(true);
}
// Notify that we discarded.
if (mProgressTracker) {
mProgressTracker->OnDiscard();
@ -1203,7 +1194,6 @@ RasterImage::Decode(const IntSize& aSize,
// Create a decoder.
RefPtr<IDecodingTask> task;
if (mAnimationState && aPlaybackType == PlaybackType::eAnimated) {
mAnimationState->SetDiscarded(false);
task = DecoderFactory::CreateAnimationDecoder(mDecoderType, WrapNotNull(this),
mSourceBuffer, mSize,
decoderFlags, surfaceFlags);