Bug 1711061 - Part 5. Expose an ImageProviderId for tracking surface ownership. r=tnikkel

This will be used by layers as a replacement for ImageContainer's
ContainerProducerID for tracking if the same imgIRequest/imgIContainer
own the cached WebRenderImageProvider.

Differential Revision: https://phabricator.services.mozilla.com/D126598
This commit is contained in:
Andrew Osmond 2021-10-27 01:24:33 +00:00
Родитель 546e3f7640
Коммит dfee884d74
7 изменённых файлов: 53 добавлений и 0 удалений

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

@ -128,6 +128,12 @@ DynamicImage::GetProducerId(uint32_t* aId) {
return NS_OK;
}
NS_IMETHODIMP
DynamicImage::GetProviderId(uint32_t* aId) {
*aId = 0;
return NS_OK;
}
NS_IMETHODIMP
DynamicImage::GetAnimated(bool* aAnimated) {
*aAnimated = false;

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

@ -145,6 +145,11 @@ ImageWrapper::GetProducerId(uint32_t* aId) {
return mInnerImage->GetProducerId(aId);
}
NS_IMETHODIMP
ImageWrapper::GetProviderId(uint32_t* aId) {
return mInnerImage->GetProviderId(aId);
}
NS_IMETHODIMP
ImageWrapper::GetAnimated(bool* aAnimated) {
return mInnerImage->GetAnimated(aAnimated);

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

@ -280,6 +280,14 @@ RasterImage::GetProducerId(uint32_t* aId) {
return NS_OK;
}
NS_IMETHODIMP
RasterImage::GetProviderId(uint32_t* aId) {
NS_ENSURE_ARG_POINTER(aId);
*aId = ImageResource::GetImageProviderId();
return NS_OK;
}
LookupResult RasterImage::LookupFrameInternal(const OrientedIntSize& aSize,
uint32_t aFlags,
PlaybackType aPlaybackType,

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

@ -627,6 +627,15 @@ VectorImage::GetProducerId(uint32_t* aId) {
return NS_OK;
}
//******************************************************************************
NS_IMETHODIMP
VectorImage::GetProviderId(uint32_t* aId) {
NS_ENSURE_ARG_POINTER(aId);
*aId = ImageResource::GetImageProviderId();
return NS_OK;
}
//******************************************************************************
NS_IMETHODIMP
VectorImage::GetAnimated(bool* aAnimated) {

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

@ -174,6 +174,11 @@ interface imgIContainer : nsISupports
*/
[infallible] readonly attribute unsigned long producerId;
/**
* Provider ID for image providers created by this image.
*/
[infallible] readonly attribute unsigned long providerId;
/**
* Flags for imgIContainer operations.
*

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

@ -35,6 +35,11 @@ interface imgIRequest : nsIRequest
*/
[infallible] readonly attribute unsigned long producerId;
/**
* Provider ID for image providers created by this image.
*/
[infallible] readonly attribute unsigned long providerId;
/**
* Bits set in the return value from imageStatus
* @name statusflags

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

@ -681,6 +681,21 @@ imgRequestProxy::GetProducerId(uint32_t* aId) {
return NS_OK;
}
NS_IMETHODIMP
imgRequestProxy::GetProviderId(uint32_t* aId) {
NS_ENSURE_TRUE(aId, NS_ERROR_NULL_POINTER);
nsCOMPtr<imgIContainer> image;
nsresult rv = GetImage(getter_AddRefs(image));
if (NS_SUCCEEDED(rv)) {
*aId = image->GetProviderId();
} else {
*aId = 0;
}
return NS_OK;
}
NS_IMETHODIMP
imgRequestProxy::GetImageStatus(uint32_t* aStatus) {
if (IsValidating()) {