Bug 1098108 (Part 3) - Record REQUEST* notifications for imgTools decodes. r=tn

This commit is contained in:
Seth Fowler 2014-11-14 20:10:48 -08:00
Родитель 007c489ec2
Коммит 06b4ef5f00
1 изменённых файлов: 5 добавлений и 2 удалений

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

@ -60,13 +60,13 @@ NS_IMETHODIMP imgTools::DecodeImage(nsIInputStream* aInStr,
imgIContainer **aContainer)
{
nsresult rv;
nsRefPtr<image::Image> image;
NS_ENSURE_ARG_POINTER(aInStr);
// Create a new image container to hold the decoded data.
nsAutoCString mimeType(aMimeType);
image = ImageFactory::CreateAnonymousImage(mimeType);
nsRefPtr<image::Image> image = ImageFactory::CreateAnonymousImage(mimeType);
nsRefPtr<ProgressTracker> tracker = image->GetProgressTracker();
if (image->HasError())
return NS_ERROR_FAILURE;
@ -87,10 +87,13 @@ NS_IMETHODIMP imgTools::DecodeImage(nsIInputStream* aInStr,
NS_ENSURE_TRUE(length <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
// Send the source data to the Image.
tracker->SyncNotifyProgress(FLAG_REQUEST_STARTED);
rv = image->OnImageDataAvailable(nullptr, nullptr, inStream, 0, uint32_t(length));
NS_ENSURE_SUCCESS(rv, rv);
// Let the Image know we've sent all the data.
rv = image->OnImageDataComplete(nullptr, nullptr, NS_OK, true);
tracker->SyncNotifyProgress(FLAG_REQUEST_STOPPED);
NS_ENSURE_SUCCESS(rv, rv);
// All done.