Bug 1370412 - Part 0. Add imgIContainer::GetNativeSizesLength to determine a ceiling on the maximum number of expected, unique surfaces. r=tnikkel

This commit is contained in:
Andrew Osmond 2017-09-05 07:58:44 -04:00
Родитель 9b8908c88e
Коммит 480d81cc52
9 изменённых файлов: 40 добавлений и 0 удалений

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

@ -134,6 +134,12 @@ DynamicImage::GetNativeSizes(nsTArray<IntSize>& aNativeSizes) const
return NS_ERROR_NOT_IMPLEMENTED;
}
size_t
DynamicImage::GetNativeSizesLength() const
{
return 0;
}
NS_IMETHODIMP
DynamicImage::GetIntrinsicSize(nsSize* aSize)
{

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

@ -32,6 +32,7 @@ public:
// Inherited methods from Image.
nsresult GetNativeSizes(nsTArray<gfx::IntSize>& aNativeSizes) const override;
size_t GetNativeSizesLength() const override;
virtual already_AddRefed<ProgressTracker> GetProgressTracker() override;
virtual size_t SizeOfSourceWithComputedFallback(
SizeOfState& aState) const override;

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

@ -145,6 +145,12 @@ ImageWrapper::GetNativeSizes(nsTArray<IntSize>& aNativeSizes) const
return mInnerImage->GetNativeSizes(aNativeSizes);
}
size_t
ImageWrapper::GetNativeSizesLength() const
{
return mInnerImage->GetNativeSizesLength();
}
NS_IMETHODIMP
ImageWrapper::GetIntrinsicSize(nsSize* aSize)
{

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

@ -23,6 +23,7 @@ public:
// Inherited methods from Image.
nsresult GetNativeSizes(nsTArray<gfx::IntSize>& aNativeSizes) const override;
size_t GetNativeSizesLength() const override;
virtual already_AddRefed<ProgressTracker> GetProgressTracker() override;
virtual size_t

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

@ -241,6 +241,21 @@ RasterImage::GetNativeSizes(nsTArray<IntSize>& aNativeSizes) const
return NS_OK;
}
//******************************************************************************
size_t
RasterImage::GetNativeSizesLength() const
{
if (mError || !mHasSize) {
return 0;
}
if (mNativeSizes.IsEmpty()) {
return 1;
}
return mNativeSizes.Length();
}
//******************************************************************************
NS_IMETHODIMP
RasterImage::GetIntrinsicSize(nsSize* aSize)

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

@ -161,6 +161,7 @@ public:
#endif
nsresult GetNativeSizes(nsTArray<gfx::IntSize>& aNativeSizes) const override;
size_t GetNativeSizesLength() const override;
virtual nsresult StartAnimation() override;
virtual nsresult StopAnimation() override;

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

@ -528,6 +528,13 @@ VectorImage::GetNativeSizes(nsTArray<IntSize>& aNativeSizes) const
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
size_t
VectorImage::GetNativeSizesLength() const
{
return 0;
}
//******************************************************************************
NS_IMETHODIMP_(void)
VectorImage::RequestRefresh(const TimeStamp& aTime)

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

@ -35,6 +35,7 @@ public:
// Methods inherited from Image
nsresult GetNativeSizes(nsTArray<gfx::IntSize>& aNativeSizes) const override;
size_t GetNativeSizesLength() const override;
virtual size_t SizeOfSourceWithComputedFallback(SizeOfState& aState)
const override;
virtual void CollectSizeOfSurfaces(nsTArray<SurfaceMemoryCounter>& aCounters,

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

@ -565,5 +565,7 @@ interface imgIContainer : nsISupports
* Get the set of sizes the image can decode to natively.
*/
virtual nsresult GetNativeSizes(nsTArray<nsIntSize>& aNativeSizes) const = 0;
virtual size_t GetNativeSizesLength() const = 0;
%}
};