forked from mirrors/gecko-dev
Bug 1356686 - Ensure that imgRequest::CheckListenerChain returns the correct value r=tnikkel
SVGs must be coded on MainThread because they need to access the LoadGroup, etc, while other images can be decoded via the decode pool. This ensures that CheckListenerChain() will return the right value for this instance. Differential Revision: https://phabricator.services.mozilla.com/D203181
This commit is contained in:
parent
066055e41e
commit
d542854faa
2 changed files with 9 additions and 8 deletions
|
|
@ -711,16 +711,17 @@ imgRequest::OnStartRequest(nsIRequest* aRequest) {
|
||||||
nsAutoCString mimeType;
|
nsAutoCString mimeType;
|
||||||
nsresult rv = channel->GetContentType(mimeType);
|
nsresult rv = channel->GetContentType(mimeType);
|
||||||
if (NS_SUCCEEDED(rv) && !mimeType.EqualsLiteral(IMAGE_SVG_XML)) {
|
if (NS_SUCCEEDED(rv) && !mimeType.EqualsLiteral(IMAGE_SVG_XML)) {
|
||||||
|
mOffMainThreadData = true;
|
||||||
// Retarget OnDataAvailable to the DecodePool's IO thread.
|
// Retarget OnDataAvailable to the DecodePool's IO thread.
|
||||||
nsCOMPtr<nsISerialEventTarget> target =
|
nsCOMPtr<nsISerialEventTarget> target =
|
||||||
DecodePool::Singleton()->GetIOEventTarget();
|
DecodePool::Singleton()->GetIOEventTarget();
|
||||||
rv = retargetable->RetargetDeliveryTo(target);
|
rv = retargetable->RetargetDeliveryTo(target);
|
||||||
|
MOZ_LOG(gImgLog, LogLevel::Warning,
|
||||||
|
("[this=%p] imgRequest::OnStartRequest -- "
|
||||||
|
"RetargetDeliveryTo rv %" PRIu32 "=%s\n",
|
||||||
|
this, static_cast<uint32_t>(rv),
|
||||||
|
NS_SUCCEEDED(rv) ? "succeeded" : "failed"));
|
||||||
}
|
}
|
||||||
MOZ_LOG(gImgLog, LogLevel::Warning,
|
|
||||||
("[this=%p] imgRequest::OnStartRequest -- "
|
|
||||||
"RetargetDeliveryTo rv %" PRIu32 "=%s\n",
|
|
||||||
this, static_cast<uint32_t>(rv),
|
|
||||||
NS_SUCCEEDED(rv) ? "succeeded" : "failed"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
@ -834,9 +835,7 @@ static nsresult sniff_mimetype_callback(nsIInputStream* in, void* closure,
|
||||||
/** nsThreadRetargetableStreamListener methods **/
|
/** nsThreadRetargetableStreamListener methods **/
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
imgRequest::CheckListenerChain() {
|
imgRequest::CheckListenerChain() {
|
||||||
// TODO Might need more checking here.
|
return mOffMainThreadData ? NS_OK : NS_ERROR_NO_INTERFACE;
|
||||||
NS_ASSERTION(NS_IsMainThread(), "Should be on the main thread!");
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
||||||
|
|
@ -283,6 +283,8 @@ class imgRequest final : public nsIThreadRetargetableStreamListener,
|
||||||
bool mIsCrossSiteNoCORSRequest;
|
bool mIsCrossSiteNoCORSRequest;
|
||||||
|
|
||||||
bool mShouldReportRenderTimeForLCP;
|
bool mShouldReportRenderTimeForLCP;
|
||||||
|
// SVGs can't be OffMainThread for example
|
||||||
|
bool mOffMainThreadData = false;
|
||||||
|
|
||||||
mutable mozilla::Mutex mMutex;
|
mutable mozilla::Mutex mMutex;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue