mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1118694 - Always retarget OnDataAvailable for RasterImage. r=sworkman
This commit is contained in:
parent
52b1d77d11
commit
766fe0f845
@ -77,28 +77,6 @@ ComputeImageFlags(ImageURL* uri, bool isMultiPart)
|
||||
return imageFlags;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
ImageFactory::CanRetargetOnDataAvailable(ImageURL* aURI, bool aIsMultiPart)
|
||||
{
|
||||
// We can't retarget OnDataAvailable safely in cases where we aren't storing
|
||||
// source data (and thus need to sync decode in ODA) because allocating frames
|
||||
// off-main-thread is currently not possible and we don't have a workaround in
|
||||
// place yet. (See bug 967985.) For now, we detect those cases and refuse to
|
||||
// retarget. When the problem is fixed, this function can be removed.
|
||||
|
||||
if (aIsMultiPart) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t imageFlags = ComputeImageFlags(aURI, aIsMultiPart);
|
||||
if (!(imageFlags & Image::INIT_FLAG_DISCARDABLE) &&
|
||||
!(imageFlags & Image::INIT_FLAG_DECODE_ON_DRAW)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<Image>
|
||||
ImageFactory::CreateImage(nsIRequest* aRequest,
|
||||
ProgressTracker* aProgressTracker,
|
||||
|
@ -28,14 +28,6 @@ public:
|
||||
*/
|
||||
static void Initialize();
|
||||
|
||||
/**
|
||||
* Determines whether it's safe to retarget OnDataAvailable for an image.
|
||||
*
|
||||
* @param aURI The URI of the image.
|
||||
* @param aIsMultipart Whether the image is part of a multipart request.
|
||||
*/
|
||||
static bool CanRetargetOnDataAvailable(ImageURL* aURI, bool aIsMultiPart);
|
||||
|
||||
/**
|
||||
* Creates a new image with the given properties.
|
||||
* Can be called on or off the main thread.
|
||||
|
@ -1178,12 +1178,6 @@ RasterImage::OnImageDataAvailable(nsIRequest*,
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<nsIEventTarget>
|
||||
RasterImage::GetEventTarget()
|
||||
{
|
||||
return DecodePool::Singleton()->GetEventTarget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
RasterImage::SetSourceSizeHint(uint32_t aSizeHint)
|
||||
{
|
||||
|
@ -242,8 +242,6 @@ public:
|
||||
nsresult aStatus,
|
||||
bool aLastPart) MOZ_OVERRIDE;
|
||||
|
||||
static already_AddRefed<nsIEventTarget> GetEventTarget();
|
||||
|
||||
/**
|
||||
* A hint of the number of bytes of source data that the image contains. If
|
||||
* called early on, this can help reduce copying and reallocations by
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "imgLoader.h"
|
||||
#include "imgRequestProxy.h"
|
||||
#include "DecodePool.h"
|
||||
#include "ProgressTracker.h"
|
||||
#include "ImageFactory.h"
|
||||
#include "Image.h"
|
||||
@ -694,14 +695,14 @@ NS_IMETHODIMP imgRequest::OnStartRequest(nsIRequest *aRequest, nsISupports *ctxt
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aRequest);
|
||||
nsCOMPtr<nsIThreadRetargetableRequest> retargetable =
|
||||
do_QueryInterface(aRequest);
|
||||
if (httpChannel && retargetable &&
|
||||
ImageFactory::CanRetargetOnDataAvailable(mURI, mIsMultiPartChannel)) {
|
||||
if (httpChannel && retargetable) {
|
||||
nsAutoCString mimeType;
|
||||
nsresult rv = httpChannel->GetContentType(mimeType);
|
||||
if (NS_SUCCEEDED(rv) && !mimeType.EqualsLiteral(IMAGE_SVG_XML)) {
|
||||
// Image object not created until OnDataAvailable, so forward to static
|
||||
// DecodePool directly.
|
||||
nsCOMPtr<nsIEventTarget> target = RasterImage::GetEventTarget();
|
||||
nsCOMPtr<nsIEventTarget> target =
|
||||
DecodePool::Singleton()->GetEventTarget();
|
||||
rv = retargetable->RetargetDeliveryTo(target);
|
||||
}
|
||||
PR_LOG(GetImgLog(), PR_LOG_WARNING,
|
||||
|
Loading…
Reference in New Issue
Block a user