Bug 721627. Don't return nsRefPtr/nsCOMPtr from nsDisplayImage methods. nsDisplayImage::GetImage is unused anyway. r=mats

This commit is contained in:
Robert O'Callahan 2012-01-30 18:16:54 +13:00
Родитель ca3b4151d6
Коммит 3605115590
4 изменённых файлов: 10 добавлений и 15 удалений

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

@ -953,6 +953,7 @@ RasterImage::GetImageContainer(LayerManager* aManager,
(!mImageContainer->Manager() && (!mImageContainer->Manager() &&
(mImageContainer->GetBackendType() == aManager->GetBackendType())))) { (mImageContainer->GetBackendType() == aManager->GetBackendType())))) {
*_retval = mImageContainer; *_retval = mImageContainer;
NS_ADDREF(*_retval);
return NS_OK; return NS_OK;
} }
@ -978,6 +979,7 @@ RasterImage::GetImageContainer(LayerManager* aManager,
mImageContainer->SetCurrentImage(image); mImageContainer->SetCurrentImage(image);
*_retval = mImageContainer; *_retval = mImageContainer;
NS_ADDREF(*_retval);
return NS_OK; return NS_OK;
} }

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

@ -219,7 +219,7 @@ protected:
* supports being optimized to an ImageLayer (TYPE_RASTER only) returns * supports being optimized to an ImageLayer (TYPE_RASTER only) returns
* an ImageContainer for the image. * an ImageContainer for the image.
*/ */
nsRefPtr<ImageContainer> CanOptimizeImageLayer(LayerManager* aManager); already_AddRefed<ImageContainer> CanOptimizeImageLayer(LayerManager* aManager);
/** /**
* The region of visible content in the layer, relative to the * The region of visible content in the layer, relative to the
@ -968,7 +968,7 @@ ContainerState::FindOpaqueBackgroundColorFor(PRInt32 aThebesLayerIndex)
return NS_RGBA(0,0,0,0); return NS_RGBA(0,0,0,0);
} }
nsRefPtr<ImageContainer> already_AddRefed<ImageContainer>
ContainerState::ThebesLayerData::CanOptimizeImageLayer(LayerManager* aManager) ContainerState::ThebesLayerData::CanOptimizeImageLayer(LayerManager* aManager)
{ {
if (!mImage || !mImageClip.mRoundedClipRects.IsEmpty()) { if (!mImage || !mImageClip.mRoundedClipRects.IsEmpty()) {

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

@ -1210,19 +1210,13 @@ nsDisplayImage::Paint(nsDisplayListBuilder* aBuilder,
: (PRUint32) imgIContainer::FLAG_NONE); : (PRUint32) imgIContainer::FLAG_NONE);
} }
nsCOMPtr<imgIContainer> already_AddRefed<ImageContainer>
nsDisplayImage::GetImage()
{
return mImage;
}
nsRefPtr<ImageContainer>
nsDisplayImage::GetContainer(LayerManager* aManager) nsDisplayImage::GetContainer(LayerManager* aManager)
{ {
ImageContainer* container; nsRefPtr<ImageContainer> container;
nsresult rv = mImage->GetImageContainer(aManager, &container); nsresult rv = mImage->GetImageContainer(aManager, getter_AddRefs(container));
NS_ENSURE_SUCCESS(rv, NULL); NS_ENSURE_SUCCESS(rv, nsnull);
return container; return container.forget();
} }
void void

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

@ -386,13 +386,12 @@ public:
} }
virtual void Paint(nsDisplayListBuilder* aBuilder, virtual void Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx); nsRenderingContext* aCtx);
nsCOMPtr<imgIContainer> GetImage();
/** /**
* Returns an ImageContainer for this image if the image type * Returns an ImageContainer for this image if the image type
* supports it (TYPE_RASTER only). * supports it (TYPE_RASTER only).
*/ */
nsRefPtr<ImageContainer> GetContainer(LayerManager* aManager); already_AddRefed<ImageContainer> GetContainer(LayerManager* aManager);
/** /**
* Configure an ImageLayer for this display item. * Configure an ImageLayer for this display item.