2010-05-14 13:47:59 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-05-14 13:47:59 -07:00
|
|
|
|
|
|
|
#include "imgStatusTracker.h"
|
|
|
|
|
|
|
|
#include "imgRequest.h"
|
|
|
|
#include "imgIContainer.h"
|
|
|
|
#include "imgRequestProxy.h"
|
2010-08-13 21:09:48 -07:00
|
|
|
#include "Image.h"
|
2010-07-28 14:52:34 -07:00
|
|
|
#include "ImageLogging.h"
|
2010-08-23 15:44:07 -07:00
|
|
|
#include "RasterImage.h"
|
2012-10-11 18:34:23 -07:00
|
|
|
#include "nsIObserverService.h"
|
2010-05-14 13:47:59 -07:00
|
|
|
|
2012-10-11 18:34:22 -07:00
|
|
|
#include "mozilla/Util.h"
|
|
|
|
#include "mozilla/Assertions.h"
|
2012-10-11 18:34:23 -07:00
|
|
|
#include "mozilla/Services.h"
|
2012-10-11 18:34:22 -07:00
|
|
|
|
2012-01-06 08:02:27 -08:00
|
|
|
using namespace mozilla::image;
|
2010-08-13 21:09:49 -07:00
|
|
|
|
2012-10-11 18:34:23 -07:00
|
|
|
NS_IMPL_ISUPPORTS3(imgStatusTrackerObserver,
|
|
|
|
imgIDecoderObserver,
|
|
|
|
imgIContainerObserver,
|
|
|
|
nsISupportsWeakReference)
|
|
|
|
|
|
|
|
/** imgIContainerObserver methods **/
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
/* [noscript] void frameChanged (in nsIntRect dirtyRect); */
|
|
|
|
NS_IMETHODIMP imgStatusTrackerObserver::FrameChanged(const nsIntRect *dirtyRect)
|
2012-10-11 18:34:23 -07:00
|
|
|
{
|
|
|
|
LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::FrameChanged");
|
|
|
|
NS_ABORT_IF_FALSE(mTracker->GetImage(),
|
|
|
|
"FrameChanged callback before we've created our image");
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
mTracker->RecordFrameChanged(dirtyRect);
|
2012-10-11 18:34:23 -07:00
|
|
|
|
2012-10-11 18:34:23 -07:00
|
|
|
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
|
2012-10-11 18:34:23 -07:00
|
|
|
while (iter.HasMore()) {
|
2012-10-11 18:34:24 -07:00
|
|
|
mTracker->SendFrameChanged(iter.GetNext(), dirtyRect);
|
2012-10-11 18:34:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** imgIDecoderObserver methods **/
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
NS_IMETHODIMP imgStatusTrackerObserver::OnStartDecode()
|
2012-10-11 18:34:23 -07:00
|
|
|
{
|
|
|
|
LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnStartDecode");
|
|
|
|
NS_ABORT_IF_FALSE(mTracker->GetImage(),
|
|
|
|
"OnStartDecode callback before we've created our image");
|
|
|
|
|
|
|
|
if (!mTracker->GetRequest()->GetMultipart()) {
|
|
|
|
MOZ_ASSERT(!mTracker->mBlockingOnload);
|
|
|
|
mTracker->mBlockingOnload = true;
|
|
|
|
|
|
|
|
mTracker->RecordBlockOnload();
|
|
|
|
|
2012-10-11 18:34:23 -07:00
|
|
|
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
|
2012-10-11 18:34:23 -07:00
|
|
|
while (iter.HasMore()) {
|
|
|
|
mTracker->SendBlockOnload(iter.GetNext());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* In the case of streaming jpegs, it is possible to get multiple OnStartDecodes which
|
|
|
|
indicates the beginning of a new decode.
|
|
|
|
The cache entry's size therefore needs to be reset to 0 here. If we do not do this,
|
|
|
|
the code in imgStatusTrackerObserver::OnStopFrame will continue to increase the data size cumulatively.
|
|
|
|
*/
|
|
|
|
mTracker->GetRequest()->ResetCacheEntry();
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
NS_IMETHODIMP imgStatusTrackerObserver::OnStartRequest()
|
2012-10-11 18:34:23 -07:00
|
|
|
{
|
|
|
|
NS_NOTREACHED("imgRequest(imgIDecoderObserver)::OnStartRequest");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
/* void onStartContainer (); */
|
|
|
|
NS_IMETHODIMP imgStatusTrackerObserver::OnStartContainer()
|
2012-10-11 18:34:23 -07:00
|
|
|
{
|
|
|
|
LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnStartContainer");
|
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(mTracker->GetImage(),
|
|
|
|
"OnStartContainer callback before we've created our image");
|
2012-10-11 18:34:24 -07:00
|
|
|
mTracker->RecordStartContainer(mTracker->GetImage());
|
2012-10-11 18:34:23 -07:00
|
|
|
|
2012-10-11 18:34:23 -07:00
|
|
|
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
|
2012-10-11 18:34:23 -07:00
|
|
|
while (iter.HasMore()) {
|
2012-10-11 18:34:24 -07:00
|
|
|
mTracker->SendStartContainer(iter.GetNext());
|
2012-10-11 18:34:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
/* [noscript] void onDataAvailable ([const] in nsIntRect rect); */
|
|
|
|
NS_IMETHODIMP imgStatusTrackerObserver::OnDataAvailable(const nsIntRect * rect)
|
2012-10-11 18:34:23 -07:00
|
|
|
{
|
|
|
|
LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnDataAvailable");
|
|
|
|
NS_ABORT_IF_FALSE(mTracker->GetImage(),
|
|
|
|
"OnDataAvailable callback before we've created our image");
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
mTracker->RecordDataAvailable();
|
2012-10-11 18:34:23 -07:00
|
|
|
|
2012-10-11 18:34:23 -07:00
|
|
|
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
|
2012-10-11 18:34:23 -07:00
|
|
|
while (iter.HasMore()) {
|
2012-10-11 18:34:24 -07:00
|
|
|
mTracker->SendDataAvailable(iter.GetNext(), rect);
|
2012-10-11 18:34:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
/* void onStopFrame (); */
|
|
|
|
NS_IMETHODIMP imgStatusTrackerObserver::OnStopFrame()
|
2012-10-11 18:34:23 -07:00
|
|
|
{
|
|
|
|
LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnStopFrame");
|
|
|
|
NS_ABORT_IF_FALSE(mTracker->GetImage(),
|
|
|
|
"OnStopFrame callback before we've created our image");
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
mTracker->RecordStopFrame();
|
2012-10-11 18:34:23 -07:00
|
|
|
|
2012-10-11 18:34:23 -07:00
|
|
|
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
|
2012-10-11 18:34:23 -07:00
|
|
|
while (iter.HasMore()) {
|
2012-10-11 18:34:24 -07:00
|
|
|
mTracker->SendStopFrame(iter.GetNext());
|
2012-10-11 18:34:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
mTracker->MaybeUnblockOnload();
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
static void
|
|
|
|
FireFailureNotification(imgRequest* aRequest)
|
|
|
|
{
|
|
|
|
// Some kind of problem has happened with image decoding.
|
|
|
|
// Report the URI to net:failed-to-process-uri-conent observers.
|
|
|
|
|
|
|
|
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
|
|
|
if (os) {
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
aRequest->GetURI(getter_AddRefs(uri));
|
|
|
|
os->NotifyObservers(uri, "net:failed-to-process-uri-content", nullptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
/* void onStopDecode (in nsresult status); */
|
|
|
|
NS_IMETHODIMP imgStatusTrackerObserver::OnStopDecode(nsresult aStatus)
|
2012-10-11 18:34:23 -07:00
|
|
|
{
|
|
|
|
LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnStopDecode");
|
|
|
|
NS_ABORT_IF_FALSE(mTracker->GetImage(),
|
2012-10-11 18:34:23 -07:00
|
|
|
"OnStopDecode callback before we've created our image");
|
2012-10-11 18:34:23 -07:00
|
|
|
|
|
|
|
// We finished the decode, and thus have the decoded frames. Update the cache
|
|
|
|
// entry size to take this into account.
|
|
|
|
mTracker->GetRequest()->UpdateCacheEntrySize();
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
bool preexistingError = mTracker->GetImageStatus() == imgIRequest::STATUS_ERROR;
|
|
|
|
|
2012-10-11 18:34:23 -07:00
|
|
|
mTracker->RecordStopDecode(aStatus);
|
2012-10-11 18:34:23 -07:00
|
|
|
|
2012-10-11 18:34:23 -07:00
|
|
|
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
|
2012-10-11 18:34:23 -07:00
|
|
|
while (iter.HasMore()) {
|
2012-10-11 18:34:23 -07:00
|
|
|
mTracker->SendStopDecode(iter.GetNext(), aStatus);
|
2012-10-11 18:34:23 -07:00
|
|
|
}
|
|
|
|
|
2012-10-11 18:34:23 -07:00
|
|
|
// This is really hacky. We need to handle the case where we start decoding,
|
|
|
|
// block onload, but then hit an error before we get to our first frame.
|
|
|
|
mTracker->MaybeUnblockOnload();
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
if (NS_FAILED(aStatus) && !preexistingError) {
|
|
|
|
FireFailureNotification(mTracker->GetRequest());
|
2012-10-11 18:34:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
NS_IMETHODIMP imgStatusTrackerObserver::OnStopRequest(bool aLastPart)
|
2012-10-11 18:34:23 -07:00
|
|
|
{
|
|
|
|
NS_NOTREACHED("imgRequest(imgIDecoderObserver)::OnStopRequest");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
/* void onDiscard (); */
|
|
|
|
NS_IMETHODIMP imgStatusTrackerObserver::OnDiscard()
|
2012-10-11 18:34:23 -07:00
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(mTracker->GetImage(),
|
|
|
|
"OnDiscard callback before we've created our image");
|
|
|
|
|
|
|
|
mTracker->RecordDiscard();
|
|
|
|
|
|
|
|
// Update the cache entry size, since we just got rid of frame data
|
|
|
|
mTracker->GetRequest()->UpdateCacheEntrySize();
|
|
|
|
|
2012-10-11 18:34:23 -07:00
|
|
|
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
|
2012-10-11 18:34:23 -07:00
|
|
|
while (iter.HasMore()) {
|
|
|
|
mTracker->SendDiscard(iter.GetNext());
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
NS_IMETHODIMP imgStatusTrackerObserver::OnImageIsAnimated()
|
2012-10-11 18:34:23 -07:00
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(mTracker->GetImage(),
|
|
|
|
"OnImageIsAnimated callback before we've created our image");
|
|
|
|
mTracker->RecordImageIsAnimated();
|
|
|
|
|
2012-10-11 18:34:23 -07:00
|
|
|
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
|
2012-10-11 18:34:23 -07:00
|
|
|
while (iter.HasMore()) {
|
|
|
|
mTracker->SendImageIsAnimated(iter.GetNext());
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// imgStatusTracker methods
|
|
|
|
|
2012-10-11 18:34:22 -07:00
|
|
|
imgStatusTracker::imgStatusTracker(Image* aImage, imgRequest* aRequest)
|
2010-05-14 13:47:59 -07:00
|
|
|
: mImage(aImage),
|
2012-10-11 18:34:22 -07:00
|
|
|
mRequest(aRequest),
|
2010-05-14 13:47:59 -07:00
|
|
|
mState(0),
|
|
|
|
mImageStatus(imgIRequest::STATUS_NONE),
|
2012-10-11 18:34:23 -07:00
|
|
|
mHadLastPart(false),
|
|
|
|
mBlockingOnload(false),
|
|
|
|
mTrackerObserver(new imgStatusTrackerObserver(this))
|
2010-05-14 13:47:59 -07:00
|
|
|
{}
|
|
|
|
|
2010-08-12 08:59:28 -07:00
|
|
|
imgStatusTracker::imgStatusTracker(const imgStatusTracker& aOther)
|
|
|
|
: mImage(aOther.mImage),
|
2012-10-11 18:34:22 -07:00
|
|
|
mRequest(aOther.mRequest),
|
2010-08-12 08:59:28 -07:00
|
|
|
mState(aOther.mState),
|
|
|
|
mImageStatus(aOther.mImageStatus),
|
2012-10-11 18:34:23 -07:00
|
|
|
mHadLastPart(aOther.mHadLastPart),
|
|
|
|
mBlockingOnload(aOther.mBlockingOnload)
|
2010-08-12 08:59:28 -07:00
|
|
|
// Note: we explicitly don't copy mRequestRunnable, because it won't be
|
|
|
|
// nulled out when the mRequestRunnable's Run function eventually gets
|
|
|
|
// called.
|
|
|
|
{}
|
|
|
|
|
2010-08-23 15:44:07 -07:00
|
|
|
void
|
|
|
|
imgStatusTracker::SetImage(Image* aImage)
|
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(aImage, "Setting null image");
|
|
|
|
NS_ABORT_IF_FALSE(!mImage, "Setting image when we already have one");
|
|
|
|
mImage = aImage;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2010-05-14 13:47:59 -07:00
|
|
|
imgStatusTracker::IsLoading() const
|
|
|
|
{
|
|
|
|
// Checking for whether OnStopRequest has fired allows us to say we're
|
|
|
|
// loading before OnStartRequest gets called, letting the request properly
|
|
|
|
// get removed from the cache in certain cases.
|
|
|
|
return !(mState & stateRequestStopped);
|
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t
|
2010-05-14 13:47:59 -07:00
|
|
|
imgStatusTracker::GetImageStatus() const
|
|
|
|
{
|
|
|
|
return mImageStatus;
|
|
|
|
}
|
|
|
|
|
2010-07-28 14:52:14 -07:00
|
|
|
// A helper class to allow us to call SyncNotify asynchronously.
|
|
|
|
class imgRequestNotifyRunnable : public nsRunnable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
imgRequestNotifyRunnable(imgRequest* request, imgRequestProxy* requestproxy)
|
2010-08-12 08:59:28 -07:00
|
|
|
: mRequest(request)
|
|
|
|
{
|
|
|
|
mProxies.AppendElement(requestproxy);
|
|
|
|
}
|
2010-07-28 14:52:14 -07:00
|
|
|
|
|
|
|
NS_IMETHOD Run()
|
|
|
|
{
|
2010-08-23 15:44:07 -07:00
|
|
|
imgStatusTracker& statusTracker = mRequest->GetStatusTracker();
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
for (uint32_t i = 0; i < mProxies.Length(); ++i) {
|
2011-10-17 07:59:28 -07:00
|
|
|
mProxies[i]->SetNotificationsDeferred(false);
|
2010-08-23 15:44:07 -07:00
|
|
|
statusTracker.SyncNotify(mProxies[i]);
|
2010-08-12 08:59:28 -07:00
|
|
|
}
|
2010-07-28 14:52:14 -07:00
|
|
|
|
2012-07-30 07:20:58 -07:00
|
|
|
statusTracker.mRequestRunnable = nullptr;
|
2010-07-28 14:52:14 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2010-08-12 08:59:28 -07:00
|
|
|
void AddProxy(imgRequestProxy* aRequestProxy)
|
|
|
|
{
|
|
|
|
mProxies.AppendElement(aRequestProxy);
|
|
|
|
}
|
|
|
|
|
2010-07-28 14:52:14 -07:00
|
|
|
private:
|
2010-08-12 08:59:28 -07:00
|
|
|
friend class imgStatusTracker;
|
|
|
|
|
2010-07-28 14:52:14 -07:00
|
|
|
nsRefPtr<imgRequest> mRequest;
|
2010-08-12 08:59:28 -07:00
|
|
|
nsTArray<nsRefPtr<imgRequestProxy> > mProxies;
|
2010-07-28 14:52:14 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
imgStatusTracker::Notify(imgRequest* request, imgRequestProxy* proxy)
|
|
|
|
{
|
2010-07-28 14:52:34 -07:00
|
|
|
#ifdef PR_LOGGING
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
request->GetURI(getter_AddRefs(uri));
|
2012-09-01 19:35:17 -07:00
|
|
|
nsAutoCString spec;
|
2010-07-28 14:52:34 -07:00
|
|
|
uri->GetSpec(spec);
|
|
|
|
LOG_FUNC_WITH_PARAM(gImgLog, "imgStatusTracker::Notify async", "uri", spec.get());
|
|
|
|
#endif
|
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
proxy->SetNotificationsDeferred(true);
|
2010-07-28 14:52:14 -07:00
|
|
|
|
2010-08-12 08:59:28 -07:00
|
|
|
// If we have an existing runnable that we can use, we just append this proxy
|
|
|
|
// to its list of proxies to be notified. This ensures we don't unnecessarily
|
|
|
|
// delay onload.
|
|
|
|
imgRequestNotifyRunnable* runnable = static_cast<imgRequestNotifyRunnable*>(mRequestRunnable.get());
|
|
|
|
if (runnable && runnable->mRequest == request) {
|
|
|
|
runnable->AddProxy(proxy);
|
|
|
|
} else {
|
|
|
|
// It's okay to overwrite an existing mRequestRunnable, because adding a
|
|
|
|
// new proxy is strictly a performance optimization. The notification will
|
|
|
|
// always happen, regardless of whether we hold a reference to a runnable.
|
|
|
|
mRequestRunnable = new imgRequestNotifyRunnable(request, proxy);
|
|
|
|
NS_DispatchToCurrentThread(mRequestRunnable);
|
|
|
|
}
|
2010-07-28 14:52:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// A helper class to allow us to call SyncNotify asynchronously for a given,
|
|
|
|
// fixed, state.
|
|
|
|
class imgStatusNotifyRunnable : public nsRunnable
|
|
|
|
{
|
|
|
|
public:
|
2010-08-12 08:59:28 -07:00
|
|
|
imgStatusNotifyRunnable(imgStatusTracker& status,
|
2010-07-28 14:52:14 -07:00
|
|
|
imgRequestProxy* requestproxy)
|
|
|
|
: mStatus(status), mImage(status.mImage), mProxy(requestproxy)
|
|
|
|
{}
|
|
|
|
|
|
|
|
NS_IMETHOD Run()
|
|
|
|
{
|
2011-10-17 07:59:28 -07:00
|
|
|
mProxy->SetNotificationsDeferred(false);
|
2010-07-28 14:52:14 -07:00
|
|
|
|
|
|
|
mStatus.SyncNotify(mProxy);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
imgStatusTracker mStatus;
|
|
|
|
// We have to hold on to a reference to the tracker's image, just in case
|
|
|
|
// it goes away while we're in the event queue.
|
2010-08-13 21:09:49 -07:00
|
|
|
nsRefPtr<Image> mImage;
|
2010-07-28 14:52:14 -07:00
|
|
|
nsRefPtr<imgRequestProxy> mProxy;
|
|
|
|
};
|
|
|
|
|
2010-05-14 13:47:59 -07:00
|
|
|
void
|
2010-07-28 14:52:14 -07:00
|
|
|
imgStatusTracker::NotifyCurrentState(imgRequestProxy* proxy)
|
2010-05-14 13:47:59 -07:00
|
|
|
{
|
2010-07-28 14:52:34 -07:00
|
|
|
#ifdef PR_LOGGING
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
proxy->GetURI(getter_AddRefs(uri));
|
2012-09-01 19:35:17 -07:00
|
|
|
nsAutoCString spec;
|
2010-07-28 14:52:34 -07:00
|
|
|
uri->GetSpec(spec);
|
|
|
|
LOG_FUNC_WITH_PARAM(gImgLog, "imgStatusTracker::NotifyCurrentState", "uri", spec.get());
|
|
|
|
#endif
|
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
proxy->SetNotificationsDeferred(true);
|
2010-07-28 14:52:14 -07:00
|
|
|
|
2010-08-12 08:59:28 -07:00
|
|
|
// We don't keep track of
|
2010-07-28 14:52:14 -07:00
|
|
|
nsCOMPtr<nsIRunnable> ev = new imgStatusNotifyRunnable(*this, proxy);
|
|
|
|
NS_DispatchToCurrentThread(ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
imgStatusTracker::SyncNotify(imgRequestProxy* proxy)
|
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(!proxy->NotificationsDeferred(),
|
|
|
|
"Calling imgStatusTracker::Notify() on a proxy that doesn't want notifications!");
|
|
|
|
|
2010-07-28 14:52:34 -07:00
|
|
|
#ifdef PR_LOGGING
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
proxy->GetURI(getter_AddRefs(uri));
|
2012-09-01 19:35:17 -07:00
|
|
|
nsAutoCString spec;
|
2010-07-28 14:52:34 -07:00
|
|
|
uri->GetSpec(spec);
|
|
|
|
LOG_SCOPE_WITH_PARAM(gImgLog, "imgStatusTracker::SyncNotify", "uri", spec.get());
|
|
|
|
#endif
|
|
|
|
|
2010-05-14 13:47:59 -07:00
|
|
|
nsCOMPtr<imgIRequest> kungFuDeathGrip(proxy);
|
|
|
|
|
|
|
|
// OnStartRequest
|
|
|
|
if (mState & stateRequestStarted)
|
|
|
|
proxy->OnStartRequest();
|
|
|
|
|
|
|
|
// OnStartContainer
|
|
|
|
if (mState & stateHasSize)
|
2012-10-11 18:34:24 -07:00
|
|
|
proxy->OnStartContainer();
|
2010-05-14 13:47:59 -07:00
|
|
|
|
2012-08-13 15:58:53 -07:00
|
|
|
// BlockOnload
|
|
|
|
if (mState & stateBlockingOnload)
|
|
|
|
proxy->BlockOnload();
|
|
|
|
|
2010-08-23 15:44:07 -07:00
|
|
|
if (mImage) {
|
2012-08-22 08:56:38 -07:00
|
|
|
int16_t imageType = mImage->GetType();
|
2012-10-11 18:34:24 -07:00
|
|
|
// Send frame messages (OnDataAvailable, OnStopFrame)
|
2010-08-23 15:44:07 -07:00
|
|
|
if (imageType == imgIContainer::TYPE_VECTOR ||
|
|
|
|
static_cast<RasterImage*>(mImage)->GetNumFrames() > 0) {
|
2010-08-23 15:44:07 -07:00
|
|
|
|
2010-08-23 15:44:07 -07:00
|
|
|
// OnDataAvailable
|
|
|
|
// XXX - Should only send partial rects here, but that needs to
|
|
|
|
// wait until we fix up the observer interface
|
|
|
|
nsIntRect r;
|
|
|
|
mImage->GetCurrentFrameRect(r);
|
2012-10-11 18:34:24 -07:00
|
|
|
proxy->OnFrameUpdate(&r);
|
2010-05-14 13:47:59 -07:00
|
|
|
|
2010-08-23 15:44:07 -07:00
|
|
|
if (mState & stateFrameStopped)
|
2012-10-11 18:34:24 -07:00
|
|
|
proxy->OnStopFrame();
|
2010-08-23 15:44:07 -07:00
|
|
|
}
|
2011-11-09 13:39:15 -08:00
|
|
|
|
|
|
|
// OnImageIsAnimated
|
|
|
|
bool isAnimated = false;
|
|
|
|
|
|
|
|
nsresult rv = mImage->GetAnimated(&isAnimated);
|
|
|
|
if (NS_SUCCEEDED(rv) && isAnimated) {
|
|
|
|
proxy->OnImageIsAnimated();
|
|
|
|
}
|
2010-05-14 13:47:59 -07:00
|
|
|
}
|
|
|
|
|
2010-08-23 15:44:07 -07:00
|
|
|
if (mState & stateDecodeStopped) {
|
|
|
|
NS_ABORT_IF_FALSE(mImage, "stopped decoding without ever having an image?");
|
2012-10-11 18:34:23 -07:00
|
|
|
proxy->OnStopDecode();
|
2010-08-23 15:44:07 -07:00
|
|
|
}
|
2010-05-14 13:47:59 -07:00
|
|
|
|
|
|
|
if (mState & stateRequestStopped) {
|
|
|
|
proxy->OnStopRequest(mHadLastPart);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-11 09:35:43 -07:00
|
|
|
imgStatusTracker::EmulateRequestFinished(imgRequestProxy* aProxy,
|
|
|
|
nsresult aStatus)
|
2010-05-14 13:47:59 -07:00
|
|
|
{
|
|
|
|
nsCOMPtr<imgIRequest> kungFuDeathGrip(aProxy);
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
// In certain cases the request might not have started yet.
|
|
|
|
// We still need to fulfill the contract.
|
2012-10-11 18:34:24 -07:00
|
|
|
if (!(mState & stateRequestStarted)) {
|
|
|
|
aProxy->OnStartRequest();
|
|
|
|
}
|
|
|
|
|
2012-10-09 09:47:14 -07:00
|
|
|
if (mState & stateBlockingOnload) {
|
|
|
|
aProxy->UnblockOnload();
|
|
|
|
}
|
|
|
|
|
2010-05-14 13:47:59 -07:00
|
|
|
if (!(mState & stateRequestStopped)) {
|
2011-10-17 07:59:28 -07:00
|
|
|
aProxy->OnStopRequest(true);
|
2010-05-14 13:47:59 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-11 18:34:22 -07:00
|
|
|
void
|
|
|
|
imgStatusTracker::AddConsumer(imgRequestProxy* aConsumer)
|
|
|
|
{
|
|
|
|
mConsumers.AppendElementUnlessExists(aConsumer);
|
|
|
|
}
|
|
|
|
|
|
|
|
// XXX - The last two arguments should go away.
|
|
|
|
bool
|
2012-10-11 18:34:24 -07:00
|
|
|
imgStatusTracker::RemoveConsumer(imgRequestProxy* aConsumer,
|
|
|
|
nsresult aStatus,
|
2012-10-11 18:34:22 -07:00
|
|
|
bool aOnlySendStopRequest)
|
|
|
|
{
|
|
|
|
// Remove the proxy from the list.
|
|
|
|
bool removed = mConsumers.RemoveElement(aConsumer);
|
|
|
|
|
|
|
|
// Consumers can get confused if they don't get all the proper teardown
|
|
|
|
// notifications. Part ways on good terms.
|
|
|
|
if (removed)
|
|
|
|
EmulateRequestFinished(aConsumer, aStatus, aOnlySendStopRequest);
|
|
|
|
return removed;
|
|
|
|
}
|
|
|
|
|
2010-05-14 13:47:59 -07:00
|
|
|
void
|
|
|
|
imgStatusTracker::RecordCancel()
|
|
|
|
{
|
|
|
|
if (!(mImageStatus & imgIRequest::STATUS_LOAD_PARTIAL))
|
|
|
|
mImageStatus |= imgIRequest::STATUS_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
imgStatusTracker::RecordLoaded()
|
|
|
|
{
|
2010-08-23 15:44:35 -07:00
|
|
|
NS_ABORT_IF_FALSE(mImage, "RecordLoaded called before we have an Image");
|
2010-05-14 13:47:59 -07:00
|
|
|
mState |= stateRequestStarted | stateHasSize | stateRequestStopped;
|
|
|
|
mImageStatus |= imgIRequest::STATUS_SIZE_AVAILABLE | imgIRequest::STATUS_LOAD_COMPLETE;
|
2011-10-17 07:59:28 -07:00
|
|
|
mHadLastPart = true;
|
2010-05-14 13:47:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
imgStatusTracker::RecordDecoded()
|
|
|
|
{
|
2010-08-23 15:44:35 -07:00
|
|
|
NS_ABORT_IF_FALSE(mImage, "RecordDecoded called before we have an Image");
|
2012-10-11 18:34:24 -07:00
|
|
|
mState |= stateDecodeStopped | stateFrameStopped;
|
2010-05-14 13:47:59 -07:00
|
|
|
mImageStatus |= imgIRequest::STATUS_FRAME_COMPLETE | imgIRequest::STATUS_DECODE_COMPLETE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
imgStatusTracker::RecordStartContainer(imgIContainer* aContainer)
|
|
|
|
{
|
2010-08-23 15:44:35 -07:00
|
|
|
NS_ABORT_IF_FALSE(mImage,
|
|
|
|
"RecordStartContainer called before we have an Image");
|
|
|
|
NS_ABORT_IF_FALSE(mImage == aContainer,
|
|
|
|
"RecordStartContainer called with wrong Image");
|
2010-05-14 13:47:59 -07:00
|
|
|
mState |= stateHasSize;
|
|
|
|
mImageStatus |= imgIRequest::STATUS_SIZE_AVAILABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-11 18:34:24 -07:00
|
|
|
imgStatusTracker::SendStartContainer(imgRequestProxy* aProxy)
|
2010-05-14 13:47:59 -07:00
|
|
|
{
|
2010-08-12 08:59:37 -07:00
|
|
|
if (!aProxy->NotificationsDeferred())
|
2012-10-11 18:34:24 -07:00
|
|
|
aProxy->OnStartContainer();
|
2010-05-14 13:47:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-11 18:34:24 -07:00
|
|
|
imgStatusTracker::RecordDataAvailable()
|
2010-05-14 13:47:59 -07:00
|
|
|
{
|
2010-08-23 15:44:35 -07:00
|
|
|
NS_ABORT_IF_FALSE(mImage,
|
|
|
|
"RecordDataAvailable called before we have an Image");
|
2010-05-14 13:47:59 -07:00
|
|
|
// no bookkeeping necessary here - this is implied by imgIContainer's
|
|
|
|
// number of frames and frame rect
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-11 18:34:24 -07:00
|
|
|
imgStatusTracker::SendDataAvailable(imgRequestProxy* aProxy,
|
|
|
|
const nsIntRect* aRect)
|
2010-05-14 13:47:59 -07:00
|
|
|
{
|
2010-07-28 14:52:14 -07:00
|
|
|
if (!aProxy->NotificationsDeferred())
|
2012-10-11 18:34:24 -07:00
|
|
|
aProxy->OnFrameUpdate(aRect);
|
2010-05-14 13:47:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2012-10-11 18:34:24 -07:00
|
|
|
imgStatusTracker::RecordStopFrame()
|
2010-05-14 13:47:59 -07:00
|
|
|
{
|
2010-08-23 15:44:35 -07:00
|
|
|
NS_ABORT_IF_FALSE(mImage, "RecordStopFrame called before we have an Image");
|
2010-05-14 13:47:59 -07:00
|
|
|
mState |= stateFrameStopped;
|
|
|
|
mImageStatus |= imgIRequest::STATUS_FRAME_COMPLETE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-11 18:34:24 -07:00
|
|
|
imgStatusTracker::SendStopFrame(imgRequestProxy* aProxy)
|
2010-05-14 13:47:59 -07:00
|
|
|
{
|
2010-07-28 14:52:14 -07:00
|
|
|
if (!aProxy->NotificationsDeferred())
|
2012-10-11 18:34:24 -07:00
|
|
|
aProxy->OnStopFrame();
|
2010-05-14 13:47:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-11 18:34:23 -07:00
|
|
|
imgStatusTracker::RecordStopDecode(nsresult aStatus)
|
2010-05-14 13:47:59 -07:00
|
|
|
{
|
2010-08-23 15:44:35 -07:00
|
|
|
NS_ABORT_IF_FALSE(mImage,
|
|
|
|
"RecordStopDecode called before we have an Image");
|
2010-05-14 13:47:59 -07:00
|
|
|
mState |= stateDecodeStopped;
|
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
if (NS_SUCCEEDED(aStatus) && mImageStatus != imgIRequest::STATUS_ERROR)
|
2010-05-14 13:47:59 -07:00
|
|
|
mImageStatus |= imgIRequest::STATUS_DECODE_COMPLETE;
|
|
|
|
// If we weren't successful, clear all success status bits and set error.
|
|
|
|
else
|
|
|
|
mImageStatus = imgIRequest::STATUS_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-11 18:34:24 -07:00
|
|
|
imgStatusTracker::SendStopDecode(imgRequestProxy* aProxy,
|
|
|
|
nsresult aStatus)
|
2010-05-14 13:47:59 -07:00
|
|
|
{
|
2010-07-28 14:52:14 -07:00
|
|
|
if (!aProxy->NotificationsDeferred())
|
2012-10-11 18:34:23 -07:00
|
|
|
aProxy->OnStopDecode();
|
2010-05-14 13:47:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
imgStatusTracker::RecordDiscard()
|
|
|
|
{
|
2010-08-23 15:44:35 -07:00
|
|
|
NS_ABORT_IF_FALSE(mImage,
|
|
|
|
"RecordDiscard called before we have an Image");
|
2010-05-14 13:47:59 -07:00
|
|
|
// Clear the state bits we no longer deserve.
|
2012-10-11 18:34:24 -07:00
|
|
|
uint32_t stateBitsToClear = stateDecodeStopped;
|
2010-05-14 13:47:59 -07:00
|
|
|
mState &= ~stateBitsToClear;
|
|
|
|
|
|
|
|
// Clear the status bits we no longer deserve.
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t statusBitsToClear = imgIRequest::STATUS_FRAME_COMPLETE
|
2010-05-14 13:47:59 -07:00
|
|
|
| imgIRequest::STATUS_DECODE_COMPLETE;
|
|
|
|
mImageStatus &= ~statusBitsToClear;
|
|
|
|
}
|
|
|
|
|
2011-11-09 13:39:15 -08:00
|
|
|
void
|
|
|
|
imgStatusTracker::SendImageIsAnimated(imgRequestProxy* aProxy)
|
|
|
|
{
|
|
|
|
if (!aProxy->NotificationsDeferred())
|
|
|
|
aProxy->OnImageIsAnimated();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
imgStatusTracker::RecordImageIsAnimated()
|
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(mImage,
|
|
|
|
"RecordImageIsAnimated called before we have an Image");
|
|
|
|
// No bookkeeping necessary here - once decoding is complete, GetAnimated()
|
|
|
|
// will accurately return that this is an animated image. Until that time,
|
|
|
|
// the OnImageIsAnimated notification is the only indication an observer
|
|
|
|
// will have that an image has more than 1 frame.
|
|
|
|
}
|
|
|
|
|
2010-05-14 13:47:59 -07:00
|
|
|
void
|
|
|
|
imgStatusTracker::SendDiscard(imgRequestProxy* aProxy)
|
|
|
|
{
|
2010-07-28 14:52:14 -07:00
|
|
|
if (!aProxy->NotificationsDeferred())
|
|
|
|
aProxy->OnDiscard();
|
2010-05-14 13:47:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* non-virtual imgIContainerObserver methods */
|
|
|
|
void
|
2012-10-11 18:34:24 -07:00
|
|
|
imgStatusTracker::RecordFrameChanged(const nsIntRect* aDirtyRect)
|
2010-05-14 13:47:59 -07:00
|
|
|
{
|
2010-08-23 15:44:35 -07:00
|
|
|
NS_ABORT_IF_FALSE(mImage,
|
|
|
|
"RecordFrameChanged called before we have an Image");
|
2010-05-14 13:47:59 -07:00
|
|
|
// no bookkeeping necessary here - this is only for in-frame updates, which we
|
|
|
|
// don't fire while we're recording
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-11 18:34:24 -07:00
|
|
|
imgStatusTracker::SendFrameChanged(imgRequestProxy* aProxy,
|
2010-08-13 21:09:48 -07:00
|
|
|
const nsIntRect* aDirtyRect)
|
2010-05-14 13:47:59 -07:00
|
|
|
{
|
2010-07-28 14:52:14 -07:00
|
|
|
if (!aProxy->NotificationsDeferred())
|
2012-10-11 18:34:24 -07:00
|
|
|
aProxy->OnFrameUpdate(aDirtyRect);
|
2010-05-14 13:47:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* non-virtual sort-of-nsIRequestObserver methods */
|
|
|
|
void
|
|
|
|
imgStatusTracker::RecordStartRequest()
|
|
|
|
{
|
|
|
|
// We're starting a new load, so clear any status and state bits indicating
|
|
|
|
// load/decode
|
|
|
|
mImageStatus &= ~imgIRequest::STATUS_LOAD_PARTIAL;
|
|
|
|
mImageStatus &= ~imgIRequest::STATUS_LOAD_COMPLETE;
|
|
|
|
mImageStatus &= ~imgIRequest::STATUS_FRAME_COMPLETE;
|
|
|
|
mState &= ~stateRequestStarted;
|
|
|
|
mState &= ~stateDecodeStopped;
|
|
|
|
mState &= ~stateRequestStopped;
|
2012-08-13 15:58:53 -07:00
|
|
|
mState &= ~stateBlockingOnload;
|
2010-05-14 13:47:59 -07:00
|
|
|
|
|
|
|
mState |= stateRequestStarted;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
imgStatusTracker::SendStartRequest(imgRequestProxy* aProxy)
|
|
|
|
{
|
2010-07-28 14:52:14 -07:00
|
|
|
if (!aProxy->NotificationsDeferred())
|
|
|
|
aProxy->OnStartRequest();
|
2010-05-14 13:47:59 -07:00
|
|
|
}
|
|
|
|
|
2012-10-11 18:34:23 -07:00
|
|
|
void
|
|
|
|
imgStatusTracker::OnStartRequest()
|
|
|
|
{
|
|
|
|
RecordStartRequest();
|
|
|
|
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mConsumers);
|
|
|
|
while (iter.HasMore()) {
|
|
|
|
SendStartRequest(iter.GetNext());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-14 13:47:59 -07:00
|
|
|
void
|
2012-10-11 18:34:24 -07:00
|
|
|
imgStatusTracker::RecordStopRequest(bool aLastPart,
|
|
|
|
nsresult aStatus)
|
2010-05-14 13:47:59 -07:00
|
|
|
{
|
|
|
|
mHadLastPart = aLastPart;
|
|
|
|
mState |= stateRequestStopped;
|
|
|
|
|
|
|
|
// If we were successful in loading, note that the image is complete.
|
2012-10-11 18:34:24 -07:00
|
|
|
if (NS_SUCCEEDED(aStatus) && mImageStatus != imgIRequest::STATUS_ERROR)
|
2010-05-14 13:47:59 -07:00
|
|
|
mImageStatus |= imgIRequest::STATUS_LOAD_COMPLETE;
|
2012-10-11 18:34:24 -07:00
|
|
|
else
|
|
|
|
mImageStatus = imgIRequest::STATUS_ERROR;
|
2010-05-14 13:47:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-11 18:34:24 -07:00
|
|
|
imgStatusTracker::SendStopRequest(imgRequestProxy* aProxy,
|
|
|
|
bool aLastPart,
|
|
|
|
nsresult aStatus)
|
2010-05-14 13:47:59 -07:00
|
|
|
{
|
2010-07-28 14:52:14 -07:00
|
|
|
if (!aProxy->NotificationsDeferred()) {
|
|
|
|
aProxy->OnStopRequest(aLastPart);
|
|
|
|
}
|
2010-05-14 13:47:59 -07:00
|
|
|
}
|
2012-08-13 15:58:53 -07:00
|
|
|
|
2012-10-11 18:34:23 -07:00
|
|
|
void
|
2012-10-11 18:34:24 -07:00
|
|
|
imgStatusTracker::OnStopRequest(bool aLastPart,
|
|
|
|
nsresult aStatus)
|
2012-10-11 18:34:23 -07:00
|
|
|
{
|
2012-10-11 18:34:24 -07:00
|
|
|
bool preexistingError = mImageStatus == imgIRequest::STATUS_ERROR;
|
|
|
|
|
2012-10-11 18:34:23 -07:00
|
|
|
RecordStopRequest(aLastPart, aStatus);
|
|
|
|
/* notify the kids */
|
|
|
|
nsTObserverArray<imgRequestProxy*>::ForwardIterator srIter(mConsumers);
|
|
|
|
while (srIter.HasMore()) {
|
|
|
|
SendStopRequest(srIter.GetNext(), aLastPart, aStatus);
|
|
|
|
}
|
2012-10-11 18:34:24 -07:00
|
|
|
|
2012-10-11 18:34:24 -07:00
|
|
|
if (NS_FAILED(aStatus) && !preexistingError) {
|
|
|
|
FireFailureNotification(GetRequest());
|
2012-10-11 18:34:24 -07:00
|
|
|
}
|
2012-10-11 18:34:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
imgStatusTracker::OnDataAvailable()
|
|
|
|
{
|
|
|
|
// Notify any imgRequestProxys that are observing us that we have an Image.
|
|
|
|
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mConsumers);
|
|
|
|
while (iter.HasMore()) {
|
|
|
|
iter.GetNext()->SetHasImage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-13 15:58:53 -07:00
|
|
|
void
|
|
|
|
imgStatusTracker::RecordBlockOnload()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(!(mState & stateBlockingOnload));
|
|
|
|
mState |= stateBlockingOnload;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
imgStatusTracker::SendBlockOnload(imgRequestProxy* aProxy)
|
|
|
|
{
|
|
|
|
if (!aProxy->NotificationsDeferred()) {
|
|
|
|
aProxy->BlockOnload();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
imgStatusTracker::RecordUnblockOnload()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mState & stateBlockingOnload);
|
|
|
|
mState &= ~stateBlockingOnload;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
imgStatusTracker::SendUnblockOnload(imgRequestProxy* aProxy)
|
|
|
|
{
|
|
|
|
if (!aProxy->NotificationsDeferred()) {
|
|
|
|
aProxy->UnblockOnload();
|
|
|
|
}
|
|
|
|
}
|
2012-10-11 18:34:23 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
imgStatusTracker::MaybeUnblockOnload()
|
|
|
|
{
|
|
|
|
if (!mBlockingOnload) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mBlockingOnload = false;
|
|
|
|
|
|
|
|
RecordUnblockOnload();
|
|
|
|
|
|
|
|
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mConsumers);
|
|
|
|
while (iter.HasMore()) {
|
|
|
|
SendUnblockOnload(iter.GetNext());
|
|
|
|
}
|
|
|
|
}
|