Bug 716140 - Merge imgIContainerObserver and imgIDecoderObserver since they aren't used in different places any more. r=jrmuizel
authorJoe Drew <joe@drew.ca>
Tue, 18 Dec 2012 11:37:15 -0500
changeset 125513 0bcb93a716beaf14ecf13f5312541474252c0b5a
parent 125512 ecf95d9819f0528d2aec9cb119f244e8756b5495
child 125514 3ecf6d05c4e280cf1631e415e58e86c24d1cff23
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs716140
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 716140 - Merge imgIContainerObserver and imgIDecoderObserver since they aren't used in different places any more. r=jrmuizel
image/decoders/nsBMPDecoder.cpp
image/decoders/nsGIFDecoder2.cpp
image/decoders/nsICODecoder.cpp
image/decoders/nsIconDecoder.cpp
image/decoders/nsJPEGDecoder.cpp
image/decoders/nsPNGDecoder.cpp
image/public/Makefile.in
image/public/imgIContainerObserver.idl
image/public/imgIDecoderObserver.idl
image/src/RasterImage.cpp
image/src/RasterImage.h
image/src/VectorImage.cpp
image/src/imgStatusTracker.cpp
image/src/imgStatusTracker.h
image/src/imgTools.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
--- a/image/decoders/nsBMPDecoder.cpp
+++ b/image/decoders/nsBMPDecoder.cpp
@@ -10,17 +10,16 @@
 #include <stdlib.h>
 
 #include "ImageLogging.h"
 #include "EndianMacros.h"
 #include "nsBMPDecoder.h"
 
 #include "nsIInputStream.h"
 #include "RasterImage.h"
-#include "imgIContainerObserver.h"
 
 namespace mozilla {
 namespace image {
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo *
 GetBMPLog()
 {
--- a/image/decoders/nsGIFDecoder2.cpp
+++ b/image/decoders/nsGIFDecoder2.cpp
@@ -37,17 +37,16 @@ organizations who wish to receive copies
 or revised. This service is offered free of charge; please provide us with your
 mailing address.
 */
 
 #include <stddef.h>
 
 #include "nsGIFDecoder2.h"
 #include "nsIInputStream.h"
-#include "imgIContainerObserver.h"
 #include "RasterImage.h"
 
 #include "gfxColor.h"
 #include "gfxPlatform.h"
 #include "qcms.h"
 
 namespace mozilla {
 namespace image {
--- a/image/decoders/nsICODecoder.cpp
+++ b/image/decoders/nsICODecoder.cpp
@@ -9,17 +9,16 @@
 #include <stdlib.h>
 
 #include "EndianMacros.h"
 #include "nsICODecoder.h"
 
 #include "nsIInputStream.h"
 #include "nsIComponentManager.h"
 #include "RasterImage.h"
-#include "imgIContainerObserver.h"
 
 #include "nsIProperties.h"
 #include "nsISupportsPrimitives.h"
 
 namespace mozilla {
 namespace image {
 
 #define ICONCOUNTOFFSET 4
--- a/image/decoders/nsIconDecoder.cpp
+++ b/image/decoders/nsIconDecoder.cpp
@@ -2,17 +2,16 @@
  *
  * 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 "nsIconDecoder.h"
 #include "nsIInputStream.h"
 #include "RasterImage.h"
-#include "imgIContainerObserver.h"
 #include "nspr.h"
 #include "nsRect.h"
 
 #include "nsError.h"
 
 namespace mozilla {
 namespace image {
 
--- a/image/decoders/nsJPEGDecoder.cpp
+++ b/image/decoders/nsJPEGDecoder.cpp
@@ -2,18 +2,16 @@
  *
  * 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 "ImageLogging.h"
 #include "nsJPEGDecoder.h"
 
-#include "imgIContainerObserver.h"
-
 #include "nsIInputStream.h"
 
 #include "nspr.h"
 #include "nsCRT.h"
 #include "gfxColor.h"
 
 #include "jerror.h"
 
--- a/image/decoders/nsPNGDecoder.cpp
+++ b/image/decoders/nsPNGDecoder.cpp
@@ -8,17 +8,16 @@
 #include "nsPNGDecoder.h"
 
 #include "nsMemory.h"
 #include "nsRect.h"
 
 #include "nsIInputStream.h"
 
 #include "RasterImage.h"
-#include "imgIContainerObserver.h"
 
 #include "gfxColor.h"
 #include "nsColor.h"
 
 #include "nspr.h"
 #include "png.h"
 
 #include "gfxPlatform.h"
--- a/image/public/Makefile.in
+++ b/image/public/Makefile.in
@@ -14,17 +14,16 @@ MODULE		= imglib2
 GRE_MODULE	= 1
 
 EXPORTS		= ImageLogging.h
 
 XPIDLSRCS	= \
 		imgICache.idl             \
 		imgIContainer.idl         \
 		imgIContainerDebug.idl    \
-		imgIContainerObserver.idl \
 		imgIDecoderObserver.idl   \
 		imgIEncoder.idl           \
 		imgILoader.idl            \
 		imgINotificationObserver.idl \
 		imgIOnloadBlocker.idl     \
 		imgIRequest.idl           \
 		imgIScriptedNotificationObserver.idl \
 		imgITools.idl             \
deleted file mode 100644
--- a/image/public/imgIContainerObserver.idl
+++ /dev/null
@@ -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);
-};
--- a/image/public/imgIDecoderObserver.idl
+++ b/image/public/imgIDecoderObserver.idl
@@ -1,23 +1,22 @@
 /** -*- 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 "imgIContainerObserver.idl"
-
-interface imgIRequest;
-interface imgIContainer;
+#include "nsISupports.idl"
 
 %{C++
 #include "nsRect.h"
 %}
 
+[ptr] native nsIntRect(nsIntRect);
+
 /**
  * imgIDecoderObserver interface
  *
  * This interface is used both for observing imgIDecoder objects and for
  * observing imgIRequest objects.  In the former case, aRequest is
  * always null.
  *
  * We make the distinction here between "load" and "decode" notifications. Load
@@ -38,18 +37,18 @@ interface imgIContainer;
  * all, some, or none of the notifications may fire before the call returns.
  *
  * This interface will be cleaned up in bug 505385.
  *
  * @author Stuart Parmenter <pavlov@netscape.com>
  * @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.
    *
    * called at the same time that nsIRequestObserver::onStartRequest would be
    * (used only for observers of imgIRequest objects, which are nsIRequests,
    * not imgIDecoder objects)
    */
@@ -76,16 +75,18 @@ interface imgIDecoderObserver : imgICont
 
   /**
    * Decode notification.
    *
    * called when there is more to paint.
    */
   [noscript] void onDataAvailable([const] in nsIntRect aRect);
 
+  [noscript] void frameChanged([const] in nsIntRect aDirtyRect);
+
   /**
    * Decode notification.
    *
    * called when a frame is finished decoding.
    */
   void onStopFrame();
 
   /**
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -1,17 +1,17 @@
 /* -*- 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 "base/histogram.h"
 #include "ImageLogging.h"
 #include "nsComponentManagerUtils.h"
-#include "imgIContainerObserver.h"
+#include "imgIDecoderObserver.h"
 #include "nsError.h"
 #include "Decoder.h"
 #include "imgIDecoderObserver.h"
 #include "RasterImage.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsAutoPtr.h"
 #include "nsStringStream.h"
@@ -633,17 +633,17 @@ RasterImage::RequestRefresh(const mozill
     // then we need to break out of this loop & wait for the frame(s)
     // to finish downloading
     if (!frameAdvanced && (currentFrameEndTime == oldFrameEndTime)) {
       break;
     }
   }
 
   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");
       StopAnimation();
       return;
     }
 
     // Notify listeners that our frame has actually changed, but do this only
@@ -1655,17 +1655,17 @@ RasterImage::ResetAnimation()
   mAnim->lastCompositedFrameIndex = -1;
   mAnim->currentAnimationFrameIndex = 0;
   UpdateImageContainer();
 
   // Note - We probably want to kick off a redecode somewhere around here when
   // 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));
 
   if (ShouldAnimate()) {
     StartAnimation();
     // The animation may not have been running before, if mAnimationFinished
     // was false (before we changed it to true in this function). So, mark the
     // animation as running.
@@ -2907,17 +2907,17 @@ void
 RasterImage::ScalingDone(ScaleRequest* request, ScaleStatus status)
 {
   MOZ_ASSERT(status == SCALE_DONE || status == SCALE_INVALID);
   MOZ_ASSERT(request);
 
   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());
       observer->FrameChanged(&request->srcRect);
     }
 
     mScaleResult.status = SCALE_DONE;
     mScaleResult.frame = request->dstFrame;
--- a/image/src/RasterImage.h
+++ b/image/src/RasterImage.h
@@ -35,17 +35,16 @@
 #include "mozilla/StaticPtr.h"
 #include "mozilla/WeakPtr.h"
 #include "gfx2DGlue.h"
 #ifdef DEBUG
   #include "imgIContainerDebug.h"
 #endif
 
 class imgIDecoder;
-class imgIContainerObserver;
 class nsIInputStream;
 
 #define NS_RASTERIMAGE_CID \
 { /* 376ff2c1-9bf6-418a-b143-3340c00112f7 */         \
      0x376ff2c1,                                     \
      0x9bf6,                                         \
      0x418a,                                         \
     {0xb1, 0x43, 0x33, 0x40, 0xc0, 0x01, 0x12, 0xf7} \
--- a/image/src/VectorImage.cpp
+++ b/image/src/VectorImage.cpp
@@ -746,21 +746,17 @@ VectorImage::OnDataAvailable(nsIRequest*
 // Invalidation helper method
 
 void
 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();
   }
 }
 
 } // namespace image
 } // namespace mozilla
--- a/image/src/imgStatusTracker.cpp
+++ b/image/src/imgStatusTracker.cpp
@@ -4,16 +4,17 @@
  * 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 "imgStatusTracker.h"
 
 #include "imgRequest.h"
 #include "imgIContainer.h"
 #include "imgRequestProxy.h"
+#include "imgIDecoderObserver.h"
 #include "Image.h"
 #include "ImageLogging.h"
 #include "RasterImage.h"
 #include "nsIObserverService.h"
 
 #include "mozilla/Util.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Services.h"
@@ -21,55 +22,34 @@
 using namespace mozilla::image;
 
 class imgStatusTrackerObserver : public imgIDecoderObserver,
                                  public nsSupportsWeakReference
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_IMGIDECODEROBSERVER
-  NS_DECL_IMGICONTAINEROBSERVER
 
   imgStatusTrackerObserver(imgStatusTracker* aTracker)
   : mTracker(aTracker) {}
 
   virtual ~imgStatusTrackerObserver() {}
 
   void SetTracker(imgStatusTracker* aTracker) {
     mTracker = aTracker;
   }
 
 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()
 {
   LOG_SCOPE(GetImgLog(), "imgStatusTrackerObserver::OnStartDecode");
   NS_ABORT_IF_FALSE(mTracker->GetImage(),
                     "OnStartDecode callback before we've created our image");
 
@@ -132,16 +112,33 @@ NS_IMETHODIMP imgStatusTrackerObserver::
   nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
   while (iter.HasMore()) {
     mTracker->SendDataAvailable(iter.GetNext(), 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()
 {
   LOG_SCOPE(GetImgLog(), "imgStatusTrackerObserver::OnStopFrame");
   NS_ABORT_IF_FALSE(mTracker->GetImage(),
                     "OnStopFrame callback before we've created our image");
 
   mTracker->RecordStopFrame();
@@ -634,17 +631,16 @@ imgStatusTracker::RecordImageIsAnimated(
 
 void
 imgStatusTracker::SendDiscard(imgRequestProxy* aProxy)
 {
   if (!aProxy->NotificationsDeferred())
     aProxy->OnDiscard();
 }
 
-/* non-virtual imgIContainerObserver methods */
 void
 imgStatusTracker::RecordFrameChanged(const nsIntRect* aDirtyRect)
 {
   NS_ABORT_IF_FALSE(mImage,
                     "RecordFrameChanged called before we have an Image");
   // no bookkeeping necessary here - this is only for in-frame updates, which we
   // don't fire while we're recording
 }
--- a/image/src/imgStatusTracker.h
+++ b/image/src/imgStatusTracker.h
@@ -127,29 +127,27 @@ public:
   // StartFrame, DataAvailable, StopFrame, StopDecode.
   void RecordDecoded();
 
   /* non-virtual imgIDecoderObserver methods */
   void RecordStartContainer(imgIContainer* aContainer);
   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);
   void SendStopDecode(imgRequestProxy* aProxy, nsresult aStatus);
   void RecordDiscard();
   void SendDiscard(imgRequestProxy* aProxy);
   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);
   void RecordStopRequest(bool aLastPart, nsresult aStatus);
   void SendStopRequest(imgRequestProxy* aProxy, bool aLastPart, nsresult aStatus);
 
   void OnStartRequest();
   void OnDataAvailable();
--- a/image/src/imgTools.cpp
+++ b/image/src/imgTools.cpp
@@ -8,17 +8,16 @@
 #include "nsCOMPtr.h"
 #include "nsString.h"
 #include "nsError.h"
 #include "imgLoader.h"
 #include "imgICache.h"
 #include "imgIContainer.h"
 #include "imgIEncoder.h"
 #include "imgIDecoderObserver.h"
-#include "imgIContainerObserver.h"
 #include "gfxContext.h"
 #include "nsStringStream.h"
 #include "nsComponentManagerUtils.h"
 #include "nsWeakReference.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsStreamUtils.h"
 #include "nsNetUtil.h"
 #include "nsContentUtils.h"
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -47,17 +47,16 @@
 #include "nsNetUtil.h"
 #include "nsBoxLayoutState.h"
 #include "nsTreeContentView.h"
 #include "nsTreeUtils.h"
 #include "nsChildIterator.h"
 #include "nsITheme.h"
 #include "imgIRequest.h"
 #include "imgIContainer.h"
-#include "imgIContainerObserver.h"
 #include "imgILoader.h"
 #include "nsINodeInfo.h"
 #include "nsContentUtils.h"
 #include "nsLayoutUtils.h"
 #include "nsIScrollableFrame.h"
 #include "nsEventDispatcher.h"
 #include "nsDisplayList.h"
 #include "nsTreeBoxObject.h"