Bug 1256603. Make aMarkUsed parameters required everywhere. r=aosmond

This commit is contained in:
Timothy Nikkel 2018-10-13 00:31:03 -05:00
Родитель df61b9e8ff
Коммит 6a62719550
7 изменённых файлов: 32 добавлений и 22 удалений

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

@ -333,7 +333,7 @@ LookupResult
RasterImage::LookupFrame(const IntSize& aSize,
uint32_t aFlags,
PlaybackType aPlaybackType,
bool aMarkUsed /* = true */)
bool aMarkUsed)
{
MOZ_ASSERT(NS_IsMainThread());
@ -609,7 +609,7 @@ RasterImage::GetFrameInternal(const IntSize& aSize,
// not waiting for the data to be loaded from the network or not passing
// FLAG_SYNC_DECODE.
LookupResult result =
LookupFrame(aSize, aFlags, ToPlaybackType(aWhichFrame));
LookupFrame(aSize, aFlags, ToPlaybackType(aWhichFrame), /* aMarkUsed = */ true);
// The surface cache may have suggested we use a different size than the
// given size in the future. This may or may not be accompanied by an
@ -1523,7 +1523,7 @@ RasterImage::Draw(gfxContext* aContext,
: aFlags & ~FLAG_HIGH_QUALITY_SCALING;
LookupResult result =
LookupFrame(aSize, flags, ToPlaybackType(aWhichFrame));
LookupFrame(aSize, flags, ToPlaybackType(aWhichFrame), /* aMarkUsed = */ true);
if (!result) {
// Getting the frame (above) touches the image and kicks off decoding.
if (mDrawStartTime.IsNull()) {

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

@ -293,7 +293,7 @@ private:
LookupResult LookupFrame(const gfx::IntSize& aSize,
uint32_t aFlags,
PlaybackType aPlaybackType,
bool aMarkUsed = true);
bool aMarkUsed);
/// Helper method for LookupFrame().
LookupResult LookupFrameInternal(const gfx::IntSize& aSize,

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

@ -960,7 +960,7 @@ public:
LookupResult Lookup(const ImageKey aImageKey,
const SurfaceKey& aSurfaceKey,
const StaticMutexAutoLock& aAutoLock,
bool aMarkUsed = true)
bool aMarkUsed)
{
RefPtr<ImageSurfaceCache> cache = GetImageCache(aImageKey);
if (!cache) {
@ -1000,7 +1000,7 @@ public:
LookupResult LookupBestMatch(const ImageKey aImageKey,
const SurfaceKey& aSurfaceKey,
const StaticMutexAutoLock& aAutoLock,
bool aMarkUsed /* = true */)
bool aMarkUsed)
{
RefPtr<ImageSurfaceCache> cache = GetImageCache(aImageKey);
if (!cache) {
@ -1519,7 +1519,7 @@ SurfaceCache::Shutdown()
/* static */ LookupResult
SurfaceCache::Lookup(const ImageKey aImageKey,
const SurfaceKey& aSurfaceKey,
bool aMarkUsed /* = true */)
bool aMarkUsed)
{
nsTArray<RefPtr<CachedSurface>> discard;
LookupResult rv(MatchType::NOT_FOUND);
@ -1540,7 +1540,7 @@ SurfaceCache::Lookup(const ImageKey aImageKey,
/* static */ LookupResult
SurfaceCache::LookupBestMatch(const ImageKey aImageKey,
const SurfaceKey& aSurfaceKey,
bool aMarkUsed /* = true */)
bool aMarkUsed)
{
nsTArray<RefPtr<CachedSurface>> discard;
LookupResult rv(MatchType::NOT_FOUND);

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

@ -233,7 +233,7 @@ struct SurfaceCache
*/
static LookupResult Lookup(const ImageKey aImageKey,
const SurfaceKey& aSurfaceKey,
bool aMarkUsed = true);
bool aMarkUsed);
/**
* Looks up the best matching cache entry and returns a drawable reference to
@ -253,7 +253,7 @@ struct SurfaceCache
*/
static LookupResult LookupBestMatch(const ImageKey aImageKey,
const SurfaceKey& aSurfaceKey,
bool aMarkUsed = true);
bool aMarkUsed);
/**
* Insert an ISurfaceProvider into the cache. If an entry with the same

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

@ -1131,9 +1131,9 @@ VectorImage::LookupCachedSurface(const IntSize& aSize,
LookupResult result(MatchType::NOT_FOUND);
SurfaceKey surfaceKey = VectorSurfaceKey(aSize, aSVGContext);
if ((aFlags & FLAG_SYNC_DECODE) || !(aFlags & FLAG_HIGH_QUALITY_SCALING)) {
result = SurfaceCache::Lookup(ImageKey(this), surfaceKey);
result = SurfaceCache::Lookup(ImageKey(this), surfaceKey, /* aMarkUsed = */ true);
} else {
result = SurfaceCache::LookupBestMatch(ImageKey(this), surfaceKey);
result = SurfaceCache::LookupBestMatch(ImageKey(this), surfaceKey, /* aMarkUsed = */ true);
}
IntSize rasterSize = result.SuggestedSize().IsEmpty()

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

@ -573,7 +573,8 @@ TEST_F(ImageDecoders, AnimatedGIFWithFRAME_FIRST)
SurfaceCache::Lookup(ImageKey(image.get()),
RasterSurfaceKey(imageSize,
DefaultSurfaceFlags(),
PlaybackType::eStatic));
PlaybackType::eStatic),
/* aMarkUsed = */ false);
ASSERT_EQ(MatchType::EXACT, result.Type());
EXPECT_TRUE(bool(result.Surface()));
}
@ -584,7 +585,8 @@ TEST_F(ImageDecoders, AnimatedGIFWithFRAME_FIRST)
SurfaceCache::Lookup(ImageKey(image.get()),
RasterSurfaceKey(imageSize,
DefaultSurfaceFlags(),
PlaybackType::eAnimated));
PlaybackType::eAnimated),
/* aMarkUsed = */ false);
ASSERT_EQ(MatchType::NOT_FOUND, result.Type());
}
@ -600,7 +602,8 @@ TEST_F(ImageDecoders, AnimatedGIFWithFRAME_FIRST)
SurfaceCache::Lookup(ImageKey(image.get()),
RasterSurfaceKey(imageSize,
DefaultSurfaceFlags(),
PlaybackType::eAnimated));
PlaybackType::eAnimated),
/* aMarkUsed = */ true);
ASSERT_EQ(MatchType::EXACT, result.Type());
EXPECT_TRUE(NS_SUCCEEDED(result.Surface().Seek(0)));
@ -616,7 +619,8 @@ TEST_F(ImageDecoders, AnimatedGIFWithFRAME_FIRST)
SurfaceCache::Lookup(ImageKey(image.get()),
RasterSurfaceKey(imageSize,
DefaultSurfaceFlags(),
PlaybackType::eStatic));
PlaybackType::eStatic),
/* aMarkUsed = */ true);
ASSERT_EQ(MatchType::EXACT, result.Type());
EXPECT_TRUE(bool(result.Surface()));
}
@ -686,7 +690,8 @@ TEST_F(ImageDecoders, AnimatedGIFWithFRAME_CURRENT)
SurfaceCache::Lookup(ImageKey(image.get()),
RasterSurfaceKey(imageSize,
DefaultSurfaceFlags(),
PlaybackType::eAnimated));
PlaybackType::eAnimated),
/* aMarkUsed = */ true);
ASSERT_EQ(MatchType::EXACT, result.Type());
EXPECT_TRUE(NS_SUCCEEDED(result.Surface().Seek(0)));
@ -702,7 +707,8 @@ TEST_F(ImageDecoders, AnimatedGIFWithFRAME_CURRENT)
SurfaceCache::Lookup(ImageKey(image.get()),
RasterSurfaceKey(imageSize,
DefaultSurfaceFlags(),
PlaybackType::eStatic));
PlaybackType::eStatic),
/* aMarkUsed = */ false);
ASSERT_EQ(MatchType::NOT_FOUND, result.Type());
}
@ -718,7 +724,8 @@ TEST_F(ImageDecoders, AnimatedGIFWithFRAME_CURRENT)
SurfaceCache::Lookup(ImageKey(image.get()),
RasterSurfaceKey(imageSize,
DefaultSurfaceFlags(),
PlaybackType::eStatic));
PlaybackType::eStatic),
/* aMarkUsed = */ true);
ASSERT_EQ(MatchType::EXACT, result.Type());
EXPECT_TRUE(bool(result.Surface()));
}
@ -729,7 +736,8 @@ TEST_F(ImageDecoders, AnimatedGIFWithFRAME_CURRENT)
SurfaceCache::Lookup(ImageKey(image.get()),
RasterSurfaceKey(imageSize,
DefaultSurfaceFlags(),
PlaybackType::eAnimated));
PlaybackType::eAnimated),
/* aMarkUsed = */ true);
ASSERT_EQ(MatchType::EXACT, result.Type());
EXPECT_TRUE(NS_SUCCEEDED(result.Surface().Seek(0)));
@ -798,7 +806,8 @@ TEST_F(ImageDecoders, AnimatedGIFWithExtraImageSubBlocks)
SurfaceCache::Lookup(ImageKey(image.get()),
RasterSurfaceKey(imageSize,
DefaultSurfaceFlags(),
PlaybackType::eAnimated));
PlaybackType::eAnimated),
/* aMarkUsed = */ true);
ASSERT_EQ(MatchType::EXACT, result.Type());
EXPECT_TRUE(NS_SUCCEEDED(result.Surface().Seek(0)));

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

@ -250,7 +250,8 @@ TEST_F(ImageDecoderMetadata, NoFrameDelayGIFFullDecode)
SurfaceCache::Lookup(ImageKey(image.get()),
RasterSurfaceKey(imageSize,
DefaultSurfaceFlags(),
PlaybackType::eAnimated));
PlaybackType::eAnimated),
/* aMarkUsed = */ true);
ASSERT_EQ(MatchType::EXACT, result.Type());
EXPECT_TRUE(NS_SUCCEEDED(result.Surface().Seek(0)));