Bug 716140 - Merge imgIContainerObserver and imgIDecoderObserver since they aren't used in different places any more. r=jrmuizel

This commit is contained in:
Joe Drew 2012-12-18 11:37:15 -05:00
parent 3fbaeacc95
commit d49d3e14e7
16 changed files with 36 additions and 82 deletions

View File

@ -15,7 +15,6 @@
#include "nsIInputStream.h"
#include "RasterImage.h"
#include "imgIContainerObserver.h"
namespace mozilla {
namespace image {

View File

@ -42,7 +42,6 @@ mailing address.
#include "nsGIFDecoder2.h"
#include "nsIInputStream.h"
#include "imgIContainerObserver.h"
#include "RasterImage.h"
#include "gfxColor.h"

View File

@ -14,7 +14,6 @@
#include "nsIInputStream.h"
#include "nsIComponentManager.h"
#include "RasterImage.h"
#include "imgIContainerObserver.h"
#include "nsIProperties.h"
#include "nsISupportsPrimitives.h"

View File

@ -7,7 +7,6 @@
#include "nsIconDecoder.h"
#include "nsIInputStream.h"
#include "RasterImage.h"
#include "imgIContainerObserver.h"
#include "nspr.h"
#include "nsRect.h"

View File

@ -7,8 +7,6 @@
#include "ImageLogging.h"
#include "nsJPEGDecoder.h"
#include "imgIContainerObserver.h"
#include "nsIInputStream.h"
#include "nspr.h"

View File

@ -13,7 +13,6 @@
#include "nsIInputStream.h"
#include "RasterImage.h"
#include "imgIContainerObserver.h"
#include "gfxColor.h"
#include "nsColor.h"

View File

@ -19,7 +19,6 @@ XPIDLSRCS = \
imgICache.idl \
imgIContainer.idl \
imgIContainerDebug.idl \
imgIContainerObserver.idl \
imgIDecoderObserver.idl \
imgIEncoder.idl \
imgILoader.idl \

View File

@ -1,26 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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/. */
#include "nsISupports.idl"
%{C++
#include "nsRect.h"
%}
interface imgIRequest;
[ptr] native nsIntRect(nsIntRect);
/**
* imgIContainerObserver interface
*
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.1
*/
[scriptable, uuid(f4aaf410-e88f-4036-b91c-610c9c11d825)]
interface imgIContainerObserver : nsISupports
{
[noscript] void frameChanged([const] in nsIntRect aDirtyRect);
};

View File

@ -4,15 +4,14 @@
* 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/. */
#include "imgIContainerObserver.idl"
interface imgIRequest;
interface imgIContainer;
#include "nsISupports.idl"
%{C++
#include "nsRect.h"
%}
[ptr] native nsIntRect(nsIntRect);
/**
* imgIDecoderObserver interface
*
@ -43,8 +42,8 @@ interface imgIContainer;
* @version 0.1
* @see imagelib2
*/
[scriptable, uuid(0089cf0c-210c-4b44-9ab0-8099b32bcf64)]
interface imgIDecoderObserver : imgIContainerObserver
[scriptable, uuid(eb9f4145-247e-44f5-961d-50da7d08fba7)]
interface imgIDecoderObserver : nsISupports
{
/**
* Load notification.
@ -81,6 +80,8 @@ interface imgIDecoderObserver : imgIContainerObserver
*/
[noscript] void onDataAvailable([const] in nsIntRect aRect);
[noscript] void frameChanged([const] in nsIntRect aDirtyRect);
/**
* Decode notification.
*

View File

@ -6,7 +6,7 @@
#include "base/histogram.h"
#include "ImageLogging.h"
#include "nsComponentManagerUtils.h"
#include "imgIContainerObserver.h"
#include "imgIDecoderObserver.h"
#include "nsError.h"
#include "Decoder.h"
#include "imgIDecoderObserver.h"
@ -638,7 +638,7 @@ RasterImage::RequestRefresh(const mozilla::TimeStamp& aTime)
}
if (frameAdvanced) {
nsCOMPtr<imgIContainerObserver> observer(do_QueryReferent(mObserver));
nsCOMPtr<imgIDecoderObserver> observer(do_QueryReferent(mObserver));
if (!observer) {
NS_ERROR("Refreshing image after its imgRequest is gone");
@ -1660,7 +1660,7 @@ RasterImage::ResetAnimation()
// we fix bug 500402.
// Update display if we were animating before
nsCOMPtr<imgIContainerObserver> observer(do_QueryReferent(mObserver));
nsCOMPtr<imgIDecoderObserver> observer(do_QueryReferent(mObserver));
if (mAnimating && observer)
observer->FrameChanged(&(mAnim->firstFrameRefreshArea));
@ -2912,7 +2912,7 @@ RasterImage::ScalingDone(ScaleRequest* request, ScaleStatus status)
if (status == SCALE_DONE) {
MOZ_ASSERT(request->done);
nsCOMPtr<imgIContainerObserver> observer(do_QueryReferent(mObserver));
nsCOMPtr<imgIDecoderObserver> observer(do_QueryReferent(mObserver));
if (observer) {
imgFrame *scaledFrame = request->dstFrame.get();
scaledFrame->ImageUpdated(scaledFrame->GetRect());

View File

@ -40,7 +40,6 @@
#endif
class imgIDecoder;
class imgIContainerObserver;
class nsIInputStream;
#define NS_RASTERIMAGE_CID \

View File

@ -751,14 +751,10 @@ VectorImage::InvalidateObserver()
if (!mObserver)
return;
nsCOMPtr<imgIContainerObserver> containerObs(do_QueryReferent(mObserver));
if (containerObs) {
containerObs->FrameChanged(&nsIntRect::GetMaxSizedIntRect());
}
nsCOMPtr<imgIDecoderObserver> decoderObs(do_QueryReferent(mObserver));
if (decoderObs) {
decoderObs->OnStopFrame();
nsCOMPtr<imgIDecoderObserver> obs(do_QueryReferent(mObserver));
if (obs) {
obs->FrameChanged(&nsIntRect::GetMaxSizedIntRect());
obs->OnStopFrame();
}
}

View File

@ -9,6 +9,7 @@
#include "imgRequest.h"
#include "imgIContainer.h"
#include "imgRequestProxy.h"
#include "imgIDecoderObserver.h"
#include "Image.h"
#include "ImageLogging.h"
#include "RasterImage.h"
@ -26,7 +27,6 @@ class imgStatusTrackerObserver : public imgIDecoderObserver,
public:
NS_DECL_ISUPPORTS
NS_DECL_IMGIDECODEROBSERVER
NS_DECL_IMGICONTAINEROBSERVER
imgStatusTrackerObserver(imgStatusTracker* aTracker)
: mTracker(aTracker) {}
@ -41,30 +41,10 @@ private:
imgStatusTracker* mTracker;
};
NS_IMPL_ISUPPORTS3(imgStatusTrackerObserver,
NS_IMPL_ISUPPORTS2(imgStatusTrackerObserver,
imgIDecoderObserver,
imgIContainerObserver,
nsISupportsWeakReference)
/** imgIContainerObserver methods **/
/* [noscript] void frameChanged (in nsIntRect dirtyRect); */
NS_IMETHODIMP imgStatusTrackerObserver::FrameChanged(const nsIntRect *dirtyRect)
{
LOG_SCOPE(GetImgLog(), "imgStatusTrackerObserver::FrameChanged");
NS_ABORT_IF_FALSE(mTracker->GetImage(),
"FrameChanged callback before we've created our image");
mTracker->RecordFrameChanged(dirtyRect);
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
while (iter.HasMore()) {
mTracker->SendFrameChanged(iter.GetNext(), dirtyRect);
}
return NS_OK;
}
/** imgIDecoderObserver methods **/
NS_IMETHODIMP imgStatusTrackerObserver::OnStartDecode()
@ -137,6 +117,23 @@ NS_IMETHODIMP imgStatusTrackerObserver::OnDataAvailable(const nsIntRect * rect)
return NS_OK;
}
/* [noscript] void frameChanged (in nsIntRect dirtyRect); */
NS_IMETHODIMP imgStatusTrackerObserver::FrameChanged(const nsIntRect *dirtyRect)
{
LOG_SCOPE(GetImgLog(), "imgStatusTrackerObserver::FrameChanged");
NS_ABORT_IF_FALSE(mTracker->GetImage(),
"FrameChanged callback before we've created our image");
mTracker->RecordFrameChanged(dirtyRect);
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
while (iter.HasMore()) {
mTracker->SendFrameChanged(iter.GetNext(), dirtyRect);
}
return NS_OK;
}
/* void onStopFrame (); */
NS_IMETHODIMP imgStatusTrackerObserver::OnStopFrame()
{
@ -639,7 +636,6 @@ imgStatusTracker::SendDiscard(imgRequestProxy* aProxy)
aProxy->OnDiscard();
}
/* non-virtual imgIContainerObserver methods */
void
imgStatusTracker::RecordFrameChanged(const nsIntRect* aDirtyRect)
{

View File

@ -132,6 +132,8 @@ public:
void SendStartContainer(imgRequestProxy* aProxy);
void RecordDataAvailable();
void SendDataAvailable(imgRequestProxy* aProxy, const nsIntRect* aRect);
void RecordFrameChanged(const nsIntRect* aDirtyRect);
void SendFrameChanged(imgRequestProxy* aProxy, const nsIntRect* aDirtyRect);
void RecordStopFrame();
void SendStopFrame(imgRequestProxy* aProxy);
void RecordStopDecode(nsresult statusg);
@ -141,10 +143,6 @@ public:
void RecordImageIsAnimated();
void SendImageIsAnimated(imgRequestProxy *aProxy);
/* non-virtual imgIContainerObserver methods */
void RecordFrameChanged(const nsIntRect* aDirtyRect);
void SendFrameChanged(imgRequestProxy* aProxy, const nsIntRect* aDirtyRect);
/* non-virtual sort-of-nsIRequestObserver methods */
void RecordStartRequest();
void SendStartRequest(imgRequestProxy* aProxy);

View File

@ -13,7 +13,6 @@
#include "imgIContainer.h"
#include "imgIEncoder.h"
#include "imgIDecoderObserver.h"
#include "imgIContainerObserver.h"
#include "gfxContext.h"
#include "nsStringStream.h"
#include "nsComponentManagerUtils.h"

View File

@ -52,7 +52,6 @@
#include "nsITheme.h"
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "imgIContainerObserver.h"
#include "imgILoader.h"
#include "nsINodeInfo.h"
#include "nsContentUtils.h"