Bug 1215763 - part 2 - s/nsAutoPtr/UniquePtr/ in image/; r=seth

These conversions should be straightforward, but we have to add a .get
for nsExpirationTracker::Iterator.
This commit is contained in:
Nathan Froyd 2015-10-17 06:53:28 -04:00
parent ed0f5e4822
commit 0e77a32c87
6 changed files with 12 additions and 11 deletions

View File

@ -296,9 +296,9 @@ ClippedImage::GetFrameInternal(const nsIntSize& aSize,
// Cache the resulting surface.
mCachedSurface =
new ClippedImageCachedSurface(target->Snapshot(), aSize, aSVGContext,
frameToDraw, aFlags,
drawTileCallback->GetDrawResult());
MakeUnique<ClippedImageCachedSurface>(target->Snapshot(), aSize, aSVGContext,
frameToDraw, aFlags,
drawTileCallback->GetDrawResult());
}
MOZ_ASSERT(mCachedSurface, "Should have a cached surface now");

View File

@ -10,6 +10,7 @@
#include "mozilla/gfx/2D.h"
#include "mozilla/Maybe.h"
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
namespace mozilla {
namespace image {
@ -83,7 +84,7 @@ private:
uint32_t aFlags);
// If we are forced to draw a temporary surface, we cache it here.
nsAutoPtr<ClippedImageCachedSurface> mCachedSurface;
UniquePtr<ClippedImageCachedSurface> mCachedSurface;
nsIntRect mClip; // The region to clip to.
Maybe<bool> mShouldClip; // Memoized ShouldClip() if present.

View File

@ -1190,7 +1190,7 @@ imgLoader::VerifyCacheSizes()
uint32_t queuesize =
mCacheQueue.GetNumElements() + mChromeCacheQueue.GetNumElements();
uint32_t trackersize = 0;
for (nsExpirationTracker<imgCacheEntry, 3>::Iterator it(mCacheTracker);
for (nsExpirationTracker<imgCacheEntry, 3>::Iterator it(mCacheTracker.get());
it.Next(); ){
trackersize++;
}
@ -1253,7 +1253,7 @@ imgLoader::InitCache()
os->AddObserver(this, "profile-before-change", false);
os->AddObserver(this, "xpcom-shutdown", false);
mCacheTracker = new imgCacheExpirationTracker();
mCacheTracker = MakeUnique<imgCacheExpirationTracker>();
return NS_OK;
}

View File

@ -9,6 +9,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/Mutex.h"
#include "mozilla/UniquePtr.h"
#include "imgILoader.h"
#include "imgICache.h"
@ -16,7 +17,6 @@
#include "nsIContentSniffer.h"
#include "nsRefPtrHashtable.h"
#include "nsExpirationTracker.h"
#include "nsAutoPtr.h"
#include "ImageCacheKey.h"
#include "imgRequest.h"
#include "nsIProgressEventSink.h"
@ -440,7 +440,7 @@ private: // data
nsCString mAcceptHeader;
nsAutoPtr<imgCacheExpirationTracker> mCacheTracker;
mozilla::UniquePtr<imgCacheExpirationTracker> mCacheTracker;
bool mRespectPrivacy;
};

View File

@ -1090,7 +1090,7 @@ imgRequestProxyStatic::imgRequestProxyStatic(mozilla::image::Image* aImage,
nsIPrincipal* aPrincipal)
: mPrincipal(aPrincipal)
{
mBehaviour = new StaticBehaviour(aImage);
mBehaviour = mozilla::MakeUnique<StaticBehaviour>(aImage);
}
NS_IMETHODIMP

View File

@ -14,9 +14,9 @@
#include "nsISupportsPriority.h"
#include "nsITimedChannel.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsThreadUtils.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/gfx/Rect.h"
#include "imgRequest.h"
@ -191,7 +191,7 @@ public:
NS_FORWARD_SAFE_NSITIMEDCHANNEL(TimedChannel())
protected:
nsAutoPtr<ProxyBehaviour> mBehaviour;
mozilla::UniquePtr<ProxyBehaviour> mBehaviour;
private:
friend class imgCacheValidator;