mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 15:58:39 +09:00
Issue #2073 - m-c 1383404: make SourceBuffer::Compact more efficient (squashed)
The first part also means that Compact no longer needs the SurfaceCache lock (used to be via CreateChunk->CanHold), which avoids potential deadlocks during shutdown that m-c 523950 would otherwise cause
This commit is contained in:
parent
e96122ede2
commit
03a4a17ccf
6 changed files with 80 additions and 54 deletions
|
|
@ -67,15 +67,6 @@ imgTools::DecodeImage(nsIInputStream* aInStr,
|
|||
|
||||
NS_ENSURE_ARG_POINTER(aInStr);
|
||||
|
||||
// Create a new image container to hold the decoded data.
|
||||
nsAutoCString mimeType(aMimeType);
|
||||
RefPtr<image::Image> image = ImageFactory::CreateAnonymousImage(mimeType);
|
||||
RefPtr<ProgressTracker> tracker = image->GetProgressTracker();
|
||||
|
||||
if (image->HasError()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Prepare the input stream.
|
||||
nsCOMPtr<nsIInputStream> inStream = aInStr;
|
||||
if (!NS_InputStreamIsBuffered(aInStr)) {
|
||||
|
|
@ -92,6 +83,16 @@ imgTools::DecodeImage(nsIInputStream* aInStr,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(length <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
|
||||
|
||||
// Create a new image container to hold the decoded data.
|
||||
nsAutoCString mimeType(aMimeType);
|
||||
RefPtr<image::Image> image =
|
||||
ImageFactory::CreateAnonymousImage(mimeType, uint32_t(length));
|
||||
RefPtr<ProgressTracker> tracker = image->GetProgressTracker();
|
||||
|
||||
if (image->HasError()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Send the source data to the Image.
|
||||
rv = image->OnImageDataAvailable(nullptr, nullptr, inStream, 0,
|
||||
uint32_t(length));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue