Bug 1181323 - Move nsSVGRenderingObserver's isupports/refcounting decl to subclasses, since one subclass (nsSVGFilterReference) already has its own redundant copy of the decl. r=dholbert
authorMichael Layzell <michael@thelayzells.com>
Thu, 09 Jul 2015 20:32:00 +0200
changeset 252459 d4fd9365fdc3980df1b5203ced2ec4f150bee3aa
parent 252458 f4f0cd48a2a8a5b56b6a0f358b4dfbc56f6460a4
child 252460 5422a0e67377b03b79b3a71ec1a20a8b8f4c248a
push id62153
push usercbook@mozilla.com
push dateSat, 11 Jul 2015 12:47:57 +0000
treeherdermozilla-inbound@5422a0e67377 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1181323
milestone42.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 1181323 - Move nsSVGRenderingObserver's isupports/refcounting decl to subclasses, since one subclass (nsSVGFilterReference) already has its own redundant copy of the decl. r=dholbert
image/VectorImage.cpp
layout/svg/nsSVGEffects.cpp
layout/svg/nsSVGEffects.h
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -42,16 +42,18 @@ using namespace dom;
 using namespace gfx;
 using namespace layers;
 
 namespace image {
 
 // Helper-class: SVGRootRenderingObserver
 class SVGRootRenderingObserver final : public nsSVGRenderingObserver {
 public:
+  NS_DECL_ISUPPORTS
+
   SVGRootRenderingObserver(SVGDocumentWrapper* aDocWrapper,
                            VectorImage*        aVectorImage)
     : nsSVGRenderingObserver()
     , mDocWrapper(aDocWrapper)
     , mVectorImage(aVectorImage)
     , mHonoringInvalidations(true)
   {
     MOZ_ASSERT(mDocWrapper, "Need a non-null SVG document wrapper");
@@ -60,27 +62,28 @@ public:
     StartListening();
     Element* elem = GetTarget();
     MOZ_ASSERT(elem, "no root SVG node for us to observe");
 
     nsSVGEffects::AddRenderingObserver(elem, this);
     mInObserverList = true;
   }
 
-  virtual ~SVGRootRenderingObserver()
-  {
-    StopListening();
-  }
 
   void ResumeHonoringInvalidations()
   {
     mHonoringInvalidations = true;
   }
 
 protected:
+  virtual ~SVGRootRenderingObserver()
+  {
+    StopListening();
+  }
+
   virtual Element* GetTarget() override
   {
     return mDocWrapper->GetRootSVGElem();
   }
 
   virtual void DoUpdate() override
   {
     Element* elem = GetTarget();
@@ -108,16 +111,18 @@ protected:
   }
 
   // Private data
   const nsRefPtr<SVGDocumentWrapper> mDocWrapper;
   VectorImage* const mVectorImage;   // Raw pointer because it owns me.
   bool mHonoringInvalidations;
 };
 
+NS_IMPL_ISUPPORTS(SVGRootRenderingObserver, nsIMutationObserver)
+
 class SVGParseCompleteListener final : public nsStubDocumentObserver {
 public:
   NS_DECL_ISUPPORTS
 
   SVGParseCompleteListener(nsIDocument* aDocument,
                            VectorImage* aImage)
     : mDocument(aDocument)
     , mImage(aImage)
--- a/layout/svg/nsSVGEffects.cpp
+++ b/layout/svg/nsSVGEffects.cpp
@@ -16,19 +16,16 @@
 #include "nsSVGMaskFrame.h"
 #include "nsIReflowCallback.h"
 #include "RestyleManager.h"
 #include "nsCycleCollectionParticipant.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-// nsSVGRenderingObserver impl
-NS_IMPL_ISUPPORTS(nsSVGRenderingObserver, nsIMutationObserver)
-
 void
 nsSVGRenderingObserver::StartListening()
 {
   Element* target = GetTarget();
   if (target) {
     target->AddMutationObserver(this);
   }
 }
@@ -214,16 +211,18 @@ nsSVGFrameReferenceFromProperty::Get()
 {
   if (mFramePresShell && mFramePresShell->IsDestroying()) {
     // mFrame is no longer valid.
     Detach();
   }
   return mFrame;
 }
 
+NS_IMPL_ISUPPORTS(nsSVGRenderingObserverProperty, nsIMutationObserver)
+
 void
 nsSVGRenderingObserverProperty::DoUpdate()
 {
   nsSVGIDRenderingObserver::DoUpdate();
 
   nsIFrame* frame = mFrameReference.Get();
   if (frame && frame->IsFrameOfType(nsIFrame::eSVG)) {
     // Changes should propagate out to things that might be observing
--- a/layout/svg/nsSVGEffects.h
+++ b/layout/svg/nsSVGEffects.h
@@ -50,19 +50,16 @@ protected:
     {}
 
 public:
   typedef mozilla::dom::Element Element;
   nsSVGRenderingObserver()
     : mInObserverList(false)
     {}
 
-  // nsISupports
-  NS_DECL_ISUPPORTS
-
   // nsIMutationObserver
   NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
 
   void InvalidateViaReferencedElement();
 
@@ -169,23 +166,27 @@ private:
   // then the frame pointer is not valid and we know the frame has gone away.
   // mFramePresShell may be null, but when mFrame is non-null, mFramePresShell
   // is guaranteed to be non-null, too.
   nsIPresShell *mFramePresShell;
 };
 
 class nsSVGRenderingObserverProperty : public nsSVGIDRenderingObserver {
 public:
+  NS_DECL_ISUPPORTS
+
   nsSVGRenderingObserverProperty(nsIURI* aURI, nsIFrame *aFrame,
                                  bool aReferenceImage)
     : nsSVGIDRenderingObserver(aURI, aFrame->GetContent(), aReferenceImage)
     , mFrameReference(aFrame)
   {}
 
 protected:
+  virtual ~nsSVGRenderingObserverProperty() {}
+
   virtual void DoUpdate() override;
 
   nsSVGFrameReferenceFromProperty mFrameReference;
 };
 
 /**
  * In a filter chain, there can be multiple SVG reference filters.
  * e.g. filter: url(#svg-filter-1) blur(10px) url(#svg-filter-2);