Bug 1063034 - Changes RasterImage::mAnim from raw pointer to UniquePtr. r=jrmuizel

This commit is contained in:
Arnaud Sourioux 2014-09-09 09:39:00 -04:00
parent 180eb59b7f
commit 4f986852bd
2 changed files with 3 additions and 5 deletions

View File

@ -390,7 +390,6 @@ RasterImage::RasterImage(imgStatusTracker* aStatusTracker,
ImageResource(aURI), // invoke superclass's constructor
mSize(0,0),
mFrameDecodeFlags(DECODE_FLAGS_DEFAULT),
mAnim(nullptr),
mLockCount(0),
mDecodeCount(0),
mRequestedSampleSize(0),
@ -463,7 +462,6 @@ RasterImage::~RasterImage()
}
}
delete mAnim;
mAnim = nullptr;
// Total statistics
@ -1123,7 +1121,7 @@ RasterImage::EnsureAnimExists()
if (!mAnim) {
// Create the animation context
mAnim = new FrameAnimator(mFrameBlender, mAnimationMode);
mAnim = MakeUnique<FrameAnimator>(mFrameBlender, mAnimationMode);
// We don't support discarding animated images (See bug 414259).
// Lock the image and throw away the key.
@ -1646,7 +1644,6 @@ RasterImage::AddSourceData(const char *aBuffer, uint32_t aCount)
StopAnimation();
mAnimationFinished = false;
if (mAnim) {
delete mAnim;
mAnim = nullptr;
}
// If there's only one frame, this could cause flickering

View File

@ -35,6 +35,7 @@
#include "mozilla/TimeStamp.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/WeakPtr.h"
#include "mozilla/UniquePtr.h"
#ifdef DEBUG
#include "imgIContainerDebug.h"
#endif
@ -644,7 +645,7 @@ private: // data
// IMPORTANT: if you use mAnim in a method, call EnsureImageIsDecoded() first to ensure
// that the frames actually exist (they may have been discarded to save memory, or
// we maybe decoding on draw).
FrameAnimator* mAnim;
UniquePtr<FrameAnimator> mAnim;
// Discard members
uint32_t mLockCount;