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
parent 9b8908c88e
commit 480d81cc52
9 changed files with 40 additions and 0 deletions

View File

@ -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)
{

View File

@ -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;

View File

@ -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)
{

View File

@ -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

View File

@ -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)

View File

@ -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;

View File

@ -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)

View File

@ -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,

View File

@ -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;
%}
};