mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 505385 - Part 7: Initialize imgRequestProxy with a status tracker. r=joe
This is sort of symbolic for now, since we keep mOwner and mImage and just pull them off the tracker, but we'll soon change that. ;-)
This commit is contained in:
parent
89f6f2488d
commit
76c30997de
@ -708,7 +708,7 @@ nsresult imgLoader::CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup
|
||||
aRequest->GetURI(getter_AddRefs(uri));
|
||||
|
||||
// init adds itself to imgRequest's list of observers
|
||||
nsresult rv = proxyRequest->Init(aRequest, aLoadGroup, aRequest->mImage, uri, aObserver);
|
||||
nsresult rv = proxyRequest->Init(&aRequest->GetStatusTracker(), aLoadGroup, uri, aObserver);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(proxyRequest);
|
||||
return rv;
|
||||
|
@ -88,16 +88,18 @@ imgRequestProxy::~imgRequestProxy()
|
||||
}
|
||||
}
|
||||
|
||||
nsresult imgRequestProxy::Init(imgRequest* request, nsILoadGroup* aLoadGroup, Image* aImage,
|
||||
nsresult imgRequestProxy::Init(imgStatusTracker* aStatusTracker,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
nsIURI* aURI, imgIDecoderObserver* aObserver)
|
||||
{
|
||||
NS_PRECONDITION(!mOwner && !mListener, "imgRequestProxy is already initialized");
|
||||
|
||||
LOG_SCOPE_WITH_PARAM(gImgLog, "imgRequestProxy::Init", "request", request);
|
||||
LOG_SCOPE_WITH_PARAM(gImgLog, "imgRequestProxy::Init", "request", aStatusTracker->GetRequest());
|
||||
|
||||
NS_ABORT_IF_FALSE(mAnimationConsumers == 0, "Cannot have animation before Init");
|
||||
|
||||
mOwner = request;
|
||||
mStatusTracker = aStatusTracker;
|
||||
mOwner = aStatusTracker->GetRequest();
|
||||
mListener = aObserver;
|
||||
// Make sure to addref mListener before the AddProxy call below, since
|
||||
// that call might well want to release it if the imgRequest has
|
||||
@ -107,7 +109,7 @@ nsresult imgRequestProxy::Init(imgRequest* request, nsILoadGroup* aLoadGroup, Im
|
||||
NS_ADDREF(mListener);
|
||||
}
|
||||
mLoadGroup = aLoadGroup;
|
||||
mImage = aImage;
|
||||
mImage = aStatusTracker->GetImage();
|
||||
mURI = aURI;
|
||||
|
||||
// Note: AddProxy won't send all the On* notifications immediately
|
||||
@ -502,9 +504,7 @@ NS_IMETHODIMP imgRequestProxy::Clone(imgIDecoderObserver* aObserver,
|
||||
// XXXldb That's not true anymore. Stuff from imgLoader adds the
|
||||
// request to the loadgroup.
|
||||
clone->SetLoadFlags(mLoadFlags);
|
||||
nsresult rv = clone->Init(mOwner, mLoadGroup,
|
||||
mImage ? mImage : mOwner->mImage,
|
||||
mURI, aObserver);
|
||||
nsresult rv = clone->Init(mStatusTracker, mLoadGroup, mURI, aObserver);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@ -851,7 +851,7 @@ imgRequestProxy::GetStaticRequest(imgIRequest** aReturn)
|
||||
nsCOMPtr<nsIPrincipal> currentPrincipal;
|
||||
GetImagePrincipal(getter_AddRefs(currentPrincipal));
|
||||
nsRefPtr<imgRequestProxy> req = new imgRequestProxyStatic(currentPrincipal);
|
||||
req->Init(nullptr, nullptr, frame, mURI, nullptr);
|
||||
req->Init(&frame->GetStatusTracker(), nullptr, mURI, nullptr);
|
||||
|
||||
NS_ADDREF(*aReturn = req);
|
||||
|
||||
|
@ -57,8 +57,8 @@ public:
|
||||
|
||||
// Callers to Init or ChangeOwner are required to call NotifyListener after
|
||||
// (although not immediately after) doing so.
|
||||
nsresult Init(imgRequest *request, nsILoadGroup *aLoadGroup,
|
||||
mozilla::image::Image* aImage,
|
||||
nsresult Init(imgStatusTracker* aStatusTracker,
|
||||
nsILoadGroup *aLoadGroup,
|
||||
nsIURI* aURI, imgIDecoderObserver *aObserver);
|
||||
|
||||
nsresult ChangeOwner(imgRequest *aNewOwner); // this will change mOwner. Do not call this if the previous
|
||||
@ -192,6 +192,9 @@ private:
|
||||
// means that imgRequest::mObservers will not have any stale pointers in it.
|
||||
nsRefPtr<imgRequest> mOwner;
|
||||
|
||||
// Weak pointer to the status tracker.
|
||||
imgStatusTracker* mStatusTracker;
|
||||
|
||||
// The URI of our request.
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user