From dd334e9c677049dc3544bf760ea435892d2252e4 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Fri, 12 Oct 2012 12:11:23 -0400 Subject: [PATCH] Bug 505385 - Part 17: Clean up unused arguments in imgStatusTracker observers, document unclear things, etc. r=joe --- image/public/imgIContainerObserver.idl | 7 +- image/public/imgIDecoderObserver.idl | 33 +++--- image/src/Decoder.cpp | 17 ++- image/src/RasterImage.cpp | 8 +- image/src/VectorImage.cpp | 12 +-- image/src/imgRequestProxy.cpp | 11 +- image/src/imgRequestProxy.h | 12 +-- image/src/imgStatusTracker.cpp | 144 +++++++++++-------------- image/src/imgStatusTracker.h | 20 ++-- 9 files changed, 112 insertions(+), 152 deletions(-) diff --git a/image/public/imgIContainerObserver.idl b/image/public/imgIContainerObserver.idl index f4375658f6c..a0ff1b3d22f 100644 --- a/image/public/imgIContainerObserver.idl +++ b/image/public/imgIContainerObserver.idl @@ -10,7 +10,6 @@ #include "nsRect.h" %} -interface imgIContainer; interface imgIRequest; [ptr] native nsIntRect(nsIntRect); @@ -20,10 +19,8 @@ interface imgIRequest; * @author Stuart Parmenter * @version 0.1 */ -[scriptable, uuid(f01efdb3-4b20-4313-a636-a2aa01a4ef5d)] +[scriptable, uuid(f4aaf410-e88f-4036-b91c-610c9c11d825)] interface imgIContainerObserver : nsISupports { - [noscript] void frameChanged(in imgIRequest aRequest, - in imgIContainer aContainer, - [const] in nsIntRect aDirtyRect); + [noscript] void frameChanged([const] in nsIntRect aDirtyRect); }; diff --git a/image/public/imgIDecoderObserver.idl b/image/public/imgIDecoderObserver.idl index a1ee8d7e1c8..e721d59ec91 100644 --- a/image/public/imgIDecoderObserver.idl +++ b/image/public/imgIDecoderObserver.idl @@ -43,7 +43,7 @@ interface imgIContainer; * @version 0.1 * @see imagelib2 */ -[scriptable, uuid(7abf38ca-242b-413a-ab18-80532dd81133)] +[scriptable, uuid(dad8093d-384b-4923-b83c-351c4e5f9dce)] interface imgIDecoderObserver : imgIContainerObserver { /** @@ -53,7 +53,7 @@ interface imgIDecoderObserver : imgIContainerObserver * (used only for observers of imgIRequest objects, which are nsIRequests, * not imgIDecoder objects) */ - void onStartRequest(in imgIRequest aRequest); + void onStartRequest(); /** * Decode notification. @@ -62,7 +62,7 @@ interface imgIDecoderObserver : imgIContainerObserver * "header-only" decodes used by decode-on-draw to parse the width/height * out of the image. Thus, it is a decode notification only. */ - void onStartDecode(in imgIRequest aRequest); + void onStartDecode(); /** * Load notification. @@ -72,48 +72,41 @@ interface imgIDecoderObserver : imgIContainerObserver * called, the size has been set on the container and STATUS_SIZE_AVAILABLE * has been set on the associated imgRequest. */ - void onStartContainer(in imgIRequest aRequest, in imgIContainer aContainer); + void onStartContainer(); /** * Decode notification. * * called when each frame is created. */ - void onStartFrame(in imgIRequest aRequest, in unsigned long aFrame); + void onStartFrame(); /** * Decode notification. * * called when there is more to paint. */ - [noscript] void onDataAvailable(in imgIRequest aRequest, in boolean aCurrentFrame, [const] in nsIntRect aRect); + [noscript] void onDataAvailable([const] in nsIntRect aRect); /** * Decode notification. * * called when a frame is finished decoding. */ - void onStopFrame(in imgIRequest aRequest, in unsigned long aFrame); + void onStopFrame(); /** * Notification for when an image is known to be animated. This should be * fired at the earliest possible time. */ - void onImageIsAnimated(in imgIRequest aRequest); + void onImageIsAnimated(); /** - * In theory a decode notification, but currently a load notification. + * Decode notification. * - * Ideally this would be called when the decode is complete. Unfortunately, - * this is currently the only way to signal decoding errors to consumers, - * and the only decoding errors that consumers care about (indeed, the only - * ones that they're prepared to hear about) are failures to instantiate the - * decoder ( for example). Thus, currently this is just - * a companion to onStopDecode to signal success or failure. This will be - * revisited in bug 505385. If you're thinking of doing something new with - * this, please talk to bholley first. + * Called when all decoding has terminated. */ - void onStopDecode(in imgIRequest aRequest, in nsresult status); + void onStopDecode(in nsresult status); /** * Load notification. @@ -122,13 +115,13 @@ interface imgIDecoderObserver : imgIContainerObserver * (used only for observers of imgIRequest objects, which are nsIRequests, * not imgIDecoder objects) */ - void onStopRequest(in imgIRequest aRequest, in boolean aIsLastPart); + void onStopRequest(in boolean aIsLastPart); /** * Called when the decoded image data is discarded. This means that the frames * no longer exist in decoded form, and any attempt to access or draw the * image will initiate a new series of progressive decode notifications. */ - void onDiscard(in imgIRequest aRequest); + void onDiscard(); }; diff --git a/image/src/Decoder.cpp b/image/src/Decoder.cpp index a5a7cad2501..9d445849ddd 100644 --- a/image/src/Decoder.cpp +++ b/image/src/Decoder.cpp @@ -45,7 +45,7 @@ Decoder::Init() // Fire OnStartDecode at init time to support bug 512435 if (!IsSizeDecode() && mObserver) - mObserver->OnStartDecode(nullptr); + mObserver->OnStartDecode(); // Implementation-specific initialization InitInternal(); @@ -124,7 +124,7 @@ Decoder::Finish() // Fire teardown notifications if (mObserver) { - mObserver->OnStopDecode(nullptr, salvage ? NS_OK : NS_ERROR_FAILURE); + mObserver->OnStopDecode(salvage ? NS_OK : NS_ERROR_FAILURE); } } } @@ -166,8 +166,7 @@ Decoder::FlushInvalidations() mInvalidRect.Inflate(1); mInvalidRect = mInvalidRect.Intersect(mImageBound); #endif - bool isCurrentFrame = mImage.GetCurrentFrameIndex() == (mFrameCount - 1); - mObserver->OnDataAvailable(nullptr, isCurrentFrame, &mInvalidRect); + mObserver->OnDataAvailable(&mInvalidRect); } // Clear the invalidation rectangle @@ -198,7 +197,7 @@ Decoder::PostSize(int32_t aWidth, int32_t aHeight) // Notify the observer if (mObserver) - mObserver->OnStartContainer(nullptr, &mImage); + mObserver->OnStartContainer(); } void @@ -224,7 +223,7 @@ Decoder::PostFrameStart() // Fire notification if (mObserver) - mObserver->OnStartFrame(nullptr, mFrameCount - 1); // frame # is zero-indexed + mObserver->OnStartFrame(); } void @@ -241,10 +240,10 @@ Decoder::PostFrameStop() // Fire notifications if (mObserver) { - mObserver->OnStopFrame(nullptr, mFrameCount - 1); // frame # is zero-indexed + mObserver->OnStopFrame(); if (mFrameCount > 1 && !mIsAnimated) { mIsAnimated = true; - mObserver->OnImageIsAnimated(nullptr); + mObserver->OnImageIsAnimated(); } } } @@ -277,7 +276,7 @@ Decoder::PostDecodeDone() // Notify mImage.DecodingComplete(); if (mObserver) { - mObserver->OnStopDecode(nullptr, NS_OK); + mObserver->OnStopDecode(NS_OK); } } diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index 1ad65af1ad2..c7b83afacce 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -514,7 +514,7 @@ RasterImage::RequestRefresh(const mozilla::TimeStamp& aTime) #endif UpdateImageContainer(); - observer->FrameChanged(nullptr, this, &dirtyRect); + observer->FrameChanged(&dirtyRect); } } @@ -1500,7 +1500,7 @@ RasterImage::ResetAnimation() // Update display if we were animating before nsCOMPtr observer(do_QueryReferent(mObserver)); if (mAnimating && observer) - observer->FrameChanged(nullptr, this, &(mAnim->firstFrameRefreshArea)); + observer->FrameChanged(&(mAnim->firstFrameRefreshArea)); if (ShouldAnimate()) { StartAnimation(); @@ -2284,7 +2284,7 @@ RasterImage::Discard(bool force) // Notify that we discarded nsCOMPtr observer(do_QueryReferent(mObserver)); if (observer) - observer->OnDiscard(nullptr); + observer->OnDiscard(); if (force) DiscardTracker::Remove(&mDiscardTrackerNode); @@ -2774,7 +2774,7 @@ RasterImage::DrawWorker::Run() imgFrame *scaledFrame = request->dstFrame.get(); scaledFrame->ImageUpdated(scaledFrame->GetRect()); nsIntRect frameRect = request->srcFrame->GetRect(); - observer->FrameChanged(nullptr, request->image, &frameRect); + observer->FrameChanged(&frameRect); } } diff --git a/image/src/VectorImage.cpp b/image/src/VectorImage.cpp index 8a1ddde2e16..43ed30fd3a8 100644 --- a/image/src/VectorImage.cpp +++ b/image/src/VectorImage.cpp @@ -681,11 +681,11 @@ VectorImage::OnStopRequest(nsIRequest* aRequest, nsISupports* aCtxt, nsCOMPtr observer = do_QueryReferent(mObserver); if (observer) { // NOTE: This signals that width/height are available. - observer->OnStartContainer(nullptr, this); + observer->OnStartContainer(); - observer->FrameChanged(nullptr, this, &nsIntRect::GetMaxSizedIntRect()); - observer->OnStopFrame(nullptr, 0); - observer->OnStopDecode(nullptr, NS_OK); + observer->FrameChanged(&nsIntRect::GetMaxSizedIntRect()); + observer->OnStopFrame(); + observer->OnStopDecode(NS_OK); } EvaluateAnimation(); @@ -722,12 +722,12 @@ VectorImage::InvalidateObserver() nsCOMPtr containerObs(do_QueryReferent(mObserver)); if (containerObs) { - containerObs->FrameChanged(nullptr, this, &nsIntRect::GetMaxSizedIntRect()); + containerObs->FrameChanged(&nsIntRect::GetMaxSizedIntRect()); } nsCOMPtr decoderObs(do_QueryReferent(mObserver)); if (decoderObs) { - decoderObs->OnStopFrame(nullptr, imgIContainer::FRAME_CURRENT); + decoderObs->OnStopFrame(); } } diff --git a/image/src/imgRequestProxy.cpp b/image/src/imgRequestProxy.cpp index c756e4caa0a..6b66393135b 100644 --- a/image/src/imgRequestProxy.cpp +++ b/image/src/imgRequestProxy.cpp @@ -612,8 +612,7 @@ NS_IMETHODIMP imgRequestProxy::GetHasTransferredData(bool* hasData) return NS_OK; } -void imgRequestProxy::FrameChanged(imgIContainer *container, - const nsIntRect *dirtyRect) +void imgRequestProxy::FrameChanged(const nsIntRect *dirtyRect) { LOG_FUNC(gImgLog, "imgRequestProxy::FrameChanged"); @@ -637,7 +636,7 @@ void imgRequestProxy::OnStartDecode() } } -void imgRequestProxy::OnStartContainer(imgIContainer *image) +void imgRequestProxy::OnStartContainer() { LOG_FUNC(gImgLog, "imgRequestProxy::OnStartContainer"); @@ -649,7 +648,7 @@ void imgRequestProxy::OnStartContainer(imgIContainer *image) } } -void imgRequestProxy::OnStartFrame(uint32_t frame) +void imgRequestProxy::OnStartFrame() { LOG_FUNC(gImgLog, "imgRequestProxy::OnStartFrame"); @@ -660,7 +659,7 @@ void imgRequestProxy::OnStartFrame(uint32_t frame) } } -void imgRequestProxy::OnDataAvailable(bool aCurrentFrame, const nsIntRect * rect) +void imgRequestProxy::OnDataAvailable(const nsIntRect * rect) { LOG_FUNC(gImgLog, "imgRequestProxy::OnDataAvailable"); @@ -671,7 +670,7 @@ void imgRequestProxy::OnDataAvailable(bool aCurrentFrame, const nsIntRect * rect } } -void imgRequestProxy::OnStopFrame(uint32_t frame) +void imgRequestProxy::OnStopFrame() { LOG_FUNC(gImgLog, "imgRequestProxy::OnStopFrame"); diff --git a/image/src/imgRequestProxy.h b/image/src/imgRequestProxy.h index 4bb7898c336..6ab22229da2 100644 --- a/image/src/imgRequestProxy.h +++ b/image/src/imgRequestProxy.h @@ -133,17 +133,16 @@ protected: /* non-virtual imgIDecoderObserver methods */ void OnStartDecode (); - void OnStartContainer (imgIContainer *aContainer); - void OnStartFrame (uint32_t aFrame); - void OnDataAvailable (bool aCurrentFrame, const nsIntRect * aRect); - void OnStopFrame (uint32_t aFrame); + void OnStartContainer (); + void OnStartFrame (); + void OnDataAvailable (const nsIntRect * aRect); + void OnStopFrame (); void OnStopDecode (); void OnDiscard (); void OnImageIsAnimated (); /* non-virtual imgIContainerObserver methods */ - void FrameChanged(imgIContainer *aContainer, - const nsIntRect *aDirtyRect); + void FrameChanged(const nsIntRect *aDirtyRect); /* non-virtual sort-of-nsIRequestObserver methods */ void OnStartRequest(); @@ -256,7 +255,6 @@ protected: // request on-demand, because static proxies don't have an underlying request. nsCOMPtr mPrincipal; -private: mozilla::image::Image* GetImage() const MOZ_OVERRIDE; using imgRequestProxy::GetImage; }; diff --git a/image/src/imgStatusTracker.cpp b/image/src/imgStatusTracker.cpp index f9551f1f0f6..aa20df972e5 100644 --- a/image/src/imgStatusTracker.cpp +++ b/image/src/imgStatusTracker.cpp @@ -27,22 +27,18 @@ NS_IMPL_ISUPPORTS3(imgStatusTrackerObserver, /** imgIContainerObserver methods **/ -/* [noscript] void frameChanged (in imgIRequest request, - in imgIContainer container, - in nsIntRect dirtyRect); */ -NS_IMETHODIMP imgStatusTrackerObserver::FrameChanged(imgIRequest *request, - imgIContainer *container, - const nsIntRect *dirtyRect) +/* [noscript] void frameChanged (in nsIntRect dirtyRect); */ +NS_IMETHODIMP imgStatusTrackerObserver::FrameChanged(const nsIntRect *dirtyRect) { LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::FrameChanged"); NS_ABORT_IF_FALSE(mTracker->GetImage(), "FrameChanged callback before we've created our image"); - mTracker->RecordFrameChanged(container, dirtyRect); + mTracker->RecordFrameChanged(dirtyRect); nsTObserverArray::ForwardIterator iter(mTracker->mConsumers); while (iter.HasMore()) { - mTracker->SendFrameChanged(iter.GetNext(), container, dirtyRect); + mTracker->SendFrameChanged(iter.GetNext(), dirtyRect); } return NS_OK; @@ -50,14 +46,13 @@ NS_IMETHODIMP imgStatusTrackerObserver::FrameChanged(imgIRequest *request, /** imgIDecoderObserver methods **/ -/* void onStartDecode (in imgIRequest request); */ -NS_IMETHODIMP imgStatusTrackerObserver::OnStartDecode(imgIRequest *request) +/* void onStartDecode (); */ +NS_IMETHODIMP imgStatusTrackerObserver::OnStartDecode() { LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnStartDecode"); NS_ABORT_IF_FALSE(mTracker->GetImage(), "OnStartDecode callback before we've created our image"); - mTracker->RecordStartDecode(); nsTObserverArray::ForwardIterator iter(mTracker->mConsumers); @@ -87,84 +82,75 @@ NS_IMETHODIMP imgStatusTrackerObserver::OnStartDecode(imgIRequest *request) return NS_OK; } -NS_IMETHODIMP imgStatusTrackerObserver::OnStartRequest(imgIRequest *aRequest) +NS_IMETHODIMP imgStatusTrackerObserver::OnStartRequest() { NS_NOTREACHED("imgRequest(imgIDecoderObserver)::OnStartRequest"); return NS_OK; } -/* void onStartContainer (in imgIRequest request, in imgIContainer image); */ -NS_IMETHODIMP imgStatusTrackerObserver::OnStartContainer(imgIRequest *request, imgIContainer *image) +/* void onStartContainer (); */ +NS_IMETHODIMP imgStatusTrackerObserver::OnStartContainer() { LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnStartContainer"); - NS_ASSERTION(image, "imgStatusTrackerObserver::OnStartContainer called with a null image!"); - if (!image) return NS_ERROR_UNEXPECTED; - NS_ABORT_IF_FALSE(mTracker->GetImage(), "OnStartContainer callback before we've created our image"); - NS_ABORT_IF_FALSE(image == mTracker->GetImage(), - "OnStartContainer callback from an image we don't own"); - mTracker->RecordStartContainer(image); + mTracker->RecordStartContainer(mTracker->GetImage()); nsTObserverArray::ForwardIterator iter(mTracker->mConsumers); while (iter.HasMore()) { - mTracker->SendStartContainer(iter.GetNext(), image); + mTracker->SendStartContainer(iter.GetNext()); } return NS_OK; } -/* void onStartFrame (in imgIRequest request, in unsigned long frame); */ -NS_IMETHODIMP imgStatusTrackerObserver::OnStartFrame(imgIRequest *request, - uint32_t frame) +/* void onStartFrame (); */ +NS_IMETHODIMP imgStatusTrackerObserver::OnStartFrame() { LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnStartFrame"); NS_ABORT_IF_FALSE(mTracker->GetImage(), "OnStartFrame callback before we've created our image"); - mTracker->RecordStartFrame(frame); + mTracker->RecordStartFrame(); nsTObserverArray::ForwardIterator iter(mTracker->mConsumers); while (iter.HasMore()) { - mTracker->SendStartFrame(iter.GetNext(), frame); + mTracker->SendStartFrame(iter.GetNext()); } return NS_OK; } -/* [noscript] void onDataAvailable (in imgIRequest request, in boolean aCurrentFrame, [const] in nsIntRect rect); */ -NS_IMETHODIMP imgStatusTrackerObserver::OnDataAvailable(imgIRequest *request, - bool aCurrentFrame, - const nsIntRect * rect) +/* [noscript] void onDataAvailable ([const] in nsIntRect rect); */ +NS_IMETHODIMP imgStatusTrackerObserver::OnDataAvailable(const nsIntRect * rect) { LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnDataAvailable"); NS_ABORT_IF_FALSE(mTracker->GetImage(), "OnDataAvailable callback before we've created our image"); - mTracker->RecordDataAvailable(aCurrentFrame, rect); + mTracker->RecordDataAvailable(); nsTObserverArray::ForwardIterator iter(mTracker->mConsumers); while (iter.HasMore()) { - mTracker->SendDataAvailable(iter.GetNext(), aCurrentFrame, rect); + mTracker->SendDataAvailable(iter.GetNext(), rect); } return NS_OK; } -/* void onStopFrame (in imgIRequest request, in unsigned long frame); */ -NS_IMETHODIMP imgStatusTrackerObserver::OnStopFrame(imgIRequest *request, - uint32_t frame) +/* void onStopFrame (); */ +NS_IMETHODIMP imgStatusTrackerObserver::OnStopFrame() { LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnStopFrame"); NS_ABORT_IF_FALSE(mTracker->GetImage(), "OnStopFrame callback before we've created our image"); - mTracker->RecordStopFrame(frame); + mTracker->RecordStopFrame(); nsTObserverArray::ForwardIterator iter(mTracker->mConsumers); while (iter.HasMore()) { - mTracker->SendStopFrame(iter.GetNext(), frame); + mTracker->SendStopFrame(iter.GetNext()); } mTracker->MaybeUnblockOnload(); @@ -186,9 +172,8 @@ FireFailureNotification(imgRequest* aRequest) } } -/* void onStopDecode (in imgIRequest request, in nsresult status, in wstring statusArg); */ -NS_IMETHODIMP imgStatusTrackerObserver::OnStopDecode(imgIRequest *aRequest, - nsresult aStatus) +/* void onStopDecode (in nsresult status); */ +NS_IMETHODIMP imgStatusTrackerObserver::OnStopDecode(nsresult aStatus) { LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnStopDecode"); NS_ABORT_IF_FALSE(mTracker->GetImage(), @@ -218,15 +203,14 @@ NS_IMETHODIMP imgStatusTrackerObserver::OnStopDecode(imgIRequest *aRequest, return NS_OK; } -NS_IMETHODIMP imgStatusTrackerObserver::OnStopRequest(imgIRequest *aRequest, - bool aLastPart) +NS_IMETHODIMP imgStatusTrackerObserver::OnStopRequest(bool aLastPart) { NS_NOTREACHED("imgRequest(imgIDecoderObserver)::OnStopRequest"); return NS_OK; } -/* void onDiscard (in imgIRequest request); */ -NS_IMETHODIMP imgStatusTrackerObserver::OnDiscard(imgIRequest *aRequest) +/* void onDiscard (); */ +NS_IMETHODIMP imgStatusTrackerObserver::OnDiscard() { NS_ABORT_IF_FALSE(mTracker->GetImage(), "OnDiscard callback before we've created our image"); @@ -244,7 +228,7 @@ NS_IMETHODIMP imgStatusTrackerObserver::OnDiscard(imgIRequest *aRequest) return NS_OK; } -NS_IMETHODIMP imgStatusTrackerObserver::OnImageIsAnimated(imgIRequest *aRequest) +NS_IMETHODIMP imgStatusTrackerObserver::OnImageIsAnimated() { NS_ABORT_IF_FALSE(mTracker->GetImage(), "OnImageIsAnimated callback before we've created our image"); @@ -260,16 +244,6 @@ NS_IMETHODIMP imgStatusTrackerObserver::OnImageIsAnimated(imgIRequest *aRequest) // imgStatusTracker methods -static nsresult -GetResultFromImageStatus(uint32_t aStatus) -{ - if (aStatus & imgIRequest::STATUS_ERROR) - return NS_IMAGELIB_ERROR_FAILURE; - if (aStatus & imgIRequest::STATUS_LOAD_COMPLETE) - return NS_IMAGELIB_SUCCESS_LOAD_FINISHED; - return NS_OK; -} - imgStatusTracker::imgStatusTracker(Image* aImage, imgRequest* aRequest) : mImage(aImage), mRequest(aRequest), @@ -444,7 +418,7 @@ imgStatusTracker::SyncNotify(imgRequestProxy* proxy) // OnStartContainer if (mState & stateHasSize) - proxy->OnStartContainer(mImage); + proxy->OnStartContainer(); // OnStartDecode if (mState & stateDecodeStarted) @@ -460,20 +434,17 @@ imgStatusTracker::SyncNotify(imgRequestProxy* proxy) if (imageType == imgIContainer::TYPE_VECTOR || static_cast(mImage)->GetNumFrames() > 0) { - uint32_t frame = (imageType == imgIContainer::TYPE_VECTOR) ? - 0 : static_cast(mImage)->GetCurrentFrameIndex(); - - proxy->OnStartFrame(frame); + proxy->OnStartFrame(); // 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); - proxy->OnDataAvailable(frame, &r); + proxy->OnDataAvailable(&r); if (mState & stateFrameStopped) - proxy->OnStopFrame(frame); + proxy->OnStopFrame(); } // OnImageIsAnimated @@ -501,6 +472,8 @@ imgStatusTracker::EmulateRequestFinished(imgRequestProxy* aProxy, { nsCOMPtr kungFuDeathGrip(aProxy); + // In certain cases the request might not have started yet. + // We still need to fulfill the contract. if (!(mState & stateRequestStarted)) { aProxy->OnStartRequest(); } @@ -520,13 +493,12 @@ imgStatusTracker::AddConsumer(imgRequestProxy* aConsumer) mConsumers.AppendElementUnlessExists(aConsumer); } -// XXX - The two argument should go away. +// XXX - The last argument should go away. bool imgStatusTracker::RemoveConsumer(imgRequestProxy* aConsumer, nsresult aStatus) { // Remove the proxy from the list. bool removed = mConsumers.RemoveElement(aConsumer); - //MOZ_NONFATAL_ASSERT(removed, "Trying to remove a consumer we don't have"); // Consumers can get confused if they don't get all the proper teardown // notifications. Part ways on good terms. @@ -586,14 +558,14 @@ imgStatusTracker::RecordStartContainer(imgIContainer* aContainer) } void -imgStatusTracker::SendStartContainer(imgRequestProxy* aProxy, imgIContainer* aContainer) +imgStatusTracker::SendStartContainer(imgRequestProxy* aProxy) { if (!aProxy->NotificationsDeferred()) - aProxy->OnStartContainer(aContainer); + aProxy->OnStartContainer(); } void -imgStatusTracker::RecordStartFrame(uint32_t aFrame) +imgStatusTracker::RecordStartFrame() { NS_ABORT_IF_FALSE(mImage, "RecordStartFrame called before we have an Image"); // no bookkeeping necessary here - this is implied by imgIContainer's number @@ -601,14 +573,14 @@ imgStatusTracker::RecordStartFrame(uint32_t aFrame) } void -imgStatusTracker::SendStartFrame(imgRequestProxy* aProxy, uint32_t aFrame) +imgStatusTracker::SendStartFrame(imgRequestProxy* aProxy) { if (!aProxy->NotificationsDeferred()) - aProxy->OnStartFrame(aFrame); + aProxy->OnStartFrame(); } void -imgStatusTracker::RecordDataAvailable(bool aCurrentFrame, const nsIntRect* aRect) +imgStatusTracker::RecordDataAvailable() { NS_ABORT_IF_FALSE(mImage, "RecordDataAvailable called before we have an Image"); @@ -617,16 +589,16 @@ imgStatusTracker::RecordDataAvailable(bool aCurrentFrame, const nsIntRect* aRect } void -imgStatusTracker::SendDataAvailable(imgRequestProxy* aProxy, bool aCurrentFrame, - const nsIntRect* aRect) +imgStatusTracker::SendDataAvailable(imgRequestProxy* aProxy, + const nsIntRect* aRect) { if (!aProxy->NotificationsDeferred()) - aProxy->OnDataAvailable(aCurrentFrame, aRect); + aProxy->OnDataAvailable(aRect); } void -imgStatusTracker::RecordStopFrame(uint32_t aFrame) +imgStatusTracker::RecordStopFrame() { NS_ABORT_IF_FALSE(mImage, "RecordStopFrame called before we have an Image"); mState |= stateFrameStopped; @@ -634,10 +606,10 @@ imgStatusTracker::RecordStopFrame(uint32_t aFrame) } void -imgStatusTracker::SendStopFrame(imgRequestProxy* aProxy, uint32_t aFrame) +imgStatusTracker::SendStopFrame(imgRequestProxy* aProxy) { if (!aProxy->NotificationsDeferred()) - aProxy->OnStopFrame(aFrame); + aProxy->OnStopFrame(); } void @@ -655,7 +627,8 @@ imgStatusTracker::RecordStopDecode(nsresult aStatus) } void -imgStatusTracker::SendStopDecode(imgRequestProxy* aProxy, nsresult aStatus) +imgStatusTracker::SendStopDecode(imgRequestProxy* aProxy, + nsresult aStatus) { if (!aProxy->NotificationsDeferred()) aProxy->OnStopDecode(); @@ -703,8 +676,7 @@ imgStatusTracker::SendDiscard(imgRequestProxy* aProxy) /* non-virtual imgIContainerObserver methods */ void -imgStatusTracker::RecordFrameChanged(imgIContainer* aContainer, - const nsIntRect* aDirtyRect) +imgStatusTracker::RecordFrameChanged(const nsIntRect* aDirtyRect) { NS_ABORT_IF_FALSE(mImage, "RecordFrameChanged called before we have an Image"); @@ -713,11 +685,11 @@ imgStatusTracker::RecordFrameChanged(imgIContainer* aContainer, } void -imgStatusTracker::SendFrameChanged(imgRequestProxy* aProxy, imgIContainer* aContainer, +imgStatusTracker::SendFrameChanged(imgRequestProxy* aProxy, const nsIntRect* aDirtyRect) { if (!aProxy->NotificationsDeferred()) - aProxy->FrameChanged(aContainer, aDirtyRect); + aProxy->FrameChanged(aDirtyRect); } /* non-virtual sort-of-nsIRequestObserver methods */ @@ -756,7 +728,8 @@ imgStatusTracker::OnStartRequest() } void -imgStatusTracker::RecordStopRequest(bool aLastPart, nsresult aStatus) +imgStatusTracker::RecordStopRequest(bool aLastPart, + nsresult aStatus) { mHadLastPart = aLastPart; mState |= stateRequestStopped; @@ -769,7 +742,9 @@ imgStatusTracker::RecordStopRequest(bool aLastPart, nsresult aStatus) } void -imgStatusTracker::SendStopRequest(imgRequestProxy* aProxy, bool aLastPart, nsresult aStatus) +imgStatusTracker::SendStopRequest(imgRequestProxy* aProxy, + bool aLastPart, + nsresult aStatus) { if (!aProxy->NotificationsDeferred()) { aProxy->OnStopRequest(aLastPart); @@ -777,7 +752,8 @@ imgStatusTracker::SendStopRequest(imgRequestProxy* aProxy, bool aLastPart, nsres } void -imgStatusTracker::OnStopRequest(bool aLastPart, nsresult aStatus) +imgStatusTracker::OnStopRequest(bool aLastPart, + nsresult aStatus) { bool preexistingError = mImageStatus == imgIRequest::STATUS_ERROR; diff --git a/image/src/imgStatusTracker.h b/image/src/imgStatusTracker.h index 70fa96939e6..f99867de987 100644 --- a/image/src/imgStatusTracker.h +++ b/image/src/imgStatusTracker.h @@ -152,13 +152,13 @@ public: void RecordStartDecode(); void SendStartDecode(imgRequestProxy* aProxy); void RecordStartContainer(imgIContainer* aContainer); - void SendStartContainer(imgRequestProxy* aProxy, imgIContainer* aContainer); - void RecordStartFrame(uint32_t aFrame); - void SendStartFrame(imgRequestProxy* aProxy, uint32_t aFrame); - void RecordDataAvailable(bool aCurrentFrame, const nsIntRect* aRect); - void SendDataAvailable(imgRequestProxy* aProxy, bool aCurrentFrame, const nsIntRect* aRect); - void RecordStopFrame(uint32_t aFrame); - void SendStopFrame(imgRequestProxy* aProxy, uint32_t aFrame); + void SendStartContainer(imgRequestProxy* aProxy); + void RecordStartFrame(); + void SendStartFrame(imgRequestProxy* aProxy); + void RecordDataAvailable(); + void SendDataAvailable(imgRequestProxy* aProxy, const nsIntRect* aRect); + void RecordStopFrame(); + void SendStopFrame(imgRequestProxy* aProxy); void RecordStopDecode(nsresult statusg); void SendStopDecode(imgRequestProxy* aProxy, nsresult aStatus); void RecordDiscard(); @@ -167,10 +167,8 @@ public: void SendImageIsAnimated(imgRequestProxy *aProxy); /* non-virtual imgIContainerObserver methods */ - void RecordFrameChanged(imgIContainer* aContainer, - const nsIntRect* aDirtyRect); - void SendFrameChanged(imgRequestProxy* aProxy, imgIContainer* aContainer, - const nsIntRect* aDirtyRect); + void RecordFrameChanged(const nsIntRect* aDirtyRect); + void SendFrameChanged(imgRequestProxy* aProxy, const nsIntRect* aDirtyRect); /* non-virtual sort-of-nsIRequestObserver methods */ void RecordStartRequest();