Backed out 2 changesets (bug 1613985) for Build bustage on Windows2012. CLOSED TREE
authorDorel Luca <dluca@mozilla.com>
Wed, 19 Feb 2020 22:22:41 +0200
changeset 514640 313ab85e11599283374b61db519f042642f2d6d2
parent 514639 c624db158775aa9d5e7fda124d10e51133c4cc26
child 514641 2bb94accccc0c5187911b24eeb28aaba17b87d37
push id37140
push usermalexandru@mozilla.com
push dateThu, 20 Feb 2020 09:35:08 +0000
treeherdermozilla-central@b532be9d2719 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1613985
milestone75.0a1
backs outfd177b40b56166ff4da725a7238924a59a8ecb86
fb6d62b7f28d16e8d7a856e275978ea9c3020384
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
Backed out 2 changesets (bug 1613985) for Build bustage on Windows2012. CLOSED TREE Backed out changeset fd177b40b561 (bug 1613985) Backed out changeset fb6d62b7f28d (bug 1613985)
accessible/base/AccGroupInfo.h
accessible/generic/DocAccessible.cpp
accessible/ipc/other/ProxyAccessible.h
accessible/ipc/win/ProxyAccessible.h
dom/base/ChildIterator.h
dom/base/DirectionalityUtils.cpp
dom/base/Document.cpp
dom/base/Document.h
dom/base/FullscreenChange.h
dom/base/nsContentUtils.cpp
dom/base/nsFrameMessageManager.h
dom/bindings/NonRefcountedDOMObject.h
dom/canvas/TextMetrics.h
dom/encoding/TextDecoder.h
dom/events/EventDispatcher.cpp
dom/events/PointerEventHandler.h
dom/html/HTMLFormSubmission.h
dom/indexedDB/ActorsParent.cpp
dom/indexedDB/IDBObjectStore.cpp
dom/indexedDB/IDBObjectStore.h
dom/indexedDB/KeyPath.h
dom/ipc/ContentParent.cpp
dom/ipc/ContentProcessManager.h
dom/media/MediaFormatReader.cpp
dom/media/MediaInfo.h
dom/media/MediaSegment.h
dom/media/MediaTrackGraph.h
dom/media/MediaTrackGraphImpl.h
dom/media/VideoFrameConverter.h
dom/media/gmp/GMPTimerParent.h
dom/media/gmp/mozIGeckoMediaPluginService.idl
dom/media/ogg/OggCodecState.h
dom/media/webm/WebMBufferedParser.h
dom/media/webrtc/MediaEngineDefault.cpp
dom/messagechannel/MessagePortService.cpp
dom/plugins/base/nsPluginNativeWindow.h
dom/plugins/ipc/PluginScriptableObjectChild.h
dom/presentation/PresentationServiceBase.h
dom/quota/ActorsParent.cpp
dom/quota/QuotaObject.h
dom/workers/WorkerLocation.h
dom/xslt/base/txCore.h
dom/xslt/xpath/txExpr.h
dom/xslt/xslt/txBufferingHandler.cpp
dom/xslt/xslt/txInstructions.h
dom/xslt/xslt/txStylesheet.h
dom/xslt/xslt/txToplevelItems.h
dom/xslt/xslt/txVariableMap.h
dom/xslt/xslt/txXSLTPatterns.h
editor/libeditor/TypeInState.h
gfx/layers/LayerTreeInvalidation.cpp
gfx/layers/TextureDIB.cpp
gfx/layers/ZoomConstraints.h
gfx/layers/basic/BasicColorLayer.cpp
gfx/layers/basic/BasicImageLayer.cpp
gfx/layers/basic/BasicImplData.h
gfx/layers/basic/BasicLayersImpl.h
gfx/layers/basic/BasicPaintedLayer.h
gfx/layers/client/ClientColorLayer.cpp
gfx/layers/client/ClientContainerLayer.h
gfx/layers/client/ClientLayerManager.h
gfx/layers/client/TextureClient.h
gfx/src/nsRect.h
gfx/thebes/gfxFontInfoLoader.h
gfx/thebes/gfxPlatformFontList.h
gfx/webrender_bindings/WebRenderAPI.cpp
image/FrameAnimator.h
intl/strres/nsStringBundle.cpp
ipc/glue/BackgroundParentImpl.cpp
ipc/glue/WindowsMessageLoop.h
ipc/ipdl/test/cxx/TestSelfManageRoot.h
ipc/ipdl/test/cxx/TestUniquePtrIPC.h
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/xpcprivate.h
layout/base/nsStyleChangeList.h
layout/forms/nsButtonFrameRenderer.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsFieldSetFrame.cpp
layout/forms/nsRangeFrame.cpp
layout/forms/nsSelectsAreaFrame.cpp
layout/generic/nsBulletFrame.cpp
layout/generic/nsCanvasFrame.cpp
layout/generic/nsColumnSetFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrameSelection.h
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsHTMLCanvasFrame.cpp
layout/generic/nsLineBox.h
layout/generic/nsPageFrame.cpp
layout/generic/nsPluginFrame.h
layout/generic/nsVideoFrame.cpp
layout/mathml/nsMathMLChar.cpp
layout/mathml/nsMathMLContainerFrame.cpp
layout/mathml/nsMathMLFrame.cpp
layout/mathml/nsMathMLmencloseFrame.cpp
layout/mathml/nsMathMLmfracFrame.cpp
layout/painting/MaskLayerImageCache.h
layout/painting/TransformClipNode.h
layout/painting/nsDisplayList.h
layout/style/DocumentStyleRootIterator.h
layout/style/Loader.cpp
layout/style/nsStyleStruct.h
layout/svg/SVGGeometryFrame.cpp
layout/svg/SVGObserverUtils.cpp
layout/svg/SVGTextFrame.cpp
layout/svg/nsSVGOuterSVGFrame.cpp
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableFrame.cpp
layout/xul/nsImageBoxFrame.h
layout/xul/nsTextBoxFrame.cpp
layout/xul/nsXULPopupManager.h
layout/xul/tree/nsTreeBodyFrame.cpp
layout/xul/tree/nsTreeColFrame.cpp
media/mtransport/ipc/WebrtcTCPSocket.cpp
media/mtransport/nr_socket_tcp.cpp
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
modules/libpref/Preferences.cpp
netwerk/base/nsURIHashKey.h
netwerk/cache/nsCacheDevice.h
netwerk/cache2/CacheFileChunk.h
netwerk/cache2/CacheFileIOManager.h
netwerk/ipc/ChannelEventQueue.h
netwerk/protocol/http/nsCORSListenerProxy.cpp
netwerk/protocol/websocket/WebSocketChannel.cpp
netwerk/protocol/websocket/WebSocketChannelChild.cpp
tools/profiler/core/RegisteredThread.h
tools/profiler/core/platform-linux-android.cpp
uriloader/base/nsDocLoader.h
widget/BasicEvents.h
widget/TouchEvents.h
xpcom/base/nsISupportsImpl.h
xpcom/build/IOInterposer.cpp
xpcom/ds/nsObserverList.h
xpcom/threads/CondVar.h
xpcom/threads/MozPromise.h
xpcom/threads/Mutex.h
xpcom/threads/TaskDispatcher.h
xpcom/threads/nsThread.cpp
--- a/accessible/base/AccGroupInfo.h
+++ b/accessible/base/AccGroupInfo.h
@@ -10,17 +10,17 @@
 namespace mozilla {
 namespace a11y {
 
 /**
  * Calculate and store group information.
  */
 class AccGroupInfo {
  public:
-  MOZ_COUNTED_DTOR(AccGroupInfo)
+  ~AccGroupInfo() { MOZ_COUNT_DTOR(AccGroupInfo); }
 
   /**
    * Return 1-based position in the group.
    */
   uint32_t PosInSet() const { return mPosInSet; }
 
   /**
    * Return a number of items in the group.
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -1823,17 +1823,17 @@ class InsertIterator final {
         mChildBefore(nullptr),
         mWalker(aContext),
         mNodes(aNodes),
         mNodesIdx(0) {
     MOZ_ASSERT(aContext, "No context");
     MOZ_ASSERT(aNodes, "No nodes to search for accessible elements");
     MOZ_COUNT_CTOR(InsertIterator);
   }
-  MOZ_COUNTED_DTOR(InsertIterator)
+  ~InsertIterator() { MOZ_COUNT_DTOR(InsertIterator); }
 
   Accessible* Context() const { return mWalker.Context(); }
   Accessible* Child() const { return mChild; }
   Accessible* ChildBefore() const { return mChildBefore; }
   DocAccessible* Document() const { return mWalker.Document(); }
 
   /**
    * Iterates to a next accessible within the inserted content.
--- a/accessible/ipc/other/ProxyAccessible.h
+++ b/accessible/ipc/other/ProxyAccessible.h
@@ -24,17 +24,17 @@ class ProxyAccessible : public ProxyAcce
   ProxyAccessible(uint64_t aID, ProxyAccessible* aParent,
                   DocAccessibleParent* aDoc, role aRole, uint32_t aInterfaces)
       : ProxyAccessibleBase(aID, aParent, aDoc, aRole, aInterfaces)
 
   {
     MOZ_COUNT_CTOR(ProxyAccessible);
   }
 
-  MOZ_COUNTED_DTOR(ProxyAccessible)
+  ~ProxyAccessible() { MOZ_COUNT_DTOR(ProxyAccessible); }
 
 #include "mozilla/a11y/ProxyAccessibleShared.h"
 
  protected:
   explicit ProxyAccessible(DocAccessibleParent* aThisAsDoc)
       : ProxyAccessibleBase(aThisAsDoc) {
     MOZ_COUNT_CTOR(ProxyAccessible);
   }
--- a/accessible/ipc/win/ProxyAccessible.h
+++ b/accessible/ipc/win/ProxyAccessible.h
@@ -23,17 +23,17 @@ class ProxyAccessible : public ProxyAcce
  public:
   ProxyAccessible(uint64_t aID, ProxyAccessible* aParent,
                   DocAccessibleParent* aDoc, role aRole, uint32_t aInterfaces)
       : ProxyAccessibleBase(aID, aParent, aDoc, aRole, aInterfaces),
         mSafeToRecurse(true) {
     MOZ_COUNT_CTOR(ProxyAccessible);
   }
 
-  MOZ_COUNTED_DTOR(ProxyAccessible)
+  ~ProxyAccessible() { MOZ_COUNT_DTOR(ProxyAccessible); }
 
 #include "mozilla/a11y/ProxyAccessibleShared.h"
 
   bool GetCOMInterface(void** aOutAccessible) const;
   void SetCOMInterface(const RefPtr<IAccessible>& aIAccessible) {
     if (aIAccessible) {
       mCOMProxy = aIAccessible;
     } else {
--- a/dom/base/ChildIterator.h
+++ b/dom/base/ChildIterator.h
@@ -298,17 +298,17 @@ class MOZ_NEEDS_MEMMOVABLE_MEMBERS Style
     MOZ_COUNT_CTOR(StyleChildrenIterator);
   }
 
   StyleChildrenIterator& operator=(StyleChildrenIterator&& aOther) {
     AllChildrenIterator::operator=(std::move(aOther));
     return *this;
   }
 
-  MOZ_COUNTED_DTOR(StyleChildrenIterator)
+  ~StyleChildrenIterator() { MOZ_COUNT_DTOR(StyleChildrenIterator); }
 
   using AllChildrenIterator::GetNextChild;
   using AllChildrenIterator::GetPreviousChild;
   using AllChildrenIterator::Seek;
 };
 
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/base/DirectionalityUtils.cpp
+++ b/dom/base/DirectionalityUtils.cpp
@@ -503,17 +503,19 @@ class nsTextNodeDirectionalityMap {
       : mElementToBeRemoved(nullptr) {
     MOZ_ASSERT(aTextNode, "Null text node");
     MOZ_COUNT_CTOR(nsTextNodeDirectionalityMap);
     aTextNode->SetProperty(nsGkAtoms::textNodeDirectionalityMap, this,
                            nsTextNodeDirectionalityMapDtor);
     aTextNode->SetHasTextNodeDirectionalityMap();
   }
 
-  MOZ_COUNTED_DTOR(nsTextNodeDirectionalityMap)
+  ~nsTextNodeDirectionalityMap() {
+    MOZ_COUNT_DTOR(nsTextNodeDirectionalityMap);
+  }
 
   static void nsTextNodeDirectionalityMapPropertyDestructor(
       void* aObject, nsAtom* aProperty, void* aPropertyValue, void* aData) {
     nsTextNode* textNode = static_cast<nsTextNode*>(aPropertyValue);
     nsTextNodeDirectionalityMap* map = GetDirectionalityMap(textNode);
     if (map) {
       map->RemoveEntryForProperty(static_cast<Element*>(aObject));
     }
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -12799,18 +12799,18 @@ class FullscreenRoots {
 
   // Removes the root of a specific document from the manager.
   static void Remove(Document* aDoc);
 
   // Returns true if all roots added to the list have been removed.
   static bool IsEmpty();
 
  private:
-  MOZ_COUNTED_DEFAULT_CTOR(FullscreenRoots)
-  MOZ_COUNTED_DTOR(FullscreenRoots)
+  FullscreenRoots() { MOZ_COUNT_CTOR(FullscreenRoots); }
+  ~FullscreenRoots() { MOZ_COUNT_DTOR(FullscreenRoots); }
 
   enum { NotFound = uint32_t(-1) };
   // Looks in mRoots for aRoot. Returns the index if found, otherwise NotFound.
   static uint32_t Find(Document* aRoot);
 
   // Returns true if aRoot is in the list of fullscreen roots.
   static bool Contains(Document* aRoot);
 
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -1594,17 +1594,17 @@ class Document : public nsINode,
       MOZ_COUNT_CTOR(SelectorCacheKey);
     }
 
     nsString mKey;
     nsExpirationState mState;
 
     nsExpirationState* GetExpirationState() { return &mState; }
 
-    MOZ_COUNTED_DTOR(SelectorCacheKey)
+    ~SelectorCacheKey() { MOZ_COUNT_DTOR(SelectorCacheKey); }
   };
 
   class SelectorCacheKeyDeleter;
 
  public:
   class SelectorCache final : public nsExpirationTracker<SelectorCacheKey, 4> {
    public:
     using SelectorList = UniquePtr<RawServoSelectorList>;
--- a/dom/base/FullscreenChange.h
+++ b/dom/base/FullscreenChange.h
@@ -84,17 +84,17 @@ class FullscreenRequest : public Fullscr
         new FullscreenRequest(aElement, promise.forget(), aCallerType, true));
   }
 
   static UniquePtr<FullscreenRequest> CreateForRemote(dom::Element* aElement) {
     return WrapUnique(new FullscreenRequest(aElement, nullptr,
                                             dom::CallerType::NonSystem, false));
   }
 
-  MOZ_COUNTED_DTOR(FullscreenRequest)
+  ~FullscreenRequest() { MOZ_COUNT_DTOR(FullscreenRequest); }
 
   dom::Element* Element() const { return mElement; }
 
   // Reject the fullscreen request with the given reason.
   // It will dispatch the fullscreenerror event.
   void Reject(const char* aReason) {
     if (nsPresContext* presContext = Document()->GetPresContext()) {
       auto pendingEvent = MakeUnique<PendingFullscreenEvent>(
@@ -144,17 +144,17 @@ class FullscreenExit : public Fullscreen
     RefPtr<Promise> promise = Promise::Create(aDoc->GetOwnerGlobal(), aRv);
     return WrapUnique(new FullscreenExit(aDoc, promise.forget()));
   }
 
   static UniquePtr<FullscreenExit> CreateForRemote(dom::Document* aDoc) {
     return WrapUnique(new FullscreenExit(aDoc, nullptr));
   }
 
-  MOZ_COUNTED_DTOR(FullscreenExit)
+  ~FullscreenExit() { MOZ_COUNT_DTOR(FullscreenExit); }
 
  private:
   FullscreenExit(dom::Document* aDoc, already_AddRefed<Promise> aPromise)
       : FullscreenChange(kType, aDoc, std::move(aPromise)) {
     MOZ_COUNT_CTOR(FullscreenExit);
   }
 };
 
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -8281,17 +8281,17 @@ class StringBuilder {
     };
     Type mType;
     uint32_t mLength;
   };
 
  public:
   StringBuilder() : mLast(this), mLength(0) { MOZ_COUNT_CTOR(StringBuilder); }
 
-  MOZ_COUNTED_DTOR(StringBuilder)
+  ~StringBuilder() { MOZ_COUNT_DTOR(StringBuilder); }
 
   void Append(nsAtom* aAtom) {
     Unit* u = AddUnit();
     u->mAtom = aAtom;
     u->mType = Unit::eAtom;
     uint32_t len = aAtom->GetLength();
     u->mLength = len;
     mLength += len;
--- a/dom/base/nsFrameMessageManager.h
+++ b/dom/base/nsFrameMessageManager.h
@@ -397,34 +397,38 @@ class nsSameProcessAsyncMessageBase {
 class nsScriptCacheCleaner;
 
 struct nsMessageManagerScriptHolder {
   nsMessageManagerScriptHolder(JSContext* aCx, JSScript* aScript)
       : mScript(aCx, aScript) {
     MOZ_COUNT_CTOR(nsMessageManagerScriptHolder);
   }
 
-  MOZ_COUNTED_DTOR(nsMessageManagerScriptHolder)
+  ~nsMessageManagerScriptHolder() {
+    MOZ_COUNT_DTOR(nsMessageManagerScriptHolder);
+  }
 
   JS::PersistentRooted<JSScript*> mScript;
 };
 
 class nsMessageManagerScriptExecutor {
  public:
   static void PurgeCache();
   static void Shutdown();
 
   void MarkScopesForCC();
 
  protected:
   friend class nsMessageManagerScriptCx;
   nsMessageManagerScriptExecutor() {
     MOZ_COUNT_CTOR(nsMessageManagerScriptExecutor);
   }
-  MOZ_COUNTED_DTOR(nsMessageManagerScriptExecutor)
+  ~nsMessageManagerScriptExecutor() {
+    MOZ_COUNT_DTOR(nsMessageManagerScriptExecutor);
+  }
 
   void DidCreateScriptLoader();
   void LoadScriptInternal(JS::Handle<JSObject*> aMessageManager,
                           const nsAString& aURL, bool aRunInUniqueScope);
   void TryCacheLoadAndCompileScript(const nsAString& aURL,
                                     bool aRunInUniqueScope, bool aShouldCache,
                                     JS::Handle<JSObject*> aMessageManager,
                                     JS::MutableHandle<JSScript*> aScriptp);
--- a/dom/bindings/NonRefcountedDOMObject.h
+++ b/dom/bindings/NonRefcountedDOMObject.h
@@ -15,19 +15,19 @@ namespace dom {
 // Natives for DOM classes that aren't refcounted need to inherit from this
 // class.
 // If you're seeing objects of this class leak then natives for one of the DOM
 // classes inheriting from it are leaking. If the native for that class has
 // MOZ_COUNT_CTOR/DTOR in its constructor/destructor then it should show up in
 // the leak log too.
 class NonRefcountedDOMObject {
  protected:
-  MOZ_COUNTED_DEFAULT_CTOR(NonRefcountedDOMObject)
+  NonRefcountedDOMObject() { MOZ_COUNT_CTOR(NonRefcountedDOMObject); }
 
-  MOZ_COUNTED_DTOR(NonRefcountedDOMObject)
+  ~NonRefcountedDOMObject() { MOZ_COUNT_DTOR(NonRefcountedDOMObject); }
 
   NonRefcountedDOMObject(const NonRefcountedDOMObject& aOther)
       : NonRefcountedDOMObject() {}
 
   NonRefcountedDOMObject& operator=(const NonRefcountedDOMObject& aOther) {
     NonRefcountedDOMObject();
     return *this;
   }
--- a/dom/canvas/TextMetrics.h
+++ b/dom/canvas/TextMetrics.h
@@ -32,17 +32,17 @@ class TextMetrics final : public NonRefc
         emHeightAscent(aEmHeightAscent),
         emHeightDescent(aEmHeightDescent),
         hangingBaseline(aHangingBaseline),
         alphabeticBaseline(aAlphabeticBaseline),
         ideographicBaseline(aIdeographicBaseline) {
     MOZ_COUNT_CTOR(TextMetrics);
   }
 
-  MOZ_COUNTED_DTOR(TextMetrics)
+  ~TextMetrics() { MOZ_COUNT_DTOR(TextMetrics); }
 
   double Width() const { return width; }
 
   double ActualBoundingBoxLeft() const { return actualBoundingBoxLeft; }
 
   double ActualBoundingBoxRight() const { return actualBoundingBoxRight; }
 
   // y-direction
--- a/dom/encoding/TextDecoder.h
+++ b/dom/encoding/TextDecoder.h
@@ -35,17 +35,17 @@ class TextDecoder final : public NonRefc
     }
     return txtDecoder.forget();
   }
 
   TextDecoder() : mFatal(false), mIgnoreBOM(false) {
     MOZ_COUNT_CTOR(TextDecoder);
   }
 
-  MOZ_COUNTED_DTOR(TextDecoder)
+  ~TextDecoder() { MOZ_COUNT_DTOR(TextDecoder); }
 
   bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
                   JS::MutableHandle<JSObject*> aReflector) {
     return TextDecoder_Binding::Wrap(aCx, this, aGivenProto, aReflector);
   }
 
   /**
    * Validates provided label and throws an exception if invalid label.
--- a/dom/events/EventDispatcher.cpp
+++ b/dom/events/EventDispatcher.cpp
@@ -130,17 +130,17 @@ static bool IsEventTargetChrome(EventTar
 // EventTargetChainItem represents a single item in the event target chain.
 class EventTargetChainItem {
  public:
   explicit EventTargetChainItem(EventTarget* aTarget)
       : mTarget(aTarget), mItemFlags(0) {
     MOZ_COUNT_CTOR(EventTargetChainItem);
   }
 
-  MOZ_COUNTED_DTOR(EventTargetChainItem)
+  ~EventTargetChainItem() { MOZ_COUNT_DTOR(EventTargetChainItem); }
 
   static EventTargetChainItem* Create(nsTArray<EventTargetChainItem>& aChain,
                                       EventTarget* aTarget,
                                       EventTargetChainItem* aChild = nullptr) {
     // The last item which can handle the event must be aChild.
     MOZ_ASSERT(GetLastCanHandleEventTarget(aChain) == aChild);
     MOZ_ASSERT(!aTarget || aTarget == aTarget->GetTargetForEventTargetChain());
     EventTargetChainItem* etci = aChain.AppendElement(aTarget);
--- a/dom/events/PointerEventHandler.h
+++ b/dom/events/PointerEventHandler.h
@@ -23,17 +23,17 @@ class PointerCaptureInfo final {
   nsCOMPtr<nsIContent> mPendingContent;
   nsCOMPtr<nsIContent> mOverrideContent;
 
   explicit PointerCaptureInfo(nsIContent* aPendingContent)
       : mPendingContent(aPendingContent) {
     MOZ_COUNT_CTOR(PointerCaptureInfo);
   }
 
-  MOZ_COUNTED_DTOR(PointerCaptureInfo)
+  ~PointerCaptureInfo() { MOZ_COUNT_DTOR(PointerCaptureInfo); }
 
   bool Empty() { return !(mPendingContent || mOverrideContent); }
 };
 
 class PointerEventHandler final {
  public:
   // Called in PresShell::Initialize to initialize pointer event related
   // preferences.
--- a/dom/html/HTMLFormSubmission.h
+++ b/dom/html/HTMLFormSubmission.h
@@ -40,17 +40,17 @@ class HTMLFormSubmission {
    * @param aSubmitter the submitter element (can be null)
    * @param aFormSubmission the form submission object (out param)
    */
   static nsresult GetFromForm(HTMLFormElement* aForm,
                               nsGenericHTMLElement* aSubmitter,
                               NotNull<const Encoding*>& aEncoding,
                               HTMLFormSubmission** aFormSubmission);
 
-  MOZ_COUNTED_DTOR_VIRTUAL(HTMLFormSubmission)
+  virtual ~HTMLFormSubmission() { MOZ_COUNT_DTOR(HTMLFormSubmission); }
 
   /**
    * Submit a name/value pair
    *
    * @param aName the name of the parameter
    * @param aValue the value of the parameter
    */
   virtual nsresult AddNameValuePair(const nsAString& aName,
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -527,17 +527,17 @@ struct IndexDataValue final {
         mPosition(aPosition),
         mLocaleAwarePosition(aLocaleAwarePosition),
         mUnique(aUnique) {
     MOZ_ASSERT(!aPosition.IsUnset());
 
     MOZ_COUNT_CTOR(IndexDataValue);
   }
 
-  MOZ_COUNTED_DTOR(IndexDataValue)
+  ~IndexDataValue() { MOZ_COUNT_DTOR(IndexDataValue); }
 
   bool operator==(const IndexDataValue& aOther) const {
     if (mIndexId != aOther.mIndexId) {
       return false;
     }
     if (mLocaleAwarePosition.IsUnset()) {
       return mPosition == aOther.mPosition;
     }
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -109,17 +109,17 @@ struct IDBObjectStore::StructuredCloneWr
     MOZ_ASSERT(mDatabase);
 
     MOZ_COUNT_CTOR(StructuredCloneWriteInfo);
 
     mFiles.SwapElements(aCloneWriteInfo.mFiles);
     aCloneWriteInfo.mOffsetToKeyProp = 0;
   }
 
-  MOZ_COUNTED_DTOR(StructuredCloneWriteInfo)
+  ~StructuredCloneWriteInfo() { MOZ_COUNT_DTOR(StructuredCloneWriteInfo); }
 };
 
 // Used by ValueWrapper::Clone to hold strong references to any blob-like
 // objects through the clone process.  This is necessary because:
 // - The structured clone process may trigger content code via getters/other
 //   which can potentially cause existing strong references to be dropped,
 //   necessitating the clone to hold its own strong references.
 // - The structured clone can abort partway through, so it's necessary to track
@@ -130,59 +130,59 @@ struct IDBObjectStore::StructuredCloneIn
 };
 
 namespace {
 
 struct MOZ_STACK_CLASS MutableFileData final {
   nsString type;
   nsString name;
 
-  MOZ_COUNTED_DEFAULT_CTOR(MutableFileData)
-
-  MOZ_COUNTED_DTOR(MutableFileData)
+  MutableFileData() { MOZ_COUNT_CTOR(MutableFileData); }
+
+  ~MutableFileData() { MOZ_COUNT_DTOR(MutableFileData); }
 };
 
 struct MOZ_STACK_CLASS BlobOrFileData final {
   uint32_t tag;
   uint64_t size;
   nsString type;
   nsString name;
   int64_t lastModifiedDate;
 
   BlobOrFileData() : tag(0), size(0), lastModifiedDate(INT64_MAX) {
     MOZ_COUNT_CTOR(BlobOrFileData);
   }
 
-  MOZ_COUNTED_DTOR(BlobOrFileData)
+  ~BlobOrFileData() { MOZ_COUNT_DTOR(BlobOrFileData); }
 };
 
 struct MOZ_STACK_CLASS WasmModuleData final {
   uint32_t bytecodeIndex;
   uint32_t compiledIndex;
   uint32_t flags;
 
   explicit WasmModuleData(uint32_t aFlags)
       : bytecodeIndex(0), compiledIndex(0), flags(aFlags) {
     MOZ_COUNT_CTOR(WasmModuleData);
   }
 
-  MOZ_COUNTED_DTOR(WasmModuleData)
+  ~WasmModuleData() { MOZ_COUNT_DTOR(WasmModuleData); }
 };
 
 struct MOZ_STACK_CLASS GetAddInfoClosure final {
   IDBObjectStore::StructuredCloneWriteInfo& mCloneWriteInfo;
   JS::Handle<JS::Value> mValue;
 
   GetAddInfoClosure(IDBObjectStore::StructuredCloneWriteInfo& aCloneWriteInfo,
                     JS::Handle<JS::Value> aValue)
       : mCloneWriteInfo(aCloneWriteInfo), mValue(aValue) {
     MOZ_COUNT_CTOR(GetAddInfoClosure);
   }
 
-  MOZ_COUNTED_DTOR(GetAddInfoClosure)
+  ~GetAddInfoClosure() { MOZ_COUNT_DTOR(GetAddInfoClosure); }
 };
 
 RefPtr<IDBRequest> GenerateRequest(JSContext* aCx,
                                    IDBObjectStore* aObjectStore) {
   MOZ_ASSERT(aObjectStore);
   aObjectStore->AssertIsOnOwningThread();
 
   IDBTransaction* const transaction = aObjectStore->Transaction();
--- a/dom/indexedDB/IDBObjectStore.h
+++ b/dom/indexedDB/IDBObjectStore.h
@@ -83,17 +83,17 @@ class IDBObjectStore final : public nsIS
     bool mCloned;
 
    public:
     ValueWrapper(JSContext* aCx, JS::Handle<JS::Value> aValue)
         : mValue(aCx, aValue), mCloned(false) {
       MOZ_COUNT_CTOR(IDBObjectStore::ValueWrapper);
     }
 
-    MOZ_COUNTED_DTOR_NESTED(ValueWrapper, IDBObjectStore::ValueWrapper)
+    ~ValueWrapper() { MOZ_COUNT_DTOR(IDBObjectStore::ValueWrapper); }
 
     const JS::Rooted<JS::Value>& Value() const { return mValue; }
 
     bool Clone(JSContext* aCx);
   };
 
   static MOZ_MUST_USE RefPtr<IDBObjectStore> Create(
       IDBTransaction* aTransaction, const ObjectStoreSpec& aSpec);
--- a/dom/indexedDB/KeyPath.h
+++ b/dom/indexedDB/KeyPath.h
@@ -37,17 +37,17 @@ class KeyPath {
 
   explicit KeyPath(int aDummy) : mType(NONEXISTENT) { MOZ_COUNT_CTOR(KeyPath); }
 
   KeyPath(const KeyPath& aOther) {
     MOZ_COUNT_CTOR(KeyPath);
     *this = aOther;
   }
 
-  MOZ_COUNTED_DTOR(KeyPath)
+  ~KeyPath() { MOZ_COUNT_DTOR(KeyPath); }
 
   static nsresult Parse(const nsAString& aString, KeyPath* aKeyPath);
 
   static nsresult Parse(const Sequence<nsString>& aStrings, KeyPath* aKeyPath);
 
   static nsresult Parse(const Nullable<OwningStringOrStringSequence>& aValue,
                         KeyPath* aKeyPath);
 
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -351,17 +351,17 @@ extern FileDescriptor CreateAudioIPCConn
 namespace dom {
 
 #define NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC "ipc:network:set-offline"
 #define NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC "ipc:network:set-connectivity"
 
 // IPC receiver for remote GC/CC logging.
 class CycleCollectWithLogsParent final : public PCycleCollectWithLogsParent {
  public:
-  MOZ_COUNTED_DTOR(CycleCollectWithLogsParent)
+  ~CycleCollectWithLogsParent() { MOZ_COUNT_DTOR(CycleCollectWithLogsParent); }
 
   static bool AllocAndSendConstructor(ContentParent* aManager,
                                       bool aDumpAllTraces,
                                       nsICycleCollectorLogSink* aSink,
                                       nsIDumpGCAndCCLogsCallback* aCallback) {
     CycleCollectWithLogsParent* actor;
     FILE* gcLog;
     FILE* ccLog;
--- a/dom/ipc/ContentProcessManager.h
+++ b/dom/ipc/ContentProcessManager.h
@@ -15,17 +15,17 @@
 
 namespace mozilla {
 namespace dom {
 class ContentParent;
 
 class ContentProcessManager final {
  public:
   static ContentProcessManager* GetSingleton();
-  MOZ_COUNTED_DTOR(ContentProcessManager);
+  ~ContentProcessManager() { MOZ_COUNT_DTOR(ContentProcessManager); };
 
   /**
    * Add a new content process into the map.
    */
   void AddContentProcess(ContentParent* aChildCp);
 
   /**
    * Remove the content process by id.
@@ -78,15 +78,15 @@ class ContentProcessManager final {
       const ContentParentId& aChildCpId, const TabId& aChildTabId);
 
  private:
   static StaticAutoPtr<ContentProcessManager> sSingleton;
 
   nsDataHashtable<nsUint64HashKey, ContentParent*> mContentParentMap;
   nsDataHashtable<nsUint64HashKey, BrowserParent*> mBrowserParentMap;
 
-  MOZ_COUNTED_DEFAULT_CTOR(ContentProcessManager);
+  ContentProcessManager() { MOZ_COUNT_CTOR(ContentProcessManager); };
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_ContentProcessManager_h
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -448,17 +448,17 @@ class MediaFormatReader::DemuxerProxy {
   explicit DemuxerProxy(MediaDataDemuxer* aDemuxer)
       : mTaskQueue(
             new TaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER),
                           "DemuxerProxy::mTaskQueue")),
         mData(new Data(aDemuxer)) {
     MOZ_COUNT_CTOR(DemuxerProxy);
   }
 
-  MOZ_COUNTED_DTOR(DemuxerProxy)
+  ~DemuxerProxy() { MOZ_COUNT_DTOR(DemuxerProxy); }
 
   RefPtr<ShutdownPromise> Shutdown() {
     RefPtr<Data> data = std::move(mData);
     return InvokeAsync(mTaskQueue, __func__, [data]() {
       // We need to clear our reference to the demuxer now. So that in the event
       // the init promise wasn't resolved, such as what can happen with the
       // mediasource demuxer that is waiting on more data, it will force the
       // init promise to be rejected.
--- a/dom/media/MediaInfo.h
+++ b/dom/media/MediaInfo.h
@@ -97,17 +97,17 @@ class TrackInfo {
   bool IsVideo() const { return !!GetAsVideoInfo(); }
   bool IsText() const { return !!GetAsTextInfo(); }
   TrackType GetType() const { return mType; }
 
   bool virtual IsValid() const = 0;
 
   virtual UniquePtr<TrackInfo> Clone() const = 0;
 
-  MOZ_COUNTED_DTOR_VIRTUAL(TrackInfo)
+  virtual ~TrackInfo() { MOZ_COUNT_DTOR(TrackInfo); }
 
  protected:
   TrackInfo(const TrackInfo& aOther) {
     mId = aOther.mId;
     mKind = aOther.mKind;
     mLabel = aOther.mLabel;
     mLanguage = aOther.mLanguage;
     mEnabled = aOther.mEnabled;
--- a/dom/media/MediaSegment.h
+++ b/dom/media/MediaSegment.h
@@ -94,17 +94,17 @@ const size_t DEFAULT_SEGMENT_CAPACITY = 
  * for audio or "no video frame" for video), which can be efficiently
  * represented. This is used for padding.
  */
 class MediaSegment {
  public:
   MediaSegment(const MediaSegment&) = delete;
   MediaSegment& operator=(const MediaSegment&) = delete;
 
-  MOZ_COUNTED_DTOR_VIRTUAL(MediaSegment)
+  virtual ~MediaSegment() { MOZ_COUNT_DTOR(MediaSegment); }
 
   enum Type { AUDIO, VIDEO, TYPE_COUNT };
 
   /**
    * Gets the total duration of the segment.
    */
   TrackTime GetDuration() const { return mDuration; }
   Type GetType() const { return mType; }
--- a/dom/media/MediaTrackGraph.h
+++ b/dom/media/MediaTrackGraph.h
@@ -783,17 +783,17 @@ class MediaInputPort final {
         mDest(aDest),
         mInputNumber(aInputNumber),
         mOutputNumber(aOutputNumber),
         mGraph(nullptr) {
     MOZ_COUNT_CTOR(MediaInputPort);
   }
 
   // Private destructor, to discourage deletion outside of Release():
-  MOZ_COUNTED_DTOR(MediaInputPort)
+  ~MediaInputPort() { MOZ_COUNT_DTOR(MediaInputPort); }
 
  public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaInputPort)
 
   // Called on graph manager thread
   // Do not call these from outside MediaTrackGraph.cpp!
   void Init();
   // Called during message processing to trigger removal of this track.
@@ -1129,17 +1129,17 @@ class MediaTrackGraph {
    * completed.  Some tracks may have performed processing beyond this time.
    */
   GraphTime ProcessedTime() const;
 
  protected:
   explicit MediaTrackGraph(TrackRate aSampleRate) : mSampleRate(aSampleRate) {
     MOZ_COUNT_CTOR(MediaTrackGraph);
   }
-  MOZ_COUNTED_DTOR_VIRTUAL(MediaTrackGraph)
+  virtual ~MediaTrackGraph() { MOZ_COUNT_DTOR(MediaTrackGraph); }
 
   // Intended only for assertions, either on graph thread or not running (in
   // which case we must be on the main thread).
   virtual bool OnGraphThreadOrNotRunning() const = 0;
   virtual bool OnGraphThread() const = 0;
 
   // Intended only for internal assertions. Main thread only.
   virtual bool Destroyed() const = 0;
--- a/dom/media/MediaTrackGraphImpl.h
+++ b/dom/media/MediaTrackGraphImpl.h
@@ -50,17 +50,17 @@ struct TrackUpdate {
  * always has a weak reference to a particular affected track.
  */
 class ControlMessage {
  public:
   explicit ControlMessage(MediaTrack* aTrack) : mTrack(aTrack) {
     MOZ_COUNT_CTOR(ControlMessage);
   }
   // All these run on the graph thread
-  MOZ_COUNTED_DTOR_VIRTUAL(ControlMessage)
+  virtual ~ControlMessage() { MOZ_COUNT_DTOR(ControlMessage); }
   // Do the action of this message on the MediaTrackGraph thread. Any actions
   // affecting graph processing should take effect at mProcessedTime.
   // All track data for times < mProcessedTime has already been
   // computed.
   virtual void Run() = 0;
   // RunDuringShutdown() is only relevant to messages generated on the main
   // thread (for AppendMessage()).
   // When we're shutting down the application, most messages are ignored but
--- a/dom/media/VideoFrameConverter.h
+++ b/dom/media/VideoFrameConverter.h
@@ -209,17 +209,17 @@ class VideoFrameConverter {
         // Set the last-img check to indicate reset.
         // -2 is not a guaranteed invalid serial. See bug 1262134.
         return -2;
       }
       return mImage->GetSerial();
     }
   };
 
-  MOZ_COUNTED_DTOR_VIRTUAL(VideoFrameConverter)
+  virtual ~VideoFrameConverter() { MOZ_COUNT_DTOR(VideoFrameConverter); }
 
   static void SameFrameTick(nsITimer* aTimer, void* aClosure) {
     MOZ_ASSERT(aClosure);
     VideoFrameConverter* self = static_cast<VideoFrameConverter*>(aClosure);
     MOZ_ASSERT(self->mTaskQueue->IsCurrentThreadIn());
 
     if (!self->mLastFrameConverted) {
       return;
--- a/dom/media/gmp/GMPTimerParent.h
+++ b/dom/media/gmp/GMPTimerParent.h
@@ -32,17 +32,17 @@ class GMPTimerParent : public PGMPTimerP
 
  private:
   ~GMPTimerParent() {}
 
   static void GMPTimerExpired(nsITimer* aTimer, void* aClosure);
 
   struct Context {
     Context() : mId(0) { MOZ_COUNT_CTOR(Context); }
-    MOZ_COUNTED_DTOR(Context)
+    ~Context() { MOZ_COUNT_DTOR(Context); }
     nsCOMPtr<nsITimer> mTimer;
     RefPtr<GMPTimerParent>
         mParent;  // Note: live timers keep the GMPTimerParent alive.
     uint32_t mId;
   };
 
   void TimerExpired(Context* aContext);
 
--- a/dom/media/gmp/mozIGeckoMediaPluginService.idl
+++ b/dom/media/gmp/mozIGeckoMediaPluginService.idl
@@ -36,18 +36,18 @@ public:
   virtual void Done(T*, GMPVideoHost*) = 0;
 };
 typedef GMPGetterCallback<GMPDecryptorProxy> GetGMPDecryptorCallback;
 typedef GMPVideoGetterCallback<GMPVideoDecoderProxy> GetGMPVideoDecoderCallback;
 typedef GMPVideoGetterCallback<GMPVideoEncoderProxy> GetGMPVideoEncoderCallback;
 class GetNodeIdCallback
 {
 public:
-  MOZ_COUNTED_DEFAULT_CTOR(GetNodeIdCallback)
-  MOZ_COUNTED_DTOR_VIRTUAL(GetNodeIdCallback)
+  GetNodeIdCallback() { MOZ_COUNT_CTOR(GetNodeIdCallback); }
+  virtual ~GetNodeIdCallback() { MOZ_COUNT_DTOR(GetNodeIdCallback); }
   virtual void Done(nsresult aResult, const nsACString& aNodeId) = 0;
 };
 %}
 
 [ptr] native TagArray(nsTArray<nsCString>);
 native GetGMPDecryptorCallback(mozilla::UniquePtr<GetGMPDecryptorCallback>&&);
 native GetGMPVideoDecoderCallback(mozilla::UniquePtr<GetGMPVideoDecoderCallback>&&);
 native GetGMPVideoEncoderCallback(mozilla::UniquePtr<GetGMPVideoEncoderCallback>&&);
--- a/dom/media/ogg/OggCodecState.h
+++ b/dom/media/ogg/OggCodecState.h
@@ -541,17 +541,17 @@ class SkeletonState : public OggCodecSta
   // stream.
   class nsKeyFrameIndex {
    public:
     nsKeyFrameIndex(int64_t aStartTime, int64_t aEndTime)
         : mStartTime(aStartTime), mEndTime(aEndTime) {
       MOZ_COUNT_CTOR(nsKeyFrameIndex);
     }
 
-    MOZ_COUNTED_DTOR(nsKeyFrameIndex)
+    ~nsKeyFrameIndex() { MOZ_COUNT_DTOR(nsKeyFrameIndex); }
 
     void Add(int64_t aOffset, int64_t aTimeMs) {
       mKeyPoints.AppendElement(nsKeyPoint(aOffset, aTimeMs));
     }
 
     const nsKeyPoint& Get(uint32_t aIndex) const { return mKeyPoints[aIndex]; }
 
     uint32_t Length() const { return mKeyPoints.Length(); }
--- a/dom/media/webm/WebMBufferedParser.h
+++ b/dom/media/webm/WebMBufferedParser.h
@@ -290,17 +290,17 @@ class WebMBufferedState final {
   // Returns start time
   bool GetStartTime(uint64_t* aTime);
 
   // Returns keyframe for time
   bool GetNextKeyframeTime(uint64_t aTime, uint64_t* aKeyframeTime);
 
  private:
   // Private destructor, to discourage deletion outside of Release():
-  MOZ_COUNTED_DTOR(WebMBufferedState)
+  ~WebMBufferedState() { MOZ_COUNT_DTOR(WebMBufferedState); }
 
   // Synchronizes access to the mTimeMapping array and mLastBlockOffset.
   ReentrantMonitor mReentrantMonitor;
 
   // Sorted (by offset) map of data offsets to timecodes.  Populated
   // on the main thread as data is received and parsed by WebMBufferedParsers.
   nsTArray<WebMTimeDataOffset> mTimeMapping;
   // The last complete block parsed. -1 if not set.
--- a/dom/media/webrtc/MediaEngineDefault.cpp
+++ b/dom/media/webrtc/MediaEngineDefault.cpp
@@ -359,17 +359,17 @@ class AudioSourcePullListener : public M
                           uint32_t aFrequency)
       : mTrack(std::move(aTrack)),
         mPrincipalHandle(aPrincipalHandle),
         mSineGenerator(
             MakeUnique<SineWaveGenerator>(mTrack->mSampleRate, aFrequency)) {
     MOZ_COUNT_CTOR(AudioSourcePullListener);
   }
 
-  MOZ_COUNTED_DTOR(AudioSourcePullListener)
+  ~AudioSourcePullListener() { MOZ_COUNT_DTOR(AudioSourcePullListener); }
 
   void NotifyPull(MediaTrackGraph* aGraph, TrackTime aEndOfAppendedData,
                   TrackTime aDesiredTime) override;
 
   const RefPtr<SourceMediaTrack> mTrack;
   const PrincipalHandle mPrincipalHandle;
   const UniquePtr<SineWaveGenerator> mSineGenerator;
 };
--- a/dom/messagechannel/MessagePortService.cpp
+++ b/dom/messagechannel/MessagePortService.cpp
@@ -56,17 +56,17 @@ class MessagePortService::MessagePortSer
         mWaitingForNewParent(true),
         mNextStepCloseAll(false) {
     MOZ_COUNT_CTOR(MessagePortServiceData);
   }
 
   MessagePortServiceData(const MessagePortServiceData& aOther) = delete;
   MessagePortServiceData& operator=(const MessagePortServiceData&) = delete;
 
-  MOZ_COUNTED_DTOR(MessagePortServiceData)
+  ~MessagePortServiceData() { MOZ_COUNT_DTOR(MessagePortServiceData); }
 
   nsID mDestinationUUID;
 
   uint32_t mSequenceID;
   CheckedUnsafePtr<MessagePortParent> mParent;
 
   FallibleTArray<NextParent> mNextParents;
   FallibleTArray<RefPtr<SharedMessageBody>> mMessages;
--- a/dom/plugins/base/nsPluginNativeWindow.h
+++ b/dom/plugins/base/nsPluginNativeWindow.h
@@ -15,17 +15,17 @@
 
 /**
  * base class for native plugin window implementations
  */
 class nsPluginNativeWindow : public NPWindow {
  public:
   nsPluginNativeWindow() : NPWindow() { MOZ_COUNT_CTOR(nsPluginNativeWindow); }
 
-  MOZ_COUNTED_DTOR_VIRTUAL(nsPluginNativeWindow)
+  virtual ~nsPluginNativeWindow() { MOZ_COUNT_DTOR(nsPluginNativeWindow); }
 
   /**
    *   !!! CAUTION !!!
    *
    * The base class |nsPluginWindow| is defined as a struct in nsplugindefs.h,
    * thus it does not have a destructor of its own.
    * One should never attempt to delete |nsPluginNativeWindow| object instance
    * (or derivatives) using a pointer of |nsPluginWindow *| type. Should such
--- a/dom/plugins/ipc/PluginScriptableObjectChild.h
+++ b/dom/plugins/ipc/PluginScriptableObjectChild.h
@@ -20,17 +20,17 @@ namespace plugins {
 class PluginInstanceChild;
 class PluginScriptableObjectChild;
 
 struct ChildNPObject : NPObject {
   ChildNPObject() : NPObject(), parent(nullptr), invalidated(false) {
     MOZ_COUNT_CTOR(ChildNPObject);
   }
 
-  MOZ_COUNTED_DTOR(ChildNPObject)
+  ~ChildNPObject() { MOZ_COUNT_DTOR(ChildNPObject); }
 
   // |parent| is always valid as long as the actor is alive. Once the actor is
   // destroyed this will be set to null.
   PluginScriptableObjectChild* parent;
   bool invalidated;
 };
 
 class PluginScriptableObjectChild : public PPluginScriptableObjectChild {
@@ -138,17 +138,17 @@ class PluginScriptableObjectChild : publ
       return mRefCnt;
     }
 
     explicit StoredIdentifier(const nsCString& aIdentifier)
         : mIdentifier(aIdentifier), mRefCnt(), mPermanent(false) {
       MOZ_COUNT_CTOR(StoredIdentifier);
     }
 
-    MOZ_COUNTED_DTOR(StoredIdentifier)
+    ~StoredIdentifier() { MOZ_COUNT_DTOR(StoredIdentifier); }
   };
 
  public:
   class MOZ_STACK_CLASS StackIdentifier {
    public:
     explicit StackIdentifier(const PluginIdentifier& aIdentifier);
     explicit StackIdentifier(NPIdentifier aIdentifier);
     ~StackIdentifier();
--- a/dom/presentation/PresentationServiceBase.h
+++ b/dom/presentation/PresentationServiceBase.h
@@ -43,17 +43,17 @@ class PresentationServiceBase {
     }
   }
 
  protected:
   class SessionIdManager final {
    public:
     explicit SessionIdManager() { MOZ_COUNT_CTOR(SessionIdManager); }
 
-    MOZ_COUNTED_DTOR(SessionIdManager)
+    ~SessionIdManager() { MOZ_COUNT_DTOR(SessionIdManager); }
 
     nsresult GetWindowId(const nsAString& aSessionId, uint64_t* aWindowId) {
       MOZ_ASSERT(NS_IsMainThread());
 
       if (mRespondingWindowIds.Get(aSessionId, aWindowId)) {
         return NS_OK;
       }
       return NS_ERROR_NOT_AVAILABLE;
@@ -121,17 +121,17 @@ class PresentationServiceBase {
     nsClassHashtable<nsUint64HashKey, nsTArray<nsString>> mRespondingSessionIds;
     nsDataHashtable<nsStringHashKey, uint64_t> mRespondingWindowIds;
   };
 
   class AvailabilityManager final {
    public:
     explicit AvailabilityManager() { MOZ_COUNT_CTOR(AvailabilityManager); }
 
-    MOZ_COUNTED_DTOR(AvailabilityManager)
+    ~AvailabilityManager() { MOZ_COUNT_DTOR(AvailabilityManager); }
 
     void AddAvailabilityListener(
         const nsTArray<nsString>& aAvailabilityUrls,
         nsIPresentationAvailabilityListener* aListener) {
       nsTArray<nsString> dummy;
       AddAvailabilityListener(aAvailabilityUrls, aListener, dummy);
     }
 
--- a/dom/quota/ActorsParent.cpp
+++ b/dom/quota/ActorsParent.cpp
@@ -990,17 +990,17 @@ class GroupInfo final {
   }
 
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GroupInfo)
 
   PersistenceType GetPersistenceType() const { return mPersistenceType; }
 
  private:
   // Private destructor, to discourage deletion outside of Release():
-  MOZ_COUNTED_DTOR(GroupInfo)
+  ~GroupInfo() { MOZ_COUNT_DTOR(GroupInfo); }
 
   already_AddRefed<OriginInfo> LockedGetOriginInfo(const nsACString& aOrigin);
 
   void LockedAddOriginInfo(OriginInfo* aOriginInfo);
 
   void LockedRemoveOriginInfo(const nsACString& aOrigin);
 
   void LockedRemoveOriginInfos();
@@ -1019,19 +1019,19 @@ class GroupInfo final {
   uint64_t mUsage;
 };
 
 class GroupInfoPair {
   friend class QuotaManager;
   friend class QuotaObject;
 
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(GroupInfoPair)
-
-  MOZ_COUNTED_DTOR(GroupInfoPair)
+  GroupInfoPair() { MOZ_COUNT_CTOR(GroupInfoPair); }
+
+  ~GroupInfoPair() { MOZ_COUNT_DTOR(GroupInfoPair); }
 
  private:
   already_AddRefed<GroupInfo> LockedGetGroupInfo(
       PersistenceType aPersistenceType) {
     AssertCurrentThreadOwnsQuotaMutex();
     MOZ_ASSERT(aPersistenceType != PERSISTENCE_TYPE_PERSISTENT);
 
     RefPtr<GroupInfo> groupInfo =
--- a/dom/quota/QuotaObject.h
+++ b/dom/quota/QuotaObject.h
@@ -47,17 +47,17 @@ class QuotaObject {
         mPath(aPath),
         mSize(aSize),
         mClientType(aClientType),
         mQuotaCheckDisabled(false),
         mWritingDone(false) {
     MOZ_COUNT_CTOR(QuotaObject);
   }
 
-  MOZ_COUNTED_DTOR(QuotaObject)
+  ~QuotaObject() { MOZ_COUNT_DTOR(QuotaObject); }
 
   already_AddRefed<QuotaObject> LockedAddRef() {
     AssertCurrentThreadOwnsQuotaMutex();
 
     ++mRefCnt;
 
     RefPtr<QuotaObject> result = dont_AddRef(this);
     return result.forget();
--- a/dom/workers/WorkerLocation.h
+++ b/dom/workers/WorkerLocation.h
@@ -37,17 +37,17 @@ class WorkerLocation final : public nsWr
         mPort(aPort),
         mPathname(aPathname),
         mSearch(aSearch),
         mHash(aHash),
         mOrigin(aOrigin) {
     MOZ_COUNT_CTOR(WorkerLocation);
   }
 
-  MOZ_COUNTED_DTOR(WorkerLocation)
+  ~WorkerLocation() { MOZ_COUNT_DTOR(WorkerLocation); }
 
  public:
   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WorkerLocation)
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WorkerLocation)
 
   static already_AddRefed<WorkerLocation> Create(
       WorkerPrivate::LocationInfo& aInfo);
 
--- a/dom/xslt/base/txCore.h
+++ b/dom/xslt/base/txCore.h
@@ -8,22 +8,22 @@
 
 #include "nscore.h"
 #include "nsDebug.h"
 #include "nsISupportsImpl.h"
 #include "nsStringFwd.h"
 
 class txObject {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(txObject)
+  txObject() { MOZ_COUNT_CTOR(txObject); }
 
   /**
    * Deletes this txObject
    */
-  MOZ_COUNTED_DTOR_VIRTUAL(txObject)
+  virtual ~txObject() { MOZ_COUNT_DTOR(txObject); }
 };
 
 /**
  * Utility class for doubles
  */
 class txDouble {
  public:
   /**
--- a/dom/xslt/xpath/txExpr.h
+++ b/dom/xslt/xpath/txExpr.h
@@ -30,18 +30,18 @@ class txNodeSet;
 class txXPathNode;
 class txXPathTreeWalker;
 
 /**
  * A Base Class for all XSL Expressions
  **/
 class Expr {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(Expr)
-  MOZ_COUNTED_DTOR_VIRTUAL(Expr)
+  Expr() { MOZ_COUNT_CTOR(Expr); }
+  virtual ~Expr() { MOZ_COUNT_DTOR(Expr); }
 
   /**
    * Evaluates this Expr based on the given context node and processor state
    * @param context the context node for evaluation of this Expr
    * @param ps the ContextState containing the stack information needed
    * for evaluation
    * @return the result of the evaluation
    **/
@@ -325,18 +325,18 @@ class txCoreFunctionCall : public Functi
   eType mType;
 };
 
 /*
  * This class represents a NodeTest as defined by the XPath spec
  */
 class txNodeTest {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(txNodeTest)
-  MOZ_COUNTED_DTOR_VIRTUAL(txNodeTest)
+  txNodeTest() { MOZ_COUNT_CTOR(txNodeTest); }
+  virtual ~txNodeTest() { MOZ_COUNT_DTOR(txNodeTest); }
 
   /*
    * Virtual methods
    * pretty much a txPattern, but not supposed to be used
    * standalone. The NodeTest node() is different to the
    * Pattern "node()" (document node isn't matched)
    */
   virtual nsresult matches(const txXPathNode& aNode, txIMatchContext* aContext,
--- a/dom/xslt/xslt/txBufferingHandler.cpp
+++ b/dom/xslt/xslt/txBufferingHandler.cpp
@@ -18,17 +18,17 @@ class txOutputTransaction {
     ePITransaction,
     eStartDocumentTransaction,
     eStartElementAtomTransaction,
     eStartElementTransaction
   };
   explicit txOutputTransaction(txTransactionType aType) : mType(aType) {
     MOZ_COUNT_CTOR(txOutputTransaction);
   }
-  MOZ_COUNTED_DTOR_VIRTUAL(txOutputTransaction)
+  virtual ~txOutputTransaction() { MOZ_COUNT_DTOR(txOutputTransaction); }
   txTransactionType mType;
 };
 
 class txCharacterTransaction : public txOutputTransaction {
  public:
   txCharacterTransaction(txTransactionType aType, uint32_t aLength)
       : txOutputTransaction(aType), mLength(aLength) {
     MOZ_COUNT_CTOR_INHERITED(txCharacterTransaction, txOutputTransaction);
--- a/dom/xslt/xslt/txInstructions.h
+++ b/dom/xslt/xslt/txInstructions.h
@@ -16,19 +16,19 @@
 #include "txXSLTNumber.h"
 #include "nsTArray.h"
 
 class nsAtom;
 class txExecutionState;
 
 class txInstruction : public txObject {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(txInstruction)
+  txInstruction() { MOZ_COUNT_CTOR(txInstruction); }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(txInstruction)
+  virtual ~txInstruction() { MOZ_COUNT_DTOR(txInstruction); }
 
   virtual nsresult execute(txExecutionState& aEs) = 0;
 
   nsAutoPtr<txInstruction> mNext;
 };
 
 #define TX_DECL_TXINSTRUCTION \
   virtual nsresult execute(txExecutionState& aEs) override;
--- a/dom/xslt/xslt/txStylesheet.h
+++ b/dom/xslt/xslt/txStylesheet.h
@@ -170,14 +170,14 @@ class txStripSpaceTest {
   bool mStrips;
 };
 
 /**
  * Value of a global parameter
  */
 class txIGlobalParameter {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(txIGlobalParameter)
-  MOZ_COUNTED_DTOR_VIRTUAL(txIGlobalParameter)
+  txIGlobalParameter() { MOZ_COUNT_CTOR(txIGlobalParameter); }
+  virtual ~txIGlobalParameter() { MOZ_COUNT_DTOR(txIGlobalParameter); }
   virtual nsresult getValue(txAExprResult** aValue) = 0;
 };
 
 #endif  // TX_TXSTYLESHEET_H
--- a/dom/xslt/xslt/txToplevelItems.h
+++ b/dom/xslt/xslt/txToplevelItems.h
@@ -12,18 +12,18 @@
 #include "txStylesheet.h"
 #include "txInstructions.h"
 
 class txPattern;
 class Expr;
 
 class txToplevelItem {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(txToplevelItem)
-  MOZ_COUNTED_DTOR_VIRTUAL(txToplevelItem)
+  txToplevelItem() { MOZ_COUNT_CTOR(txToplevelItem); }
+  virtual ~txToplevelItem() { MOZ_COUNT_DTOR(txToplevelItem); }
 
   enum type {
     attributeSet,
     dummy,
     import,
     // namespaceAlias,
     output,
     stripSpace,  // also used for preserve-space
--- a/dom/xslt/xslt/txVariableMap.h
+++ b/dom/xslt/xslt/txVariableMap.h
@@ -32,17 +32,17 @@ class txVariableMapBase {
 
 /**
  * Map for mapping from expanded name to variable values. This is not
  * refcounted, so owners need to be careful to clean this up.
  */
 class txVariableMap : public txVariableMapBase {
  public:
   txVariableMap() : txVariableMapBase() { MOZ_COUNT_CTOR(txVariableMap); }
-  MOZ_COUNTED_DTOR(txVariableMap)
+  ~txVariableMap() { MOZ_COUNT_DTOR(txVariableMap); }
 };
 
 /**
  * Map for mapping from expanded name to parameter values. This is refcounted,
  * so multiple owners can hold a reference.
  */
 class txParameterMap : public txVariableMapBase {
  public:
--- a/dom/xslt/xslt/txXSLTPatterns.h
+++ b/dom/xslt/xslt/txXSLTPatterns.h
@@ -8,18 +8,18 @@
 
 #include "mozilla/Attributes.h"
 #include "txExpandedName.h"
 #include "txExpr.h"
 #include "txXMLUtils.h"
 
 class txPattern {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(txPattern)
-  MOZ_COUNTED_DTOR_VIRTUAL(txPattern)
+  txPattern() { MOZ_COUNT_CTOR(txPattern); }
+  virtual ~txPattern() { MOZ_COUNT_DTOR(txPattern); }
 
   /*
    * Determines whether this Pattern matches the given node.
    */
   virtual nsresult matches(const txXPathNode& aNode, txIMatchContext* aContext,
                            bool& aMatched) = 0;
 
   /*
--- a/editor/libeditor/TypeInState.h
+++ b/editor/libeditor/TypeInState.h
@@ -36,17 +36,17 @@ struct PropItem {
 
   PropItem() : tag(nullptr), attr(nullptr) { MOZ_COUNT_CTOR(PropItem); }
   PropItem(nsAtom* aTag, nsAtom* aAttr, const nsAString& aValue)
       : tag(aTag),
         attr(aAttr != nsGkAtoms::_empty ? aAttr : nullptr),
         value(aValue) {
     MOZ_COUNT_CTOR(PropItem);
   }
-  MOZ_COUNTED_DTOR(PropItem)
+  ~PropItem() { MOZ_COUNT_DTOR(PropItem); }
 };
 
 class StyleCache final {
  public:
   StyleCache() = delete;
   StyleCache(nsStaticAtom* aTag, nsStaticAtom* aAttribute,
              const nsAString& aValue)
       : mTag(aTag), mAttribute(aAttribute), mValue(aValue) {
--- a/gfx/layers/LayerTreeInvalidation.cpp
+++ b/gfx/layers/LayerTreeInvalidation.cpp
@@ -207,17 +207,17 @@ struct LayerPropertiesBase : public Laye
       : mLayer(nullptr),
         mMaskLayer(nullptr),
         mPostXScale(0.0),
         mPostYScale(0.0),
         mOpacity(0.0),
         mUseClipRect(false) {
     MOZ_COUNT_CTOR(LayerPropertiesBase);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(LayerPropertiesBase)
+  virtual ~LayerPropertiesBase() { MOZ_COUNT_DTOR(LayerPropertiesBase); }
 
  protected:
   LayerPropertiesBase(const LayerPropertiesBase& a) = delete;
   LayerPropertiesBase& operator=(const LayerPropertiesBase& a) = delete;
 
  public:
   bool ComputeDifferences(Layer* aRoot, nsIntRegion& aOutRegion,
                           NotifySubDocInvalidationFunc aCallback) override;
--- a/gfx/layers/TextureDIB.cpp
+++ b/gfx/layers/TextureDIB.cpp
@@ -39,17 +39,17 @@ class MemoryDIBTextureData : public DIBT
   }
 
   MemoryDIBTextureData(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
                        gfxWindowsSurface* aSurface)
       : DIBTextureData(aSize, aFormat, aSurface) {
     MOZ_COUNT_CTOR(MemoryDIBTextureData);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(MemoryDIBTextureData)
+  virtual ~MemoryDIBTextureData() { MOZ_COUNT_DTOR(MemoryDIBTextureData); }
 };
 
 /**
  * Can only be drawn into through Cairo.
  * The coresponding TextureHost depends on the compositor
  */
 class ShmemDIBTextureData : public DIBTextureData {
  public:
--- a/gfx/layers/ZoomConstraints.h
+++ b/gfx/layers/ZoomConstraints.h
@@ -37,17 +37,17 @@ struct ZoomConstraints {
   ZoomConstraints(const ZoomConstraints& other)
       : mAllowZoom(other.mAllowZoom),
         mAllowDoubleTapZoom(other.mAllowDoubleTapZoom),
         mMinZoom(other.mMinZoom),
         mMaxZoom(other.mMaxZoom) {
     MOZ_COUNT_CTOR(ZoomConstraints);
   }
 
-  MOZ_COUNTED_DTOR(ZoomConstraints)
+  ~ZoomConstraints() { MOZ_COUNT_DTOR(ZoomConstraints); }
 
   bool operator==(const ZoomConstraints& other) const {
     return mAllowZoom == other.mAllowZoom &&
            mAllowDoubleTapZoom == other.mAllowDoubleTapZoom &&
            mMinZoom == other.mMinZoom && mMaxZoom == other.mMaxZoom;
   }
 
   bool operator!=(const ZoomConstraints& other) const {
--- a/gfx/layers/basic/BasicColorLayer.cpp
+++ b/gfx/layers/basic/BasicColorLayer.cpp
@@ -27,17 +27,17 @@ namespace layers {
 class BasicColorLayer : public ColorLayer, public BasicImplData {
  public:
   explicit BasicColorLayer(BasicLayerManager* aLayerManager)
       : ColorLayer(aLayerManager, static_cast<BasicImplData*>(this)) {
     MOZ_COUNT_CTOR(BasicColorLayer);
   }
 
  protected:
-  MOZ_COUNTED_DTOR_OVERRIDE(BasicColorLayer)
+  virtual ~BasicColorLayer() { MOZ_COUNT_DTOR(BasicColorLayer); }
 
  public:
   void SetVisibleRegion(const LayerIntRegion& aRegion) override {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     ColorLayer::SetVisibleRegion(aRegion);
   }
 
--- a/gfx/layers/basic/BasicImageLayer.cpp
+++ b/gfx/layers/basic/BasicImageLayer.cpp
@@ -26,17 +26,17 @@ class BasicImageLayer : public ImageLaye
  public:
   explicit BasicImageLayer(BasicLayerManager* aLayerManager)
       : ImageLayer(aLayerManager, static_cast<BasicImplData*>(this)),
         mSize(-1, -1) {
     MOZ_COUNT_CTOR(BasicImageLayer);
   }
 
  protected:
-  MOZ_COUNTED_DTOR_OVERRIDE(BasicImageLayer)
+  virtual ~BasicImageLayer() { MOZ_COUNT_DTOR(BasicImageLayer); }
 
  public:
   void SetVisibleRegion(const LayerIntRegion& aRegion) override {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     ImageLayer::SetVisibleRegion(aRegion);
   }
 
--- a/gfx/layers/basic/BasicImplData.h
+++ b/gfx/layers/basic/BasicImplData.h
@@ -44,17 +44,17 @@ class BasicImplData {
  public:
   BasicImplData()
       : mHidden(false),
         mClipToVisibleRegion(false),
         mDrawAtomically(false),
         mOperator(gfx::CompositionOp::OP_OVER) {
     MOZ_COUNT_CTOR(BasicImplData);
   }
-  MOZ_COUNTED_DTOR_VIRTUAL(BasicImplData)
+  virtual ~BasicImplData() { MOZ_COUNT_DTOR(BasicImplData); }
 
   /**
    * Layers that paint themselves, such as ImageLayers, should paint
    * in response to this method call. aContext will already have been
    * set up to account for all the properties of the layer (transform,
    * opacity, etc).
    */
   virtual void Paint(gfx::DrawTarget* aDT, const gfx::Point& aDeviceOffset,
--- a/gfx/layers/basic/BasicLayersImpl.h
+++ b/gfx/layers/basic/BasicLayersImpl.h
@@ -50,17 +50,17 @@ class AutoSetOperator {
 class BasicReadbackLayer : public ReadbackLayer, public BasicImplData {
  public:
   explicit BasicReadbackLayer(BasicLayerManager* aLayerManager)
       : ReadbackLayer(aLayerManager, static_cast<BasicImplData*>(this)) {
     MOZ_COUNT_CTOR(BasicReadbackLayer);
   }
 
  protected:
-  MOZ_COUNTED_DTOR_OVERRIDE(BasicReadbackLayer)
+  virtual ~BasicReadbackLayer() { MOZ_COUNT_DTOR(BasicReadbackLayer); }
 
  public:
   void SetVisibleRegion(const LayerIntRegion& aRegion) override {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     ReadbackLayer::SetVisibleRegion(aRegion);
   }
 
--- a/gfx/layers/basic/BasicPaintedLayer.h
+++ b/gfx/layers/basic/BasicPaintedLayer.h
@@ -34,17 +34,17 @@ class BasicPaintedLayer : public Painted
   BasicPaintedLayer(BasicLayerManager* aLayerManager, gfx::BackendType aBackend)
       : PaintedLayer(aLayerManager, static_cast<BasicImplData*>(this)),
         mContentClient(nullptr),
         mBackend(aBackend) {
     MOZ_COUNT_CTOR(BasicPaintedLayer);
   }
 
  protected:
-  MOZ_COUNTED_DTOR_OVERRIDE(BasicPaintedLayer)
+  virtual ~BasicPaintedLayer() { MOZ_COUNT_DTOR(BasicPaintedLayer); }
 
  public:
   void SetVisibleRegion(const LayerIntRegion& aRegion) override {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     PaintedLayer::SetVisibleRegion(aRegion);
   }
   void InvalidateRegion(const nsIntRegion& aRegion) override {
--- a/gfx/layers/client/ClientColorLayer.cpp
+++ b/gfx/layers/client/ClientColorLayer.cpp
@@ -21,17 +21,17 @@ using namespace mozilla::gfx;
 class ClientColorLayer : public ColorLayer, public ClientLayer {
  public:
   explicit ClientColorLayer(ClientLayerManager* aLayerManager)
       : ColorLayer(aLayerManager, static_cast<ClientLayer*>(this)) {
     MOZ_COUNT_CTOR(ClientColorLayer);
   }
 
  protected:
-  MOZ_COUNTED_DTOR_OVERRIDE(ClientColorLayer)
+  virtual ~ClientColorLayer() { MOZ_COUNT_DTOR(ClientColorLayer); }
 
  public:
   void SetVisibleRegion(const LayerIntRegion& aRegion) override {
     NS_ASSERTION(ClientManager()->InConstruction(),
                  "Can only set properties in construction phase");
     ColorLayer::SetVisibleRegion(aRegion);
   }
 
--- a/gfx/layers/client/ClientContainerLayer.h
+++ b/gfx/layers/client/ClientContainerLayer.h
@@ -132,17 +132,17 @@ class ClientContainerLayer : public Cont
 class ClientRefLayer : public RefLayer, public ClientLayer {
  public:
   explicit ClientRefLayer(ClientLayerManager* aManager)
       : RefLayer(aManager, static_cast<ClientLayer*>(this)) {
     MOZ_COUNT_CTOR(ClientRefLayer);
   }
 
  protected:
-  MOZ_COUNTED_DTOR_OVERRIDE(ClientRefLayer)
+  virtual ~ClientRefLayer() { MOZ_COUNT_DTOR(ClientRefLayer); }
 
  public:
   Layer* AsLayer() override { return this; }
   ShadowableLayer* AsShadowableLayer() override { return this; }
 
   void RenderLayer() override { RenderMaskLayers(this); }
 
   void ComputeEffectiveTransforms(
--- a/gfx/layers/client/ClientLayerManager.h
+++ b/gfx/layers/client/ClientLayerManager.h
@@ -344,17 +344,17 @@ class ClientLayerManager final : public 
 
   nsTArray<DidCompositeObserver*> mDidCompositeObservers;
 
   RefPtr<MemoryPressureObserver> mMemoryPressureObserver;
 };
 
 class ClientLayer : public ShadowableLayer {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(ClientLayer)
+  ClientLayer() { MOZ_COUNT_CTOR(ClientLayer); }
 
   ~ClientLayer();
 
   // Shrink memory usage.
   // Called when "memory-pressure" is observed.
   virtual void HandleMemoryPressure() {}
 
   virtual void RenderLayer() = 0;
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -249,17 +249,17 @@ class TextureData {
                              gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
                              LayersBackend aLayersBackend,
                              int32_t aMaxTextureSize, BackendSelector aSelector,
                              TextureFlags aTextureFlags,
                              TextureAllocationFlags aAllocFlags);
 
   static bool IsRemote(LayersBackend aLayersBackend, BackendSelector aSelector);
 
-  MOZ_COUNTED_DTOR_VIRTUAL(TextureData)
+  virtual ~TextureData() { MOZ_COUNT_DTOR(TextureData); }
 
   virtual void FillInfo(TextureData::Info& aInfo) const = 0;
 
   virtual bool Lock(OpenMode aMode) = 0;
 
   virtual void Unlock() = 0;
 
   virtual already_AddRefed<gfx::DrawTarget> BorrowDrawTarget() {
@@ -308,17 +308,17 @@ class TextureData {
   virtual DXGIYCbCrTextureData* AsDXGIYCbCrTextureData() { return nullptr; }
 #endif
 
   virtual BufferTextureData* AsBufferTextureData() { return nullptr; }
 
   virtual GPUVideoTextureData* AsGPUVideoTextureData() { return nullptr; }
 
  protected:
-  MOZ_COUNTED_DEFAULT_CTOR(TextureData)
+  TextureData() { MOZ_COUNT_CTOR(TextureData); }
 };
 
 /**
  * TextureClient is a thin abstraction over texture data that need to be shared
  * between the content process and the compositor process. It is the
  * content-side half of a TextureClient/TextureHost pair. A corresponding
  * TextureHost lives on the compositor-side.
  *
--- a/gfx/src/nsRect.h
+++ b/gfx/src/nsRect.h
@@ -45,17 +45,19 @@ struct nsRect : public mozilla::gfx::Bas
     MOZ_COUNT_CTOR(nsRect);
   }
   nsRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
       : Super(aX, aY, aWidth, aHeight) {
     MOZ_COUNT_CTOR(nsRect);
   }
   nsRect& operator=(const nsRect&) = default;
 
-  MOZ_COUNTED_DTOR(nsRect)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsRect() { MOZ_COUNT_DTOR(nsRect); }
+#endif
 
   // We have saturating versions of all the Union methods. These avoid
   // overflowing nscoord values in the 'width' and 'height' fields by
   // clamping the width and height values to nscoord_MAX if necessary.
 
   MOZ_MUST_USE nsRect SaturatingUnion(const nsRect& aRect) const {
     if (IsEmpty()) {
       return aRect;
--- a/gfx/thebes/gfxFontInfoLoader.h
+++ b/gfx/thebes/gfxFontInfoLoader.h
@@ -51,17 +51,17 @@ class FontInfoData {
         mLoadOtherNames(aLoadOtherNames),
         mLoadFaceNames(aLoadFaceNames),
         mLoadCmaps(aLoadCmaps) {
     MOZ_COUNT_CTOR(FontInfoData);
   }
 
  protected:
   // Protected destructor, to discourage deletion outside of Release():
-  MOZ_COUNTED_DTOR_VIRTUAL(FontInfoData)
+  virtual ~FontInfoData() { MOZ_COUNT_DTOR(FontInfoData); }
 
  public:
   virtual void Load();
 
   // loads font data for all fonts of a given family
   // (called on async thread)
   virtual void LoadFontFamilyData(const nsACString& aFamilyName) = 0;
 
--- a/gfx/thebes/gfxPlatformFontList.h
+++ b/gfx/thebes/gfxPlatformFontList.h
@@ -40,17 +40,17 @@ class CharMapHashKey : public PLDHashEnt
 
   explicit CharMapHashKey(const gfxCharacterMap* aCharMap)
       : mCharMap(const_cast<gfxCharacterMap*>(aCharMap)) {
     MOZ_COUNT_CTOR(CharMapHashKey);
   }
   CharMapHashKey(const CharMapHashKey& toCopy) : mCharMap(toCopy.mCharMap) {
     MOZ_COUNT_CTOR(CharMapHashKey);
   }
-  MOZ_COUNTED_DTOR(CharMapHashKey)
+  ~CharMapHashKey() { MOZ_COUNT_DTOR(CharMapHashKey); }
 
   gfxCharacterMap* GetKey() const { return mCharMap; }
 
   bool KeyEquals(const gfxCharacterMap* aCharMap) const {
     NS_ASSERTION(!aCharMap->mBuildOnTheFly && !mCharMap->mBuildOnTheFly,
                  "custom cmap used in shared cmap hashtable");
     // cmaps built on the fly never match
     if (aCharMap->mHash != mCharMap->mHash) {
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -48,17 +48,17 @@ class NewRenderer : public RendererEvent
         mBridge(aBridge),
         mCompositorWidget(std::move(aWidget)),
         mTask(aTask),
         mSize(aSize),
         mSyncHandle(aHandle) {
     MOZ_COUNT_CTOR(NewRenderer);
   }
 
-  MOZ_COUNTED_DTOR(NewRenderer)
+  ~NewRenderer() { MOZ_COUNT_DTOR(NewRenderer); }
 
   void Run(RenderThread& aRenderThread, WindowId aWindowId) override {
     layers::AutoCompleteTask complete(mTask);
 
     UniquePtr<RenderCompositor> compositor =
         RenderCompositor::Create(std::move(mCompositorWidget));
     if (!compositor) {
       // RenderCompositor::Create puts a message into gfxCriticalNote if it is
@@ -153,17 +153,17 @@ class NewRenderer : public RendererEvent
 };
 
 class RemoveRenderer : public RendererEvent {
  public:
   explicit RemoveRenderer(layers::SynchronousTask* aTask) : mTask(aTask) {
     MOZ_COUNT_CTOR(RemoveRenderer);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(RemoveRenderer)
+  virtual ~RemoveRenderer() { MOZ_COUNT_DTOR(RemoveRenderer); }
 
   void Run(RenderThread& aRenderThread, WindowId aWindowId) override {
     aRenderThread.RemoveRenderer(aWindowId);
     layers::AutoCompleteTask complete(mTask);
   }
 
  private:
   layers::SynchronousTask* mTask;
@@ -481,17 +481,17 @@ void WebRenderAPI::Readback(const TimeSt
         : mTask(aTask),
           mStartTime(aStartTime),
           mSize(aSize),
           mFormat(aFormat),
           mBuffer(aBuffer) {
       MOZ_COUNT_CTOR(Readback);
     }
 
-    MOZ_COUNTED_DTOR_OVERRIDE(Readback)
+    virtual ~Readback() { MOZ_COUNT_DTOR(Readback); }
 
     void Run(RenderThread& aRenderThread, WindowId aWindowId) override {
       aRenderThread.UpdateAndRender(aWindowId, VsyncId(), mStartTime,
                                     /* aRender */ true, Some(mSize),
                                     wr::SurfaceFormatToImageFormat(mFormat),
                                     Some(mBuffer), false);
       layers::AutoCompleteTask complete(mTask);
     }
@@ -531,17 +531,17 @@ void WebRenderAPI::EnableMultithreading(
 
 void WebRenderAPI::Pause() {
   class PauseEvent : public RendererEvent {
    public:
     explicit PauseEvent(layers::SynchronousTask* aTask) : mTask(aTask) {
       MOZ_COUNT_CTOR(PauseEvent);
     }
 
-    MOZ_COUNTED_DTOR_OVERRIDE(PauseEvent)
+    virtual ~PauseEvent() { MOZ_COUNT_DTOR(PauseEvent); }
 
     void Run(RenderThread& aRenderThread, WindowId aWindowId) override {
       aRenderThread.Pause(aWindowId);
       layers::AutoCompleteTask complete(mTask);
     }
 
     layers::SynchronousTask* mTask;
   };
@@ -559,17 +559,17 @@ void WebRenderAPI::Pause() {
 bool WebRenderAPI::Resume() {
   class ResumeEvent : public RendererEvent {
    public:
     explicit ResumeEvent(layers::SynchronousTask* aTask, bool* aResult)
         : mTask(aTask), mResult(aResult) {
       MOZ_COUNT_CTOR(ResumeEvent);
     }
 
-    MOZ_COUNTED_DTOR_OVERRIDE(ResumeEvent)
+    virtual ~ResumeEvent() { MOZ_COUNT_DTOR(ResumeEvent); }
 
     void Run(RenderThread& aRenderThread, WindowId aWindowId) override {
       *mResult = aRenderThread.Resume(aWindowId);
       layers::AutoCompleteTask complete(mTask);
     }
 
     layers::SynchronousTask* mTask;
     bool* mResult;
@@ -603,17 +603,17 @@ void WebRenderAPI::FlushSceneBuilder() {
 
 void WebRenderAPI::WaitFlushed() {
   class WaitFlushedEvent : public RendererEvent {
    public:
     explicit WaitFlushedEvent(layers::SynchronousTask* aTask) : mTask(aTask) {
       MOZ_COUNT_CTOR(WaitFlushedEvent);
     }
 
-    MOZ_COUNTED_DTOR_OVERRIDE(WaitFlushedEvent)
+    virtual ~WaitFlushedEvent() { MOZ_COUNT_DTOR(WaitFlushedEvent); }
 
     void Run(RenderThread& aRenderThread, WindowId aWindowId) override {
       layers::AutoCompleteTask complete(mTask);
     }
 
     layers::SynchronousTask* mTask;
   };
 
@@ -671,17 +671,17 @@ void WebRenderAPI::SetCompositionRecorde
 RefPtr<WebRenderAPI::WriteCollectedFramesPromise>
 WebRenderAPI::WriteCollectedFrames() {
   class WriteCollectedFramesEvent final : public RendererEvent {
    public:
     explicit WriteCollectedFramesEvent() {
       MOZ_COUNT_CTOR(WriteCollectedFramesEvent);
     }
 
-    MOZ_COUNTED_DTOR(WriteCollectedFramesEvent)
+    ~WriteCollectedFramesEvent() { MOZ_COUNT_DTOR(WriteCollectedFramesEvent); }
 
     void Run(RenderThread& aRenderThread, WindowId aWindowId) override {
       aRenderThread.WriteCollectedFramesForWindow(aWindowId);
       mPromise.Resolve(true, __func__);
     }
 
     RefPtr<WebRenderAPI::WriteCollectedFramesPromise> GetPromise() {
       return mPromise.Ensure(__func__);
@@ -701,17 +701,17 @@ WebRenderAPI::WriteCollectedFrames() {
 RefPtr<WebRenderAPI::GetCollectedFramesPromise>
 WebRenderAPI::GetCollectedFrames() {
   class GetCollectedFramesEvent final : public RendererEvent {
    public:
     explicit GetCollectedFramesEvent() {
       MOZ_COUNT_CTOR(GetCollectedFramesEvent);
     }
 
-    MOZ_COUNTED_DTOR(GetCollectedFramesEvent);
+    ~GetCollectedFramesEvent() { MOZ_COUNT_DTOR(GetCollectedFramesEvent); };
 
     void Run(RenderThread& aRenderThread, WindowId aWindowId) override {
       Maybe<layers::CollectedFrames> frames =
           aRenderThread.GetCollectedFramesForWindow(aWindowId);
 
       if (frames) {
         mPromise.Resolve(std::move(*frames), __func__);
       } else {
@@ -853,17 +853,17 @@ void TransactionBuilder::UpdateQualitySe
 }
 
 class FrameStartTime : public RendererEvent {
  public:
   explicit FrameStartTime(const TimeStamp& aTime) : mTime(aTime) {
     MOZ_COUNT_CTOR(FrameStartTime);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(FrameStartTime)
+  virtual ~FrameStartTime() { MOZ_COUNT_DTOR(FrameStartTime); }
 
   void Run(RenderThread& aRenderThread, WindowId aWindowId) override {
     auto renderer = aRenderThread.GetRenderer(aWindowId);
     if (renderer) {
       renderer->SetFrameStartTime(mTime);
     }
   }
 
--- a/image/FrameAnimator.h
+++ b/image/FrameAnimator.h
@@ -278,17 +278,17 @@ struct RefreshResult {
 
 class FrameAnimator {
  public:
   FrameAnimator(RasterImage* aImage, const gfx::IntSize& aSize)
       : mImage(aImage), mSize(aSize) {
     MOZ_COUNT_CTOR(FrameAnimator);
   }
 
-  MOZ_COUNTED_DTOR(FrameAnimator)
+  ~FrameAnimator() { MOZ_COUNT_DTOR(FrameAnimator); }
 
   /**
    * Call when you need to re-start animating. Ensures we start from the first
    * frame.
    */
   void ResetAnimation(AnimationState& aState);
 
   /**
--- a/intl/strres/nsStringBundle.cpp
+++ b/intl/strres/nsStringBundle.cpp
@@ -674,19 +674,19 @@ nsresult nsStringBundleBase::FormatStrin
 /////////////////////////////////////////////////////////////////////////////////////////
 
 #define MAX_CACHED_BUNDLES 16
 
 struct bundleCacheEntry_t final : public LinkedListElement<bundleCacheEntry_t> {
   nsCString mHashKey;
   nsCOMPtr<nsIStringBundle> mBundle;
 
-  MOZ_COUNTED_DEFAULT_CTOR(bundleCacheEntry_t)
+  bundleCacheEntry_t() { MOZ_COUNT_CTOR(bundleCacheEntry_t); }
 
-  MOZ_COUNTED_DTOR(bundleCacheEntry_t)
+  ~bundleCacheEntry_t() { MOZ_COUNT_DTOR(bundleCacheEntry_t); }
 };
 
 nsStringBundleService::nsStringBundleService()
     : mBundleMap(MAX_CACHED_BUNDLES) {
   mErrorService = nsErrorService::GetOrCreate();
   MOZ_ALWAYS_TRUE(mErrorService);
 }
 
--- a/ipc/glue/BackgroundParentImpl.cpp
+++ b/ipc/glue/BackgroundParentImpl.cpp
@@ -96,17 +96,17 @@ using mozilla::dom::cache::PCacheStorage
 using mozilla::dom::cache::PCacheStreamControlParent;
 using mozilla::ipc::AssertIsOnBackgroundThread;
 
 namespace {
 
 class TestParent final : public mozilla::ipc::PBackgroundTestParent {
   friend class mozilla::ipc::BackgroundParentImpl;
 
-  MOZ_COUNTED_DEFAULT_CTOR(TestParent)
+  TestParent() { MOZ_COUNT_CTOR(TestParent); }
 
  protected:
   ~TestParent() override { MOZ_COUNT_DTOR(TestParent); }
 
  public:
   void ActorDestroy(ActorDestroyReason aWhy) override;
 };
 
--- a/ipc/glue/WindowsMessageLoop.h
+++ b/ipc/glue/WindowsMessageLoop.h
@@ -15,19 +15,19 @@
 namespace mozilla {
 namespace ipc {
 namespace windows {
 
 void InitUIThread();
 
 class DeferredMessage {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(DeferredMessage)
+  DeferredMessage() { MOZ_COUNT_CTOR(DeferredMessage); }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(DeferredMessage)
+  virtual ~DeferredMessage() { MOZ_COUNT_DTOR(DeferredMessage); }
 
   virtual void Run() = 0;
 };
 
 // Uses CallWndProc to deliver a message at a later time. Messages faked with
 // this class must not have pointers in their wParam or lParam members as they
 // may be invalid by the time the message actually runs.
 class DeferredSendMessage : public DeferredMessage {
--- a/ipc/ipdl/test/cxx/TestSelfManageRoot.h
+++ b/ipc/ipdl/test/cxx/TestSelfManageRoot.h
@@ -13,18 +13,18 @@ namespace _ipdltest {
 
 //-----------------------------------------------------------------------------
 // Parent side
 
 class TestSelfManageParent : public PTestSelfManageParent {
   friend class PTestSelfManageParent;
 
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(TestSelfManageParent)
-  MOZ_COUNTED_DTOR_OVERRIDE(TestSelfManageParent)
+  TestSelfManageParent() { MOZ_COUNT_CTOR(TestSelfManageParent); }
+  virtual ~TestSelfManageParent() { MOZ_COUNT_DTOR(TestSelfManageParent); }
 
   ActorDestroyReason mWhy;
 
  protected:
   PTestSelfManageParent* AllocPTestSelfManageParent() {
     return new TestSelfManageParent();
   }
 
@@ -32,17 +32,17 @@ class TestSelfManageParent : public PTes
 
   virtual void ActorDestroy(ActorDestroyReason why) override { mWhy = why; }
 };
 
 class TestSelfManageRootParent : public PTestSelfManageRootParent {
   friend class PTestSelfManageRootParent;
 
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(TestSelfManageRootParent)
+  TestSelfManageRootParent() { MOZ_COUNT_CTOR(TestSelfManageRootParent); }
   virtual ~TestSelfManageRootParent() {
     MOZ_COUNT_DTOR(TestSelfManageRootParent);
   }
 
   static bool RunTestInProcesses() { return true; }
   static bool RunTestInThreads() { return true; }
 
   void Main();
@@ -63,18 +63,18 @@ class TestSelfManageRootParent : public 
 
 //-----------------------------------------------------------------------------
 // Child side
 
 class TestSelfManageChild : public PTestSelfManageChild {
   friend class PTestSelfManageChild;
 
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(TestSelfManageChild)
-  MOZ_COUNTED_DTOR_OVERRIDE(TestSelfManageChild)
+  TestSelfManageChild() { MOZ_COUNT_CTOR(TestSelfManageChild); }
+  virtual ~TestSelfManageChild() { MOZ_COUNT_DTOR(TestSelfManageChild); }
 
  protected:
   PTestSelfManageChild* AllocPTestSelfManageChild() {
     return new TestSelfManageChild();
   }
 
   bool DeallocPTestSelfManageChild(PTestSelfManageChild* a) {
     delete a;
@@ -83,17 +83,17 @@ class TestSelfManageChild : public PTest
 
   virtual void ActorDestroy(ActorDestroyReason why) override {}
 };
 
 class TestSelfManageRootChild : public PTestSelfManageRootChild {
   friend class PTestSelfManageRootChild;
 
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(TestSelfManageRootChild)
+  TestSelfManageRootChild() { MOZ_COUNT_CTOR(TestSelfManageRootChild); }
   virtual ~TestSelfManageRootChild() {
     MOZ_COUNT_DTOR(TestSelfManageRootChild);
   }
 
   void Main();
 
  protected:
   PTestSelfManageChild* AllocPTestSelfManageChild() {
--- a/ipc/ipdl/test/cxx/TestUniquePtrIPC.h
+++ b/ipc/ipdl/test/cxx/TestUniquePtrIPC.h
@@ -11,18 +11,18 @@
 #include "mozilla/_ipdltest/PTestUniquePtrIPCParent.h"
 #include "mozilla/_ipdltest/PTestUniquePtrIPCChild.h"
 
 namespace mozilla {
 namespace _ipdltest {
 
 class TestUniquePtrIPCParent : public PTestUniquePtrIPCParent {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(TestUniquePtrIPCParent)
-  MOZ_COUNTED_DTOR_OVERRIDE(TestUniquePtrIPCParent)
+  TestUniquePtrIPCParent() { MOZ_COUNT_CTOR(TestUniquePtrIPCParent); }
+  virtual ~TestUniquePtrIPCParent() { MOZ_COUNT_DTOR(TestUniquePtrIPCParent); }
 
   static bool RunTestInProcesses() { return true; }
   static bool RunTestInThreads() { return false; }
 
   void Main();
 
   bool ShouldContinueFromReplyTimeout() override { return false; }
 
@@ -32,18 +32,18 @@ class TestUniquePtrIPCParent : public PT
     }
     passed("ok");
     QuitParent();
   }
 };
 
 class TestUniquePtrIPCChild : public PTestUniquePtrIPCChild {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(TestUniquePtrIPCChild)
-  MOZ_COUNTED_DTOR_OVERRIDE(TestUniquePtrIPCChild)
+  TestUniquePtrIPCChild() { MOZ_COUNT_CTOR(TestUniquePtrIPCChild); }
+  virtual ~TestUniquePtrIPCChild() { MOZ_COUNT_DTOR(TestUniquePtrIPCChild); }
 
   mozilla::ipc::IPCResult RecvTestMessage(UniquePtr<int>&& aA1,
                                           UniquePtr<DummyStruct>&& aA2,
                                           const DummyStruct& aA3,
                                           UniquePtr<int>&& aA4);
 
   mozilla::ipc::IPCResult RecvTestSendReference(UniquePtr<DummyStruct>&& aA);
 
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -1711,19 +1711,19 @@ nsXPCComponents_Utils::UnlinkGhostWindow
   return NS_OK;
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif
 }
 
 #ifdef NS_FREE_PERMANENT_DATA
 struct IntentionallyLeakedObject {
-  MOZ_COUNTED_DEFAULT_CTOR(IntentionallyLeakedObject)
-
-  MOZ_COUNTED_DTOR(IntentionallyLeakedObject)
+  IntentionallyLeakedObject() { MOZ_COUNT_CTOR(IntentionallyLeakedObject); }
+
+  ~IntentionallyLeakedObject() { MOZ_COUNT_DTOR(IntentionallyLeakedObject); }
 };
 #endif
 
 NS_IMETHODIMP
 nsXPCComponents_Utils::IntentionallyLeak() {
 #ifdef NS_FREE_PERMANENT_DATA
   Unused << new IntentionallyLeakedObject();
   return NS_OK;
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -967,18 +967,18 @@ class XPCNativeMember final {
 
   static uint16_t GetMaxIndexInInterface() { return (1 << 12) - 1; }
 
   inline XPCNativeInterface* GetInterface() const;
 
   void SetIndexInInterface(uint16_t index) { mIndexInInterface = index; }
 
   /* default ctor - leave random contents */
-  MOZ_COUNTED_DEFAULT_CTOR(XPCNativeMember)
-  MOZ_COUNTED_DTOR(XPCNativeMember)
+  XPCNativeMember() { MOZ_COUNT_CTOR(XPCNativeMember); }
+  ~XPCNativeMember() { MOZ_COUNT_DTOR(XPCNativeMember); }
 
  private:
   bool Resolve(XPCCallContext& ccx, XPCNativeInterface* iface,
                JS::HandleObject parent, JS::Value* vp);
 
   enum {
     METHOD = 0x01,
     CONSTANT = 0x02,
--- a/layout/base/nsStyleChangeList.h
+++ b/layout/base/nsStyleChangeList.h
@@ -33,18 +33,18 @@ class nsStyleChangeList : private AutoTA
  public:
   using base_type::begin;
   using base_type::Clear;
   using base_type::end;
   using base_type::IsEmpty;
   using base_type::Length;
   using base_type::operator[];
 
-  MOZ_COUNTED_DEFAULT_CTOR(nsStyleChangeList)
-  MOZ_COUNTED_DTOR(nsStyleChangeList)
+  nsStyleChangeList() { MOZ_COUNT_CTOR(nsStyleChangeList); }
+  ~nsStyleChangeList() { MOZ_COUNT_DTOR(nsStyleChangeList); }
   void AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChangeHint aHint);
 
   // Starting from the end of the list, removes all changes until the list is
   // empty or an element with |mContent != aContent| is found.
   void PopChangesForContent(nsIContent* aContent) {
     while (!IsEmpty() && LastElement().mContent == aContent) {
       RemoveLastElement();
     }
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -62,17 +62,21 @@ bool nsButtonFrameRenderer::isDisabled()
 
 class nsDisplayButtonBoxShadowOuter : public nsPaintedDisplayItem {
  public:
   nsDisplayButtonBoxShadowOuter(nsDisplayListBuilder* aBuilder,
                                 nsIFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayButtonBoxShadowOuter);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayButtonBoxShadowOuter)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayButtonBoxShadowOuter() {
+    MOZ_COUNT_DTOR(nsDisplayButtonBoxShadowOuter);
+  }
+#endif
 
   virtual bool CreateWebRenderCommands(
       mozilla::wr::DisplayListBuilder& aBuilder,
       mozilla::wr::IpcResourceUpdateQueue& aResources,
       const StackingContextHelper& aSc,
       mozilla::layers::RenderRootStateManager* aManager,
       nsDisplayListBuilder* aDisplayListBuilder) override;
 
@@ -186,18 +190,19 @@ bool nsDisplayButtonBoxShadowOuter::Crea
 
 class nsDisplayButtonBorder final : public nsPaintedDisplayItem {
  public:
   nsDisplayButtonBorder(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                         nsButtonFrameRenderer* aRenderer)
       : nsPaintedDisplayItem(aBuilder, aFrame), mBFR(aRenderer) {
     MOZ_COUNT_CTOR(nsDisplayButtonBorder);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayButtonBorder)
-
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayButtonBorder() { MOZ_COUNT_DTOR(nsDisplayButtonBorder); }
+#endif
   virtual bool MustPaintOnContentSide() const override { return true; }
 
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState,
                        nsTArray<nsIFrame*>* aOutFrames) override {
     aOutFrames->AppendElement(mFrame);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
@@ -291,17 +296,21 @@ nsRect nsDisplayButtonBorder::GetBounds(
 
 class nsDisplayButtonForeground final : public nsPaintedDisplayItem {
  public:
   nsDisplayButtonForeground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                             nsButtonFrameRenderer* aRenderer)
       : nsPaintedDisplayItem(aBuilder, aFrame), mBFR(aRenderer) {
     MOZ_COUNT_CTOR(nsDisplayButtonForeground);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayButtonForeground)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayButtonForeground() {
+    MOZ_COUNT_DTOR(nsDisplayButtonForeground);
+  }
+#endif
 
   nsDisplayItemGeometry* AllocateGeometry(
       nsDisplayListBuilder* aBuilder) override;
   void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
                                  const nsDisplayItemGeometry* aGeometry,
                                  nsRegion* aInvalidRegion) const override;
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   virtual bool CreateWebRenderCommands(
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -1461,17 +1461,19 @@ int32_t nsComboboxControlFrame::UpdateRe
 
 class nsDisplayComboboxFocus : public nsPaintedDisplayItem {
  public:
   nsDisplayComboboxFocus(nsDisplayListBuilder* aBuilder,
                          nsComboboxControlFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayComboboxFocus);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayComboboxFocus)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayComboboxFocus() { MOZ_COUNT_DTOR(nsDisplayComboboxFocus); }
+#endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   NS_DISPLAY_DECL_NAME("ComboboxFocus", TYPE_COMBOBOX_FOCUS)
 };
 
 void nsDisplayComboboxFocus::Paint(nsDisplayListBuilder* aBuilder,
                                    gfxContext* aCtx) {
   static_cast<nsComboboxControlFrame*>(mFrame)->PaintFocus(
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -95,18 +95,21 @@ nsIFrame* nsFieldSetFrame::GetLegend() c
 
 class nsDisplayFieldSetBorder final : public nsPaintedDisplayItem {
  public:
   nsDisplayFieldSetBorder(nsDisplayListBuilder* aBuilder,
                           nsFieldSetFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayFieldSetBorder);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayFieldSetBorder)
-
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayFieldSetBorder() {
+    MOZ_COUNT_DTOR(nsDisplayFieldSetBorder);
+  }
+#endif
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   virtual nsDisplayItemGeometry* AllocateGeometry(
       nsDisplayListBuilder* aBuilder) override;
   virtual void ComputeInvalidationRegion(
       nsDisplayListBuilder* aBuilder, const nsDisplayItemGeometry* aGeometry,
       nsRegion* aInvalidRegion) const override;
   bool CreateWebRenderCommands(
       mozilla::wr::DisplayListBuilder& aBuilder,
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -149,17 +149,21 @@ void nsRangeFrame::AppendAnonymousConten
 }
 
 class nsDisplayRangeFocusRing final : public nsPaintedDisplayItem {
  public:
   nsDisplayRangeFocusRing(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayRangeFocusRing);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayRangeFocusRing)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayRangeFocusRing() {
+    MOZ_COUNT_DTOR(nsDisplayRangeFocusRing);
+  }
+#endif
 
   nsDisplayItemGeometry* AllocateGeometry(
       nsDisplayListBuilder* aBuilder) override;
   void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
                                  const nsDisplayItemGeometry* aGeometry,
                                  nsRegion* aInvalidRegion) const override;
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
                            bool* aSnap) const override;
--- a/layout/forms/nsSelectsAreaFrame.cpp
+++ b/layout/forms/nsSelectsAreaFrame.cpp
@@ -101,17 +101,19 @@ static nsListControlFrame* GetEnclosingL
 }
 
 class nsDisplayListFocus : public nsPaintedDisplayItem {
  public:
   nsDisplayListFocus(nsDisplayListBuilder* aBuilder, nsSelectsAreaFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayListFocus);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayListFocus)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayListFocus() { MOZ_COUNT_DTOR(nsDisplayListFocus); }
+#endif
 
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
                            bool* aSnap) const override {
     *aSnap = false;
     // override bounds because the list item focus ring may extend outside
     // the nsSelectsAreaFrame
     nsListControlFrame* listFrame = GetEnclosingListFrame(Frame());
     return listFrame->GetVisualOverflowRectRelativeToSelf() +
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -541,17 +541,19 @@ bool BulletRenderer::CreateWebRenderComm
 }
 
 class nsDisplayBullet final : public nsPaintedDisplayItem {
  public:
   nsDisplayBullet(nsDisplayListBuilder* aBuilder, nsBulletFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayBullet);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayBullet)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayBullet() { MOZ_COUNT_DTOR(nsDisplayBullet); }
+#endif
 
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
                            bool* aSnap) const override {
     *aSnap = false;
     return mFrame->GetVisualOverflowRectRelativeToSelf() + ToReferenceFrame();
   }
 
   virtual bool CreateWebRenderCommands(
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -450,17 +450,17 @@ void nsDisplayCanvasThemedBackground::Pa
  * The only reason this can't use nsDisplayGeneric is overriding GetBounds.
  */
 class nsDisplayCanvasFocus : public nsPaintedDisplayItem {
  public:
   nsDisplayCanvasFocus(nsDisplayListBuilder* aBuilder, nsCanvasFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayCanvasFocus);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayCanvasFocus)
+  virtual ~nsDisplayCanvasFocus() { MOZ_COUNT_DTOR(nsDisplayCanvasFocus); }
 
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
                            bool* aSnap) const override {
     *aSnap = false;
     // This is an overestimate, but that's not a problem.
     nsCanvasFrame* frame = static_cast<nsCanvasFrame*>(mFrame);
     return frame->CanvasArea() + ToReferenceFrame();
   }
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -24,17 +24,22 @@ static LazyLogModule sColumnSetLog("Colu
   MOZ_LOG(sColumnSetLog, LogLevel::Debug, (msg, ##__VA_ARGS__))
 
 class nsDisplayColumnRule : public nsPaintedDisplayItem {
  public:
   nsDisplayColumnRule(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayColumnRule);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayColumnRule)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayColumnRule() {
+    MOZ_COUNT_DTOR(nsDisplayColumnRule);
+    mBorderRenderers.Clear();
+  }
+#endif
 
   /**
    * Returns the frame's visual overflow rect instead of the frame's bounds.
    */
   nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) const override {
     *aSnap = false;
     return static_cast<nsColumnSetFrame*>(mFrame)->CalculateColumnRuleBounds(
         ToReferenceFrame());
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -927,18 +927,17 @@ static void CompareLayers(
     if (!image.IsImageRequestType() || !image.IsResolved()) {
       continue;
     }
 
     // aCallback is called when the style image in aFirstLayers is thought to
     // be different with the corresponded one in aSecondLayers
     if (!aSecondLayers || i >= aSecondLayers->mImageCount ||
         (!aSecondLayers->mLayers[i].mImage.IsResolved() ||
-         image.GetImageRequest() !=
-             aSecondLayers->mLayers[i].mImage.GetImageRequest())) {
+         image.GetImageRequest() != aSecondLayers->mLayers[i].mImage.GetImageRequest())) {
       if (imgRequestProxy* req = image.GetImageRequest()) {
         aCallback(req);
       }
     }
   }
 }
 
 static void AddAndRemoveImageAssociations(
@@ -2315,17 +2314,21 @@ int16_t nsFrame::DisplaySelection(nsPres
 class nsDisplaySelectionOverlay : public nsPaintedDisplayItem {
  public:
   nsDisplaySelectionOverlay(nsDisplayListBuilder* aBuilder, nsFrame* aFrame,
                             int16_t aSelectionValue)
       : nsPaintedDisplayItem(aBuilder, aFrame),
         mSelectionValue(aSelectionValue) {
     MOZ_COUNT_CTOR(nsDisplaySelectionOverlay);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplaySelectionOverlay)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplaySelectionOverlay() {
+    MOZ_COUNT_DTOR(nsDisplaySelectionOverlay);
+  }
+#endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   bool CreateWebRenderCommands(
       mozilla::wr::DisplayListBuilder& aBuilder,
       mozilla::wr::IpcResourceUpdateQueue& aResources,
       const StackingContextHelper& aSc,
       mozilla::layers::RenderRootStateManager* aManager,
       nsDisplayListBuilder* aDisplayListBuilder) override;
@@ -11712,17 +11715,17 @@ DR_FrameTypeInfo::DR_FrameTypeInfo(Layou
 }
 
 struct DR_FrameTreeNode {
   DR_FrameTreeNode(nsIFrame* aFrame, DR_FrameTreeNode* aParent)
       : mFrame(aFrame), mParent(aParent), mDisplay(0), mIndent(0) {
     MOZ_COUNT_CTOR(DR_FrameTreeNode);
   }
 
-  MOZ_COUNTED_DTOR(DR_FrameTreeNode)
+  ~DR_FrameTreeNode() { MOZ_COUNT_DTOR(DR_FrameTreeNode); }
 
   nsIFrame* mFrame;
   DR_FrameTreeNode* mParent;
   bool mDisplay;
   uint32_t mIndent;
 };
 
 // DR_State implementation
--- a/layout/generic/nsFrameSelection.h
+++ b/layout/generic/nsFrameSelection.h
@@ -29,29 +29,30 @@ class nsRange;
 
 // Selection interface
 
 struct SelectionDetails {
   SelectionDetails()
       : mStart(), mEnd(), mSelectionType(mozilla::SelectionType::eInvalid) {
     MOZ_COUNT_CTOR(SelectionDetails);
   }
-  MOZ_COUNTED_DTOR(SelectionDetails)
-
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~SelectionDetails() { MOZ_COUNT_DTOR(SelectionDetails); }
+#endif
   int32_t mStart;
   int32_t mEnd;
   mozilla::SelectionType mSelectionType;
   mozilla::TextRangeStyle mTextRangeStyle;
   mozilla::UniquePtr<SelectionDetails> mNext;
 };
 
 struct SelectionCustomColors {
 #ifdef NS_BUILD_REFCNT_LOGGING
-  MOZ_COUNTED_DEFAULT_CTOR(SelectionCustomColors)
-  MOZ_COUNTED_DTOR(SelectionCustomColors)
+  SelectionCustomColors() { MOZ_COUNT_CTOR(SelectionCustomColors); }
+  ~SelectionCustomColors() { MOZ_COUNT_DTOR(SelectionCustomColors); }
 #endif
   mozilla::Maybe<nscolor> mForegroundColor;
   mozilla::Maybe<nscolor> mBackgroundColor;
   mozilla::Maybe<nscolor> mAltForegroundColor;
   mozilla::Maybe<nscolor> mAltBackgroundColor;
 };
 
 namespace mozilla {
@@ -863,17 +864,17 @@ class nsFrameSelection final {
   // These values are not used since they are only valid when
   // mDelayedMouseEventValid is true, and setting mDelayedMouseEventValid
   // always overrides these values.
   uint32_t mDelayedMouseEventClickCount = 0;
   bool mDelayedMouseEventIsShift = false;
 
   bool mChangesDuringBatching = false;
   bool mDragSelectingCells = false;
-  bool mDragState = false;  // for drag purposes
+  bool mDragState = false;             // for drag purposes
   bool mDesiredPosSet = false;
   bool mAccessibleCaretEnabled = false;
 
   int8_t mCaretMovementStyle = 0;
 
   static bool sSelectionEventsOnTextControlsEnabled;
 };
 
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -1328,17 +1328,21 @@ void nsHTMLFramesetBorderFrame::Reflow(n
 
 class nsDisplayFramesetBorder : public nsPaintedDisplayItem {
  public:
   nsDisplayFramesetBorder(nsDisplayListBuilder* aBuilder,
                           nsHTMLFramesetBorderFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayFramesetBorder);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayFramesetBorder)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayFramesetBorder() {
+    MOZ_COUNT_DTOR(nsDisplayFramesetBorder);
+  }
+#endif
 
   // REVIEW: see old GetFrameForPoint
   // Receives events in its bounds
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState,
                        nsTArray<nsIFrame*>* aOutFrames) override {
     aOutFrames->AppendElement(mFrame);
   }
@@ -1511,17 +1515,19 @@ void nsHTMLFramesetBlankFrame::Reflow(ns
 }
 
 class nsDisplayFramesetBlank : public nsPaintedDisplayItem {
  public:
   nsDisplayFramesetBlank(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayFramesetBlank);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayFramesetBlank)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayFramesetBlank() { MOZ_COUNT_DTOR(nsDisplayFramesetBlank); }
+#endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   NS_DISPLAY_DECL_NAME("FramesetBlank", TYPE_FRAMESET_BLANK)
 };
 
 void nsDisplayFramesetBlank::Paint(nsDisplayListBuilder* aBuilder,
                                    gfxContext* aCtx) {
   DrawTarget* drawTarget = aCtx->GetDrawTarget();
--- a/layout/generic/nsHTMLCanvasFrame.cpp
+++ b/layout/generic/nsHTMLCanvasFrame.cpp
@@ -58,17 +58,19 @@ static AspectRatio IntrinsicRatioFromCan
 }
 
 class nsDisplayCanvas final : public nsPaintedDisplayItem {
  public:
   nsDisplayCanvas(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayCanvas);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayCanvas)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayCanvas() { MOZ_COUNT_DTOR(nsDisplayCanvas); }
+#endif
 
   NS_DISPLAY_DECL_NAME("nsDisplayCanvas", TYPE_CANVAS)
 
   virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                                    bool* aSnap) const override {
     *aSnap = false;
     nsHTMLCanvasFrame* f = static_cast<nsHTMLCanvasFrame*>(Frame());
     HTMLCanvasElement* canvas = HTMLCanvasElement::FromNode(f->GetContent());
--- a/layout/generic/nsLineBox.h
+++ b/layout/generic/nsLineBox.h
@@ -29,17 +29,17 @@ class PresShell;
 // State cached after reflowing a float. This state is used during
 // incremental reflow when we avoid reflowing a float.
 class nsFloatCache {
  public:
   nsFloatCache();
 #ifdef NS_BUILD_REFCNT_LOGGING
   ~nsFloatCache();
 #else
-  ~nsFloatCache() = default;
+  ~nsFloatCache() {}
 #endif
 
   nsFloatCache* Next() const { return mNext; }
 
   nsIFrame* mFloat;  // floating frame
 
  protected:
   nsFloatCache* mNext;
@@ -95,17 +95,17 @@ class nsFloatCacheList {
 
 class nsFloatCacheFreeList : private nsFloatCacheList {
  public:
 #ifdef NS_BUILD_REFCNT_LOGGING
   nsFloatCacheFreeList();
   ~nsFloatCacheFreeList();
 #else
   nsFloatCacheFreeList() : mTail(nullptr) {}
-  ~nsFloatCacheFreeList() = default;
+  ~nsFloatCacheFreeList() {}
 #endif
 
   // Reimplement trivial functions
   bool IsEmpty() const { return nullptr == mHead; }
 
   nsFloatCache* Head() const { return mHead; }
 
   nsFloatCache* Tail() const { return mTail; }
@@ -1286,17 +1286,17 @@ class nsLineList {
   typedef nsLineList_const_iterator const_iterator;
   typedef nsLineList_const_reverse_iterator const_reverse_iterator;
 
   nsLineList() {
     MOZ_COUNT_CTOR(nsLineList);
     clear();
   }
 
-  MOZ_COUNTED_DTOR(nsLineList)
+  ~nsLineList() { MOZ_COUNT_DTOR(nsLineList); }
 
   const_iterator begin() const {
     const_iterator rv;
     rv.mCurrent = mLink._mNext;
 #ifdef DEBUG
     rv.mListLink = &mLink;
 #endif
     return rv;
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -442,17 +442,19 @@ static gfx::Matrix4x4 ComputePageTransfo
 }
 
 class nsDisplayHeaderFooter final : public nsPaintedDisplayItem {
  public:
   nsDisplayHeaderFooter(nsDisplayListBuilder* aBuilder, nsPageFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayHeaderFooter);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayHeaderFooter)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayHeaderFooter() { MOZ_COUNT_DTOR(nsDisplayHeaderFooter); }
+#endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      gfxContext* aCtx) override {
 #ifdef DEBUG
     nsPageFrame* pageFrame = do_QueryFrame(mFrame);
     MOZ_ASSERT(pageFrame, "We should have an nsPageFrame");
 #endif
     static_cast<nsPageFrame*>(mFrame)->PaintHeaderFooter(
--- a/layout/generic/nsPluginFrame.h
+++ b/layout/generic/nsPluginFrame.h
@@ -355,17 +355,19 @@ class nsDisplayPluginGeometry : public n
 
 class nsDisplayPlugin final : public nsPaintedDisplayItem {
  public:
   nsDisplayPlugin(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayPlugin);
     aBuilder->SetContainsPluginItem();
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayPlugin)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayPlugin() { MOZ_COUNT_DTOR(nsDisplayPlugin); }
+#endif
 
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
                            bool* aSnap) const override;
   virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                                    bool* aSnap) const override;
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                  nsRegion* aVisibleRegion) override;
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -401,17 +401,17 @@ void nsVideoFrame::Reflow(nsPresContext*
 
 class nsDisplayVideo : public nsPaintedDisplayItem {
  public:
   nsDisplayVideo(nsDisplayListBuilder* aBuilder, nsVideoFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayVideo);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayVideo)
+  virtual ~nsDisplayVideo() { MOZ_COUNT_DTOR(nsDisplayVideo); }
 #endif
 
   NS_DISPLAY_DECL_NAME("Video", TYPE_VIDEO)
 
   virtual bool CreateWebRenderCommands(
       mozilla::wr::DisplayListBuilder& aBuilder,
       mozilla::wr::IpcResourceUpdateQueue& aResources,
       const mozilla::layers::StackingContextHelper& aSc,
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -165,17 +165,17 @@ class nsPropertiesTable final : public n
  public:
   explicit nsPropertiesTable(const nsACString& aPrimaryFontName)
       : mState(NS_TABLE_STATE_EMPTY) {
     MOZ_COUNT_CTOR(nsPropertiesTable);
     mGlyphCodeFonts.AppendElement(FontFamilyName(
         aPrimaryFontName, StyleFontFamilyNameSyntax::Identifiers));
   }
 
-  MOZ_COUNTED_DTOR(nsPropertiesTable)
+  ~nsPropertiesTable() { MOZ_COUNT_DTOR(nsPropertiesTable); }
 
   const FontFamilyName& PrimaryFontName() const { return mGlyphCodeFonts[0]; }
 
   const FontFamilyName& FontNameFor(
       const nsGlyphCode& aGlyphCode) const override {
     NS_ASSERTION(!aGlyphCode.IsGlyphID(),
                  "nsPropertiesTable can only access glyphs by code point");
     return mGlyphCodeFonts[aGlyphCode.font];
@@ -373,17 +373,17 @@ already_AddRefed<gfxTextRun> nsPropertie
 }
 
 // An instance of nsOpenTypeTable is associated with one gfxFontEntry that
 // corresponds to an Open Type font with a MATH table. All the glyphs come from
 // the same font and the calls to access size variants and parts are directly
 // forwarded to the gfx code.
 class nsOpenTypeTable final : public nsGlyphTable {
  public:
-  MOZ_COUNTED_DTOR(nsOpenTypeTable)
+  ~nsOpenTypeTable() { MOZ_COUNT_DTOR(nsOpenTypeTable); }
 
   virtual nsGlyphCode ElementAt(DrawTarget* aDrawTarget,
                                 int32_t aAppUnitsPerDevPixel,
                                 gfxFontGroup* aFontGroup, char16_t aChar,
                                 bool aVertical, uint32_t aPosition) override;
   virtual nsGlyphCode BigOf(DrawTarget* aDrawTarget,
                             int32_t aAppUnitsPerDevPixel,
                             gfxFontGroup* aFontGroup, char16_t aChar,
@@ -1684,17 +1684,21 @@ nscoord nsMathMLChar::GetMaxWidth(nsIFra
 
 class nsDisplayMathMLSelectionRect final : public nsPaintedDisplayItem {
  public:
   nsDisplayMathMLSelectionRect(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                                const nsRect& aRect)
       : nsPaintedDisplayItem(aBuilder, aFrame), mRect(aRect) {
     MOZ_COUNT_CTOR(nsDisplayMathMLSelectionRect);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayMathMLSelectionRect)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayMathMLSelectionRect() {
+    MOZ_COUNT_DTOR(nsDisplayMathMLSelectionRect);
+  }
+#endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   NS_DISPLAY_DECL_NAME("MathMLSelectionRect", TYPE_MATHML_SELECTION_RECT)
  private:
   nsRect mRect;
 };
 
 void nsDisplayMathMLSelectionRect::Paint(nsDisplayListBuilder* aBuilder,
@@ -1715,17 +1719,21 @@ class nsDisplayMathMLCharForeground fina
                                 nsIFrame* aFrame, nsMathMLChar* aChar,
                                 uint16_t aIndex, bool aIsSelected)
       : nsPaintedDisplayItem(aBuilder, aFrame),
         mChar(aChar),
         mIndex(aIndex),
         mIsSelected(aIsSelected) {
     MOZ_COUNT_CTOR(nsDisplayMathMLCharForeground);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayMathMLCharForeground)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayMathMLCharForeground() {
+    MOZ_COUNT_DTOR(nsDisplayMathMLCharForeground);
+  }
+#endif
 
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
                            bool* aSnap) const override {
     *aSnap = false;
     nsRect rect;
     mChar->GetRect(rect);
     nsPoint offset = ToReferenceFrame() + rect.TopLeft();
     nsBoundingMetrics bm;
@@ -1761,17 +1769,21 @@ class nsDisplayMathMLCharForeground fina
 #ifdef DEBUG
 class nsDisplayMathMLCharDebug final : public nsPaintedDisplayItem {
  public:
   nsDisplayMathMLCharDebug(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                            const nsRect& aRect)
       : nsPaintedDisplayItem(aBuilder, aFrame), mRect(aRect) {
     MOZ_COUNT_CTOR(nsDisplayMathMLCharDebug);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayMathMLCharDebug)
+#  ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayMathMLCharDebug() {
+    MOZ_COUNT_DTOR(nsDisplayMathMLCharDebug);
+  }
+#  endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   NS_DISPLAY_DECL_NAME("MathMLCharDebug", TYPE_MATHML_CHAR_DEBUG)
 
  private:
   nsRect mRect;
 };
 
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -69,17 +69,19 @@ nsresult nsMathMLContainerFrame::ReflowE
 }
 
 class nsDisplayMathMLError : public nsPaintedDisplayItem {
  public:
   nsDisplayMathMLError(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayMathMLError);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayMathMLError)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayMathMLError() { MOZ_COUNT_DTOR(nsDisplayMathMLError); }
+#endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   NS_DISPLAY_DECL_NAME("MathMLError", TYPE_MATHML_ERROR)
 };
 
 void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
                                  gfxContext* aCtx) {
   // Set color and font ...
--- a/layout/mathml/nsMathMLFrame.cpp
+++ b/layout/mathml/nsMathMLFrame.cpp
@@ -258,17 +258,21 @@ void nsMathMLFrame::ParseNumericValue(co
 #if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
 class nsDisplayMathMLBoundingMetrics final : public nsDisplayItem {
  public:
   nsDisplayMathMLBoundingMetrics(nsDisplayListBuilder* aBuilder,
                                  nsIFrame* aFrame, const nsRect& aRect)
       : nsDisplayItem(aBuilder, aFrame), mRect(aRect) {
     MOZ_COUNT_CTOR(nsDisplayMathMLBoundingMetrics);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayMathMLBoundingMetrics)
+#  ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayMathMLBoundingMetrics() {
+    MOZ_COUNT_DTOR(nsDisplayMathMLBoundingMetrics);
+  }
+#  endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   NS_DISPLAY_DECL_NAME("MathMLBoundingMetrics", TYPE_MATHML_BOUNDING_METRICS)
  private:
   nsRect mRect;
 };
 
 void nsDisplayMathMLBoundingMetrics::Paint(nsDisplayListBuilder* aBuilder,
@@ -298,17 +302,19 @@ void nsMathMLFrame::DisplayBoundingMetri
 
 class nsDisplayMathMLBar final : public nsPaintedDisplayItem {
  public:
   nsDisplayMathMLBar(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                      const nsRect& aRect, uint16_t aIndex)
       : nsPaintedDisplayItem(aBuilder, aFrame), mRect(aRect), mIndex(aIndex) {
     MOZ_COUNT_CTOR(nsDisplayMathMLBar);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayMathMLBar)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayMathMLBar() { MOZ_COUNT_DTOR(nsDisplayMathMLBar); }
+#endif
 
   virtual uint16_t CalculatePerFrameKey() const override { return mIndex; }
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   NS_DISPLAY_DECL_NAME("MathMLBar", TYPE_MATHML_BAR)
  private:
   nsRect mRect;
   uint16_t mIndex;
--- a/layout/mathml/nsMathMLmencloseFrame.cpp
+++ b/layout/mathml/nsMathMLmencloseFrame.cpp
@@ -717,17 +717,19 @@ class nsDisplayNotation final : public n
                     const nsRect& aRect, nscoord aThickness,
                     nsMencloseNotation aType)
       : nsPaintedDisplayItem(aBuilder, aFrame),
         mRect(aRect),
         mThickness(aThickness),
         mType(aType) {
     MOZ_COUNT_CTOR(nsDisplayNotation);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayNotation)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayNotation() { MOZ_COUNT_DTOR(nsDisplayNotation); }
+#endif
 
   virtual uint16_t CalculatePerFrameKey() const override { return mType; }
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   NS_DISPLAY_DECL_NAME("MathMLMencloseNotation", TYPE_MATHML_MENCLOSE_NOTATION)
 
  private:
   nsRect mRect;
--- a/layout/mathml/nsMathMLmfracFrame.cpp
+++ b/layout/mathml/nsMathMLmfracFrame.cpp
@@ -605,17 +605,19 @@ class nsDisplayMathMLSlash : public nsPa
  public:
   nsDisplayMathMLSlash(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                        const nsRect& aRect, nscoord aThickness)
       : nsPaintedDisplayItem(aBuilder, aFrame),
         mRect(aRect),
         mThickness(aThickness) {
     MOZ_COUNT_CTOR(nsDisplayMathMLSlash);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayMathMLSlash)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayMathMLSlash() { MOZ_COUNT_DTOR(nsDisplayMathMLSlash); }
+#endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   NS_DISPLAY_DECL_NAME("MathMLSlash", TYPE_MATHML_SLASH)
 
  private:
   nsRect mRect;
   nscoord mThickness;
 };
--- a/layout/painting/MaskLayerImageCache.h
+++ b/layout/painting/MaskLayerImageCache.h
@@ -64,17 +64,17 @@ class MaskLayerImageCache {
 
     PixelRoundedRect(const PixelRoundedRect& aPRR) : mRect(aPRR.mRect) {
       MOZ_COUNT_CTOR(PixelRoundedRect);
       for (const auto corner : mozilla::AllPhysicalHalfCorners()) {
         mRadii[corner] = aPRR.mRadii[corner];
       }
     }
 
-    MOZ_COUNTED_DTOR(PixelRoundedRect)
+    ~PixelRoundedRect() { MOZ_COUNT_DTOR(PixelRoundedRect); }
 
     // Applies the scale and translate components of aTransform.
     // It is an error to pass a matrix which does more than just scale
     // and translate.
     void ScaleAndTranslate(const gfx::Matrix& aTransform) {
       NS_ASSERTION(aTransform._12 == 0 && aTransform._21 == 0,
                    "Transform has a component other than scale and translate");
 
@@ -221,17 +221,17 @@ class MaskLayerImageCache {
 
     explicit MaskLayerImageEntry(KeyTypePointer aKey) : mKey(aKey) {
       MOZ_COUNT_CTOR(MaskLayerImageEntry);
     }
     MaskLayerImageEntry(const MaskLayerImageEntry& aOther)
         : mKey(aOther.mKey.get()) {
       NS_ERROR("ALLOW_MEMMOVE == true, should never be called");
     }
-    MOZ_COUNTED_DTOR(MaskLayerImageEntry)
+    ~MaskLayerImageEntry() { MOZ_COUNT_DTOR(MaskLayerImageEntry); }
 
     // KeyEquals(): does this entry match this key?
     bool KeyEquals(KeyTypePointer aKey) const { return *mKey == *aKey; }
 
     // KeyToPointer(): Convert KeyType to KeyTypePointer
     static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; }
 
     // HashKey(): calculate the hash number
--- a/layout/painting/TransformClipNode.h
+++ b/layout/painting/TransformClipNode.h
@@ -121,17 +121,17 @@ class TransformClipNode {
       }
 
       aRect = transform.TransformAndClipBounds(aRect, maxBounds);
       node = node->Parent();
     }
   }
 
  private:
-  MOZ_COUNTED_DTOR(TransformClipNode)
+  ~TransformClipNode() { MOZ_COUNT_DTOR(TransformClipNode); }
 
   const RefPtr<TransformClipNode> mParent;
   const gfx::Matrix4x4Flagged mTransform;
   const Maybe<gfx::IntRect> mClip;
 };
 
 }  // namespace mozilla
 
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -2485,17 +2485,17 @@ class nsDisplayItem : public nsDisplayIt
 
  protected:
   // This is never instantiated directly (it has pure virtual methods), so no
   // need to count constructors and destructors.
   nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame);
   nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                 const ActiveScrolledRoot* aActiveScrolledRoot);
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayItem)
+  virtual ~nsDisplayItem() { MOZ_COUNT_DTOR(nsDisplayItem); }
 
   /**
    * The custom copy-constructor is implemented to prevent copying the saved
    * state of the item.
    * This is currently only used when creating temporary items for merging.
    */
   nsDisplayItem(nsDisplayListBuilder* aBuilder, const nsDisplayItem& aOther)
       : nsDisplayItemBase(aBuilder, aOther),
@@ -4093,17 +4093,19 @@ class nsDisplayGeneric : public nsPainte
     MOZ_COUNT_CTOR(nsDisplayGeneric);
     SetType(aType);
   }
 
   constexpr static DisplayItemType ItemType() {
     return DisplayItemType::TYPE_GENERIC;
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayGeneric)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayGeneric() override { MOZ_COUNT_DTOR(nsDisplayGeneric); }
+#endif
 
   void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override {
     MOZ_ASSERT(!!mPaint != !!mOldPaint);
     if (mPaint) {
       mPaint(mFrame, aCtx->GetDrawTarget(), GetPaintRect(), ToReferenceFrame());
     } else {
       mOldPaint(mFrame, aCtx, GetPaintRect(), ToReferenceFrame());
     }
@@ -4149,17 +4151,19 @@ class nsDisplayReflowCount : public nsPa
   nsDisplayReflowCount(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                        const char* aFrameName, uint32_t aColor = 0)
       : nsPaintedDisplayItem(aBuilder, aFrame),
         mFrameName(aFrameName),
         mColor(aColor) {
     MOZ_COUNT_CTOR(nsDisplayReflowCount);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayReflowCount)
+#  ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayReflowCount() override { MOZ_COUNT_DTOR(nsDisplayReflowCount); }
+#  endif
 
   NS_DISPLAY_DECL_NAME("nsDisplayReflowCount", TYPE_REFLOW_COUNT)
 
   void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override {
     mFrame->PresShell()->PaintCount(mFrameName, aCtx, mFrame->PresContext(),
                                     mFrame, ToReferenceFrame(), mColor);
   }
 
@@ -4231,17 +4235,19 @@ class nsDisplayCaret : public nsPaintedD
 
 /**
  * The standard display item to paint the CSS borders of a frame.
  */
 class nsDisplayBorder : public nsPaintedDisplayItem {
  public:
   nsDisplayBorder(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame);
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayBorder)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayBorder() override { MOZ_COUNT_DTOR(nsDisplayBorder); }
+#endif
 
   NS_DISPLAY_DECL_NAME("Border", TYPE_BORDER)
 
   bool IsInvisibleInRect(const nsRect& aRect) const override;
   nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) const override;
   LayerState GetLayerState(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
       const ContainerLayerParameters& aParameters) override;
@@ -4394,17 +4400,19 @@ class nsDisplaySolidColor : public nsDis
     NS_ASSERTION(NS_GET_A(aColor) > 0,
                  "Don't create invisible nsDisplaySolidColors!");
     MOZ_COUNT_CTOR(nsDisplaySolidColor);
     if (!aCanBeReused) {
       SetCantBeReused();
     }
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplaySolidColor)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplaySolidColor() override { MOZ_COUNT_DTOR(nsDisplaySolidColor); }
+#endif
 
   NS_DISPLAY_DECL_NAME("SolidColor", TYPE_SOLID_COLOR)
 
   nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) const override;
   LayerState GetLayerState(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
       const ContainerLayerParameters& aParameters) override;
   already_AddRefed<Layer> BuildLayer(
@@ -4457,17 +4465,21 @@ class nsDisplaySolidColorRegion : public
       : nsPaintedDisplayItem(aBuilder, aFrame),
         mRegion(aRegion),
         mColor(Color::FromABGR(aColor)) {
     NS_ASSERTION(NS_GET_A(aColor) > 0,
                  "Don't create invisible nsDisplaySolidColorRegions!");
     MOZ_COUNT_CTOR(nsDisplaySolidColorRegion);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplaySolidColorRegion)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplaySolidColorRegion() override {
+    MOZ_COUNT_DTOR(nsDisplaySolidColorRegion);
+  }
+#endif
 
   NS_DISPLAY_DECL_NAME("SolidColorRegion", TYPE_SOLID_COLOR_REGION)
 
   nsDisplayItemGeometry* AllocateGeometry(
       nsDisplayListBuilder* aBuilder) override {
     return new nsDisplaySolidColorRegionGeometry(this, aBuilder, mRegion,
                                                  mColor);
   }
@@ -4764,17 +4776,23 @@ class nsDisplayTableBackgroundImage : pu
 /**
  * A display item to paint the native theme background for a frame.
  */
 class nsDisplayThemedBackground : public nsPaintedDisplayItem {
  public:
   nsDisplayThemedBackground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                             const nsRect& aBackgroundRect);
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayThemedBackground)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayThemedBackground() override {
+    MOZ_COUNT_DTOR(nsDisplayThemedBackground);
+  }
+#else
+  ~nsDisplayThemedBackground() override = default;
+#endif
 
   NS_DISPLAY_DECL_NAME("ThemedBackground", TYPE_THEMED_BACKGROUND)
 
   void Init(nsDisplayListBuilder* aBuilder);
 
   void Destroy(nsDisplayListBuilder* aBuilder) override {
     aBuilder->UnregisterThemeGeometry(this);
     nsPaintedDisplayItem::Destroy(aBuilder);
@@ -5115,17 +5133,21 @@ class nsDisplayClearBackground : public 
 class nsDisplayBoxShadowOuter final : public nsPaintedDisplayItem {
  public:
   nsDisplayBoxShadowOuter(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame), mOpacity(1.0f) {
     MOZ_COUNT_CTOR(nsDisplayBoxShadowOuter);
     mBounds = GetBoundsInternal();
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayBoxShadowOuter)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayBoxShadowOuter() override {
+    MOZ_COUNT_DTOR(nsDisplayBoxShadowOuter);
+  }
+#endif
 
   NS_DISPLAY_DECL_NAME("BoxShadowOuter", TYPE_BOX_SHADOW_OUTER)
 
   void RestoreState() override {
     nsPaintedDisplayItem::RestoreState();
     mVisibleRegion.SetEmpty();
     mOpacity = 1.0f;
   }
@@ -5173,17 +5195,21 @@ class nsDisplayBoxShadowOuter final : pu
  */
 class nsDisplayBoxShadowInner : public nsPaintedDisplayItem {
  public:
   nsDisplayBoxShadowInner(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayBoxShadowInner);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayBoxShadowInner)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayBoxShadowInner() override {
+    MOZ_COUNT_DTOR(nsDisplayBoxShadowInner);
+  }
+#endif
 
   NS_DISPLAY_DECL_NAME("BoxShadowInner", TYPE_BOX_SHADOW_INNER)
 
   void RestoreState() override {
     nsPaintedDisplayItem::RestoreState();
     mVisibleRegion.SetEmpty();
   }
 
@@ -5232,17 +5258,19 @@ class nsDisplayBoxShadowInner : public n
  */
 class nsDisplayOutline final : public nsPaintedDisplayItem {
  public:
   nsDisplayOutline(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayOutline);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayOutline)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayOutline() override { MOZ_COUNT_DTOR(nsDisplayOutline); }
+#endif
 
   NS_DISPLAY_DECL_NAME("Outline", TYPE_OUTLINE)
 
   bool MustPaintOnContentSide() const override {
     MOZ_ASSERT(IsThemedOutline(),
                "The only fallback path we have is for themed outlines");
     return true;
   }
@@ -5267,17 +5295,19 @@ class nsDisplayOutline final : public ns
  */
 class nsDisplayEventReceiver final : public nsDisplayItem {
  public:
   nsDisplayEventReceiver(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
       : nsDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayEventReceiver);
   }
 
-  MOZ_COUNTED_DTOR_FINAL(nsDisplayEventReceiver)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayEventReceiver() final { MOZ_COUNT_DTOR(nsDisplayEventReceiver); }
+#endif
 
   NS_DISPLAY_DECL_NAME("EventReceiver", TYPE_EVENT_RECEIVER)
 
   void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                HitTestState* aState, nsTArray<nsIFrame*>* aOutFrames) final;
 };
 
 /**
@@ -5293,17 +5323,21 @@ class nsDisplayCompositorHitTestInfo : p
       const mozilla::gfx::CompositorHitTestInfo& aHitTestFlags,
       uint16_t aIndex = 0,
       const mozilla::Maybe<nsRect>& aArea = mozilla::Nothing());
 
   nsDisplayCompositorHitTestInfo(
       nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
       mozilla::UniquePtr<HitTestInfo>&& aHitTestInfo);
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayCompositorHitTestInfo)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayCompositorHitTestInfo() override {
+    MOZ_COUNT_DTOR(nsDisplayCompositorHitTestInfo);
+  }
+#endif
 
   NS_DISPLAY_DECL_NAME("CompositorHitTestInfo", TYPE_COMPOSITOR_HITTEST_INFO)
 
   void InitializeScrollTarget(nsDisplayListBuilder* aBuilder);
 
   bool CreateWebRenderCommands(
       mozilla::wr::DisplayListBuilder& aBuilder,
       mozilla::wr::IpcResourceUpdateQueue& aResources,
@@ -5647,17 +5681,19 @@ class nsDisplayOpacity : public nsDispla
     MOZ_COUNT_CTOR(nsDisplayOpacity);
     // We should not try to merge flattened opacities.
     MOZ_ASSERT(aOther.mChildOpacityState != ChildOpacityState::Applied);
   }
 
   void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                HitTestState* aState, nsTArray<nsIFrame*>* aOutFrames) override;
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayOpacity)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayOpacity() override { MOZ_COUNT_DTOR(nsDisplayOpacity); }
+#endif
 
   NS_DISPLAY_DECL_NAME("Opacity", TYPE_OPACITY)
 
   void RestoreState() override {
     nsDisplayWrapList::RestoreState();
     mOpacity = mState.mOpacity;
   }
 
@@ -5772,17 +5808,19 @@ class nsDisplayBlendMode : public nsDisp
   nsDisplayBlendMode(nsDisplayListBuilder* aBuilder,
                      const nsDisplayBlendMode& aOther)
       : nsDisplayWrapList(aBuilder, aOther),
         mBlendMode(aOther.mBlendMode),
         mIndex(aOther.mIndex) {
     MOZ_COUNT_CTOR(nsDisplayBlendMode);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayBlendMode)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayBlendMode() override { MOZ_COUNT_DTOR(nsDisplayBlendMode); }
+#endif
 
   NS_DISPLAY_DECL_NAME("BlendMode", TYPE_BLEND_MODE)
 
   nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                            bool* aSnap) const override;
   already_AddRefed<Layer> BuildLayer(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
       const ContainerLayerParameters& aContainerParameters) override;
@@ -5883,17 +5921,21 @@ class nsDisplayBlendContainer : public n
   static nsDisplayBlendContainer* CreateForMixBlendMode(
       nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList,
       const ActiveScrolledRoot* aActiveScrolledRoot);
 
   static nsDisplayBlendContainer* CreateForBackgroundBlendMode(
       nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList,
       const ActiveScrolledRoot* aActiveScrolledRoot);
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayBlendContainer)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayBlendContainer() override {
+    MOZ_COUNT_DTOR(nsDisplayBlendContainer);
+  }
+#endif
 
   NS_DISPLAY_DECL_NAME("BlendContainer", TYPE_BLEND_CONTAINER)
 
   already_AddRefed<Layer> BuildLayer(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
       const ContainerLayerParameters& aContainerParameters) override;
   LayerState GetLayerState(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
@@ -6054,17 +6096,19 @@ class nsDisplayOwnLayer : public nsDispl
         mFlags(aOther.mFlags),
         mScrollbarData(aOther.mScrollbarData),
         mForceActive(aOther.mForceActive),
         mWrAnimationId(aOther.mWrAnimationId),
         mIndex(aOther.mIndex) {
     MOZ_COUNT_CTOR(nsDisplayOwnLayer);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayOwnLayer)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayOwnLayer() override { MOZ_COUNT_DTOR(nsDisplayOwnLayer); }
+#endif
 
   NS_DISPLAY_DECL_NAME("OwnLayer", TYPE_OWN_LAYER)
 
   already_AddRefed<Layer> BuildLayer(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
       const ContainerLayerParameters& aContainerParameters) override;
   bool CreateWebRenderCommands(
       mozilla::wr::DisplayListBuilder& aBuilder,
@@ -6114,17 +6158,19 @@ class nsDisplayOwnLayer : public nsDispl
 };
 
 class nsDisplayRenderRoot : public nsDisplayWrapList {
   nsDisplayRenderRoot(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                       nsDisplayList* aList,
                       const ActiveScrolledRoot* aActiveScrolledRoot,
                       mozilla::wr::RenderRoot aRenderRoot);
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayRenderRoot)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayRenderRoot() override { MOZ_COUNT_DTOR(nsDisplayRenderRoot); }
+#endif
 
   NS_DISPLAY_DECL_NAME("RenderRoot", TYPE_RENDER_ROOT)
 
   void InvalidateCachedChildInfo(nsDisplayListBuilder* aBuilder) override;
   void Destroy(nsDisplayListBuilder* aBuilder) override;
   void NotifyUsed(nsDisplayListBuilder* aBuilder) override;
 
   bool UpdateScrollData(
@@ -6211,17 +6257,19 @@ class nsDisplaySubDocument : public nsDi
  * and ensure that it gets applied to all the right elements. This item creates
  * a container layer.
  */
 class nsDisplayResolution : public nsDisplaySubDocument {
  public:
   nsDisplayResolution(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                       nsSubDocumentFrame* aSubDocFrame, nsDisplayList* aList,
                       nsDisplayOwnLayerFlags aFlags);
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayResolution)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayResolution() override { MOZ_COUNT_DTOR(nsDisplayResolution); }
+#endif
 
   NS_DISPLAY_DECL_NAME("Resolution", TYPE_RESOLUTION)
 
   void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                HitTestState* aState, nsTArray<nsIFrame*>* aOutFrames) override;
   already_AddRefed<Layer> BuildLayer(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
       const ContainerLayerParameters& aContainerParameters) override;
@@ -6240,17 +6288,21 @@ class nsDisplayStickyPosition : public n
                           const ActiveScrolledRoot* aContainerASR);
   nsDisplayStickyPosition(nsDisplayListBuilder* aBuilder,
                           const nsDisplayStickyPosition& aOther)
       : nsDisplayOwnLayer(aBuilder, aOther),
         mContainerASR(aOther.mContainerASR) {
     MOZ_COUNT_CTOR(nsDisplayStickyPosition);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayStickyPosition)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayStickyPosition() override {
+    MOZ_COUNT_DTOR(nsDisplayStickyPosition);
+  }
+#endif
 
   void SetClipChain(const DisplayItemClipChain* aClipChain,
                     bool aStore) override;
 
   already_AddRefed<Layer> BuildLayer(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
       const ContainerLayerParameters& aContainerParameters) override;
   NS_DISPLAY_DECL_NAME("StickyPosition", TYPE_STICKY_POSITION)
@@ -6294,17 +6346,19 @@ class nsDisplayFixedPosition : public ns
         mIsFixedBackground(aOther.mIsFixedBackground) {
     MOZ_COUNT_CTOR(nsDisplayFixedPosition);
   }
 
   static nsDisplayFixedPosition* CreateForFixedBackground(
       nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
       nsDisplayBackgroundImage* aImage, uint16_t aIndex);
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayFixedPosition)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayFixedPosition() override { MOZ_COUNT_DTOR(nsDisplayFixedPosition); }
+#endif
 
   NS_DISPLAY_DECL_NAME("FixedPosition", TYPE_FIXED_POSITION)
 
   already_AddRefed<Layer> BuildLayer(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
       const ContainerLayerParameters& aContainerParameters) override;
 
   LayerState GetLayerState(
@@ -6402,17 +6456,21 @@ class nsDisplayTableFixedPosition : publ
  * It is used to record the existence of a scrollable frame in the layer
  * tree.
  */
 class nsDisplayScrollInfoLayer : public nsDisplayWrapList {
  public:
   nsDisplayScrollInfoLayer(nsDisplayListBuilder* aBuilder,
                            nsIFrame* aScrolledFrame, nsIFrame* aScrollFrame);
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayScrollInfoLayer)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayScrollInfoLayer() override {
+    MOZ_COUNT_DTOR(nsDisplayScrollInfoLayer);
+  }
+#endif
 
   NS_DISPLAY_DECL_NAME("ScrollInfoLayer", TYPE_SCROLL_INFO_LAYER)
 
   already_AddRefed<Layer> BuildLayer(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
       const ContainerLayerParameters& aContainerParameters) override;
 
   nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
@@ -6459,17 +6517,19 @@ class nsDisplayZoom : public nsDisplaySu
    * Add UserData to the created ContainerLayer, so that invalidations
    * for this layer are send to our nsPresContext.
    */
   nsDisplayZoom(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                 nsSubDocumentFrame* aSubDocFrame, nsDisplayList* aList,
                 int32_t aAPD, int32_t aParentAPD,
                 nsDisplayOwnLayerFlags aFlags = nsDisplayOwnLayerFlags::None);
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayZoom)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayZoom() override { MOZ_COUNT_DTOR(nsDisplayZoom); }
+#endif
 
   NS_DISPLAY_DECL_NAME("Zoom", TYPE_ZOOM)
 
   nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) const override;
   void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                HitTestState* aState, nsTArray<nsIFrame*>* aOutFrames) override;
   bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                          nsRegion* aVisibleRegion) override;
@@ -6544,17 +6604,19 @@ class nsDisplayEffectsBase : public nsDi
   nsDisplayEffectsBase(nsDisplayListBuilder* aBuilder,
                        const nsDisplayEffectsBase& aOther)
       : nsDisplayWrapList(aBuilder, aOther),
         mEffectsBounds(aOther.mEffectsBounds),
         mHandleOpacity(aOther.mHandleOpacity) {
     MOZ_COUNT_CTOR(nsDisplayEffectsBase);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayEffectsBase)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayEffectsBase() override { MOZ_COUNT_DTOR(nsDisplayEffectsBase); }
+#endif
 
   nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                            bool* aSnap) const override;
   void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                HitTestState* aState, nsTArray<nsIFrame*>* aOutFrames) override;
 
   void RestoreState() override {
     nsDisplayWrapList::RestoreState();
@@ -6602,17 +6664,21 @@ class nsDisplayMasksAndClipPaths : publi
                              nsDisplayList* aList,
                              const ActiveScrolledRoot* aActiveScrolledRoot);
   nsDisplayMasksAndClipPaths(nsDisplayListBuilder* aBuilder,
                              const nsDisplayMasksAndClipPaths& aOther)
       : nsDisplayEffectsBase(aBuilder, aOther), mDestRects(aOther.mDestRects) {
     MOZ_COUNT_CTOR(nsDisplayMasksAndClipPaths);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayMasksAndClipPaths)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayMasksAndClipPaths() override {
+    MOZ_COUNT_DTOR(nsDisplayMasksAndClipPaths);
+  }
+#endif
 
   NS_DISPLAY_DECL_NAME("Mask", TYPE_MASK)
 
   bool CanMerge(const nsDisplayItem* aItem) const override;
 
   void Merge(const nsDisplayItem* aItem) override {
     nsDisplayWrapList::Merge(aItem);
 
@@ -6687,17 +6753,21 @@ class nsDisplayBackdropRootContainer : p
  public:
   nsDisplayBackdropRootContainer(nsDisplayListBuilder* aBuilder,
                                  nsIFrame* aFrame, nsDisplayList* aList,
                                  const ActiveScrolledRoot* aActiveScrolledRoot)
       : nsDisplayWrapList(aBuilder, aFrame, aList, aActiveScrolledRoot, true) {
     MOZ_COUNT_CTOR(nsDisplayBackdropRootContainer);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayBackdropRootContainer)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayBackdropRootContainer() override {
+    MOZ_COUNT_DTOR(nsDisplayBackdropRootContainer);
+  }
+#endif
 
   NS_DISPLAY_DECL_NAME("BackdropRootContainer", TYPE_BACKDROP_ROOT_CONTAINER)
 
   already_AddRefed<Layer> BuildLayer(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
       const ContainerLayerParameters& aContainerParameters) override;
   LayerState GetLayerState(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
@@ -6719,17 +6789,21 @@ class nsDisplayBackdropFilters : public 
  public:
   nsDisplayBackdropFilters(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                            nsDisplayList* aList, const nsRect& aBackdropRect)
       : nsDisplayWrapList(aBuilder, aFrame, aList),
         mBackdropRect(aBackdropRect) {
     MOZ_COUNT_CTOR(nsDisplayBackdropFilters);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayBackdropFilters)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayBackdropFilters() override {
+    MOZ_COUNT_DTOR(nsDisplayBackdropFilters);
+  }
+#endif
 
   NS_DISPLAY_DECL_NAME("BackdropFilter", TYPE_BACKDROP_FILTER)
 
   bool CreateWebRenderCommands(
       mozilla::wr::DisplayListBuilder& aBuilder,
       mozilla::wr::IpcResourceUpdateQueue& aResources,
       const StackingContextHelper& aSc,
       mozilla::layers::RenderRootStateManager* aManager,
@@ -6760,17 +6834,19 @@ class nsDisplayFilters : public nsDispla
 
   nsDisplayFilters(nsDisplayListBuilder* aBuilder,
                    const nsDisplayFilters& aOther)
       : nsDisplayEffectsBase(aBuilder, aOther),
         mEffectsBounds(aOther.mEffectsBounds) {
     MOZ_COUNT_CTOR(nsDisplayFilters);
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayFilters)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayFilters() override { MOZ_COUNT_DTOR(nsDisplayFilters); }
+#endif
 
   NS_DISPLAY_DECL_NAME("Filter", TYPE_FILTER)
 
   bool CanMerge(const nsDisplayItem* aItem) const override {
     // Items for the same content element should be merged into a single
     // compositing group.
     return HasDifferentFrame(aItem) && HasSameTypeAndClip(aItem) &&
            HasSameContent(aItem);
@@ -6873,17 +6949,19 @@ class nsDisplayTransform : public nsDisp
                      nsDisplayList* aList, const nsRect& aChildrenBuildingRect,
                      uint16_t aIndex, bool aAllowAsyncAnimation);
 
   nsDisplayTransform(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                      nsDisplayList* aList, const nsRect& aChildrenBuildingRect,
                      uint16_t aIndex,
                      ComputeTransformFunction aTransformGetter);
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayTransform)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplayTransform() override { MOZ_COUNT_DTOR(nsDisplayTransform); }
+#endif
 
   NS_DISPLAY_DECL_NAME("nsDisplayTransform", TYPE_TRANSFORM)
 
   void RestoreState() override {
     nsDisplayHitTestInfoBase::RestoreState();
     mShouldFlatten = false;
   }
 
@@ -7299,17 +7377,19 @@ class nsDisplayPerspective : public nsDi
  * Setting none, both or only one edge is allowed.
  * The values must be non-negative.
  * The default value for both edges is zero, which means everything is painted.
  */
 class nsDisplayText final : public nsPaintedDisplayItem {
  public:
   nsDisplayText(nsDisplayListBuilder* aBuilder, nsTextFrame* aFrame,
                 const mozilla::Maybe<bool>& aIsSelected);
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayText)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayText() { MOZ_COUNT_DTOR(nsDisplayText); }
+#endif
 
   NS_DISPLAY_DECL_NAME("Text", TYPE_TEXT)
 
   void RestoreState() final {
     nsPaintedDisplayItem::RestoreState();
     mIsFrameSelected.reset();
     mOpacity = 1.0f;
   }
@@ -7423,17 +7503,19 @@ class nsDisplayText final : public nsPai
 /**
  * A display item that for webrender to handle SVG
  */
 class nsDisplaySVGWrapper : public nsDisplayWrapList {
  public:
   nsDisplaySVGWrapper(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                       nsDisplayList* aList);
 
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplaySVGWrapper)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  ~nsDisplaySVGWrapper() override { MOZ_COUNT_DTOR(nsDisplaySVGWrapper); }
+#endif
 
   NS_DISPLAY_DECL_NAME("SVGWrapper", TYPE_SVG_WRAPPER)
 
   already_AddRefed<Layer> BuildLayer(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
       const ContainerLayerParameters& aContainerParameters) override;
   LayerState GetLayerState(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
--- a/layout/style/DocumentStyleRootIterator.h
+++ b/layout/style/DocumentStyleRootIterator.h
@@ -26,17 +26,17 @@ class Element;
  * native anonymous content.
  *
  * If the caller passes an element to the constructor rather than the document,
  * that element (and nothing else) is returned from GetNextStyleRoot.
  */
 class DocumentStyleRootIterator {
  public:
   explicit DocumentStyleRootIterator(nsINode* aStyleRoot);
-  MOZ_COUNTED_DTOR(DocumentStyleRootIterator)
+  ~DocumentStyleRootIterator() { MOZ_COUNT_DTOR(DocumentStyleRootIterator); }
 
   dom::Element* GetNextStyleRoot();
 
  private:
   AutoTArray<nsIContent*, 8> mStyleRoots;
   uint32_t mPosition;
 };
 
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -160,17 +160,17 @@ class SheetLoadDataHashKey : public nsUR
         mReferrerInfo(std::move(toMove.mReferrerInfo)),
         mCORSMode(std::move(toMove.mCORSMode)),
         mParsingMode(std::move(toMove.mParsingMode)) {
     MOZ_COUNT_CTOR(SheetLoadDataHashKey);
   }
 
   explicit SheetLoadDataHashKey(css::SheetLoadData&);
 
-  MOZ_COUNTED_DTOR(SheetLoadDataHashKey)
+  ~SheetLoadDataHashKey() { MOZ_COUNT_DTOR(SheetLoadDataHashKey); }
 
   SheetLoadDataHashKey* GetKey() const {
     return const_cast<SheetLoadDataHashKey*>(this);
   }
   const SheetLoadDataHashKey* GetKeyPointer() const { return this; }
 
   bool KeyEquals(const SheetLoadDataHashKey* aKey) const {
     if (!nsURIHashKey::KeyEquals(aKey->mKey)) {
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -73,17 +73,17 @@ inline Position Position::FromPercentage
           LengthPercentage::FromPercentage(aPercent)};
 }
 
 }  // namespace mozilla
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont {
   nsStyleFont(const nsStyleFont& aStyleFont);
   explicit nsStyleFont(const mozilla::dom::Document&);
-  MOZ_COUNTED_DTOR(nsStyleFont)
+  ~nsStyleFont() { MOZ_COUNT_DTOR(nsStyleFont); }
   static constexpr bool kHasTriggerImageLoads = false;
 
   nsChangeHint CalcDifference(const nsStyleFont& aNewData) const;
 
   /**
    * Return aSize multiplied by the current text zoom factor (in aPresContext).
    * aSize is allowed to be negative, but the caller is expected to deal with
    * negative results.  The result is clamped to nscoord_MIN .. nscoord_MAX.
@@ -186,17 +186,17 @@ struct nsStyleImageLayers {
     maskMode,
     composite
   };
 
   enum class LayerType : uint8_t { Background = 0, Mask };
 
   explicit nsStyleImageLayers(LayerType aType);
   nsStyleImageLayers(const nsStyleImageLayers& aSource);
-  MOZ_COUNTED_DTOR(nsStyleImageLayers)
+  ~nsStyleImageLayers() { MOZ_COUNT_DTOR(nsStyleImageLayers); }
 
   static bool IsInitialPositionForLayerType(mozilla::Position aPosition,
                                             LayerType aType);
 
   struct Repeat {
     mozilla::StyleImageLayerRepeat mXRepeat, mYRepeat;
 
     // Initialize nothing
@@ -388,17 +388,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 
   nsStyleImageLayers mImage;
   mozilla::StyleColor mBackgroundColor;
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleMargin {
   explicit nsStyleMargin(const mozilla::dom::Document&);
   nsStyleMargin(const nsStyleMargin& aMargin);
-  MOZ_COUNTED_DTOR(nsStyleMargin)
+  ~nsStyleMargin() { MOZ_COUNT_DTOR(nsStyleMargin); }
   static constexpr bool kHasTriggerImageLoads = false;
 
   nsChangeHint CalcDifference(const nsStyleMargin& aNewData) const;
 
   bool GetMargin(nsMargin& aMargin) const {
     bool convertsToLength = mMargin.All(
         [](const auto& aLength) { return aLength.ConvertsToLength(); });
 
@@ -426,17 +426,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
 
   mozilla::StyleRect<mozilla::LengthPercentageOrAuto> mMargin;
   mozilla::StyleRect<mozilla::StyleLength> mScrollMargin;
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePadding {
   explicit nsStylePadding(const mozilla::dom::Document&);
   nsStylePadding(const nsStylePadding& aPadding);
-  MOZ_COUNTED_DTOR(nsStylePadding)
+  ~nsStylePadding() { MOZ_COUNT_DTOR(nsStylePadding); }
   static constexpr bool kHasTriggerImageLoads = false;
 
   nsChangeHint CalcDifference(const nsStylePadding& aNewData) const;
 
   mozilla::StyleRect<mozilla::NonNegativeLengthPercentage> mPadding;
   mozilla::StyleRect<mozilla::NonNegativeLengthPercentageOrAuto> mScrollPadding;
 
   inline bool IsWidthDependent() const {
@@ -635,17 +635,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   nscoord mTwipsPerPixel;
 
   nsStyleBorder& operator=(const nsStyleBorder& aOther) = delete;
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleOutline {
   explicit nsStyleOutline(const mozilla::dom::Document&);
   nsStyleOutline(const nsStyleOutline& aOutline);
-  MOZ_COUNTED_DTOR(nsStyleOutline)
+  ~nsStyleOutline() { MOZ_COUNT_DTOR(nsStyleOutline); }
   static constexpr bool kHasTriggerImageLoads = false;
 
   nsChangeHint CalcDifference(const nsStyleOutline& aNewData) const;
 
   mozilla::StyleBorderRadius mOutlineRadius;
 
   // This is the specified value of outline-width, but with length values
   // computed to absolute.  mActualOutlineWidth stores the outline-width
@@ -1007,17 +1007,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   inline bool WordCanWrap(const nsIFrame* aContextFrame) const;
 
   mozilla::LogicalSide TextEmphasisSide(mozilla::WritingMode aWM) const;
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVisibility {
   explicit nsStyleVisibility(const mozilla::dom::Document&);
   nsStyleVisibility(const nsStyleVisibility& aVisibility);
-  MOZ_COUNTED_DTOR(nsStyleVisibility)
+  ~nsStyleVisibility() { MOZ_COUNT_DTOR(nsStyleVisibility); }
   static constexpr bool kHasTriggerImageLoads = false;
 
   nsChangeHint CalcDifference(const nsStyleVisibility& aNewData) const;
 
   mozilla::StyleImageOrientation mImageOrientation;
   mozilla::StyleDirection mDirection;
   mozilla::StyleVisibility mVisible;
   mozilla::StyleImageRendering mImageRendering;
--- a/layout/svg/SVGGeometryFrame.cpp
+++ b/layout/svg/SVGGeometryFrame.cpp
@@ -61,17 +61,17 @@ class nsDisplaySVGGeometry final : publi
 
  public:
   nsDisplaySVGGeometry(nsDisplayListBuilder* aBuilder, SVGGeometryFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplaySVGGeometry);
     MOZ_ASSERT(aFrame, "Must have a frame!");
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplaySVGGeometry)
+  virtual ~nsDisplaySVGGeometry() { MOZ_COUNT_DTOR(nsDisplaySVGGeometry); }
 #endif
 
   NS_DISPLAY_DECL_NAME("nsDisplaySVGGeometry", TYPE_SVG_GEOMETRY)
 
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState,
                        nsTArray<nsIFrame*>* aOutFrames) override;
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
--- a/layout/svg/SVGObserverUtils.cpp
+++ b/layout/svg/SVGObserverUtils.cpp
@@ -51,17 +51,17 @@ class URLAndReferrerInfoHashKey : public
   explicit URLAndReferrerInfoHashKey(const URLAndReferrerInfo* aKey)
       : mKey(aKey) {
     MOZ_COUNT_CTOR(URLAndReferrerInfoHashKey);
   }
   URLAndReferrerInfoHashKey(URLAndReferrerInfoHashKey&& aToMove)
       : PLDHashEntryHdr(std::move(aToMove)), mKey(std::move(aToMove.mKey)) {
     MOZ_COUNT_CTOR(URLAndReferrerInfoHashKey);
   }
-  MOZ_COUNTED_DTOR(URLAndReferrerInfoHashKey)
+  ~URLAndReferrerInfoHashKey() { MOZ_COUNT_DTOR(URLAndReferrerInfoHashKey); }
 
   const URLAndReferrerInfo* GetKey() const { return mKey; }
 
   bool KeyEquals(const URLAndReferrerInfo* aKey) const {
     if (!mKey) {
       return !aKey;
     }
     return *mKey == *aKey;
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -2685,17 +2685,17 @@ void SVGTextDrawPathCallbacks::StrokeGeo
 class nsDisplaySVGText final : public nsPaintedDisplayItem {
  public:
   nsDisplaySVGText(nsDisplayListBuilder* aBuilder, SVGTextFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplaySVGText);
     MOZ_ASSERT(aFrame, "Must have a frame!");
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplaySVGText)
+  virtual ~nsDisplaySVGText() { MOZ_COUNT_DTOR(nsDisplaySVGText); }
 #endif
 
   NS_DISPLAY_DECL_NAME("nsDisplaySVGText", TYPE_SVG_TEXT)
 
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState,
                        nsTArray<nsIFrame*>* aOutFrames) override;
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
--- a/layout/svg/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/nsSVGOuterSVGFrame.cpp
@@ -544,17 +544,19 @@ void nsSVGOuterSVGFrame::UnionChildOverf
  * Used to paint/hit-test SVG when SVG display lists are disabled.
  */
 class nsDisplayOuterSVG final : public nsPaintedDisplayItem {
  public:
   nsDisplayOuterSVG(nsDisplayListBuilder* aBuilder, nsSVGOuterSVGFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayOuterSVG);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayOuterSVG)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayOuterSVG() { MOZ_COUNT_DTOR(nsDisplayOuterSVG); }
+#endif
 
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState,
                        nsTArray<nsIFrame*>* aOutFrames) override;
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      gfxContext* aContext) override;
 
   virtual void ComputeInvalidationRegion(
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -40,17 +40,21 @@ using namespace mozilla::gfx;
 using namespace mozilla::image;
 
 class nsDisplayTableCellSelection final : public nsPaintedDisplayItem {
  public:
   nsDisplayTableCellSelection(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayTableCellSelection);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayTableCellSelection)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayTableCellSelection() {
+    MOZ_COUNT_DTOR(nsDisplayTableCellSelection);
+  }
+#endif
 
   void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override {
     static_cast<nsTableCellFrame*>(mFrame)->DecorateForSelection(
         aCtx->GetDrawTarget(), ToReferenceFrame());
   }
   NS_DISPLAY_DECL_NAME("TableCellSelection", TYPE_TABLE_CELL_SELECTION)
 
   bool CreateWebRenderCommands(
@@ -353,17 +357,21 @@ nsresult nsTableCellFrame::ProcessBorder
 
 class nsDisplayTableCellBackground : public nsDisplayTableItem {
  public:
   nsDisplayTableCellBackground(nsDisplayListBuilder* aBuilder,
                                nsTableCellFrame* aFrame)
       : nsDisplayTableItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayTableCellBackground);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayTableCellBackground)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayTableCellBackground() {
+    MOZ_COUNT_DTOR(nsDisplayTableCellBackground);
+  }
+#endif
 
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState,
                        nsTArray<nsIFrame*>* aOutFrames) override {
     aOutFrames->AppendElement(mFrame);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1166,17 +1166,21 @@ void nsDisplayTableItem::ComputeInvalida
 // border-collapse segments into their own display items.
 class nsDisplayTableBorderCollapse final : public nsDisplayTableItem {
  public:
   nsDisplayTableBorderCollapse(nsDisplayListBuilder* aBuilder,
                                nsTableFrame* aFrame)
       : nsDisplayTableItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayTableBorderCollapse);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayTableBorderCollapse)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayTableBorderCollapse() {
+    MOZ_COUNT_DTOR(nsDisplayTableBorderCollapse);
+  }
+#endif
 
   void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   bool CreateWebRenderCommands(
       wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources,
       const StackingContextHelper& aSc,
       layers::RenderRootStateManager* aManager,
       nsDisplayListBuilder* aDisplayListBuilder) override;
   NS_DISPLAY_DECL_NAME("TableBorderCollapse", TYPE_TABLE_BORDER_COLLAPSE)
--- a/layout/xul/nsImageBoxFrame.h
+++ b/layout/xul/nsImageBoxFrame.h
@@ -150,17 +150,19 @@ class nsImageBoxFrame final : public nsL
 };  // class nsImageBoxFrame
 
 class nsDisplayXULImage final : public nsDisplayImageContainer {
  public:
   nsDisplayXULImage(nsDisplayListBuilder* aBuilder, nsImageBoxFrame* aFrame)
       : nsDisplayImageContainer(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayXULImage);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayXULImage)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayXULImage() { MOZ_COUNT_DTOR(nsDisplayXULImage); }
+#endif
 
   virtual bool CanOptimizeToImageLayer(LayerManager* aManager,
                                        nsDisplayListBuilder* aBuilder) override;
   virtual already_AddRefed<imgIContainer> GetImage() override;
   virtual nsRect GetDestRect() const override;
   virtual void UpdateDrawResult(
       mozilla::image::ImgDrawResult aResult) override {
     nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, aResult);
--- a/layout/xul/nsTextBoxFrame.cpp
+++ b/layout/xul/nsTextBoxFrame.cpp
@@ -241,17 +241,17 @@ void nsTextBoxFrame::UpdateAttributes(ns
 
 class nsDisplayXULTextBox final : public nsPaintedDisplayItem {
  public:
   nsDisplayXULTextBox(nsDisplayListBuilder* aBuilder, nsTextBoxFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayXULTextBox);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayXULTextBox)
+  virtual ~nsDisplayXULTextBox() { MOZ_COUNT_DTOR(nsDisplayXULTextBox); }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
                            bool* aSnap) const override;
   NS_DISPLAY_DECL_NAME("XULTextBox", TYPE_XUL_TEXT_BOX)
 
   virtual nsRect GetComponentAlphaBounds(
--- a/layout/xul/nsXULPopupManager.h
+++ b/layout/xul/nsXULPopupManager.h
@@ -170,17 +170,17 @@ class nsMenuChainItem {
         mIgnoreKeys(eIgnoreKeys_False),
         mFollowAnchor(false),
         mParent(nullptr),
         mChild(nullptr) {
     NS_ASSERTION(aFrame, "null frame passed to nsMenuChainItem constructor");
     MOZ_COUNT_CTOR(nsMenuChainItem);
   }
 
-  MOZ_COUNTED_DTOR(nsMenuChainItem)
+  ~nsMenuChainItem() { MOZ_COUNT_DTOR(nsMenuChainItem); }
 
   nsIContent* Content();
   nsMenuPopupFrame* Frame() { return mFrame; }
   nsPopupType PopupType() { return mPopupType; }
   bool IsNoAutoHide() { return mNoAutoHide; }
   void SetNoAutoHide(bool aNoAutoHide) { mNoAutoHide = aNoAutoHide; }
   bool IsMenu() { return mPopupType == ePopupTypeMenu; }
   bool IsContextMenu() { return mIsContext; }
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -2470,17 +2470,19 @@ nsresult nsTreeBodyFrame::HandleEvent(ns
 }
 
 class nsDisplayTreeBody final : public nsPaintedDisplayItem {
  public:
   nsDisplayTreeBody(nsDisplayListBuilder* aBuilder, nsFrame* aFrame)
       : nsPaintedDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayTreeBody);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayTreeBody)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayTreeBody() { MOZ_COUNT_DTOR(nsDisplayTreeBody); }
+#endif
 
   nsDisplayItemGeometry* AllocateGeometry(
       nsDisplayListBuilder* aBuilder) override {
     return new nsDisplayItemGenericImageGeometry(this, aBuilder);
   }
 
   void Destroy(nsDisplayListBuilder* aBuilder) override {
     aBuilder->UnregisterThemeGeometry(this);
--- a/layout/xul/tree/nsTreeColFrame.cpp
+++ b/layout/xul/tree/nsTreeColFrame.cpp
@@ -50,17 +50,21 @@ void nsTreeColFrame::DestroyFrom(nsIFram
 
 class nsDisplayXULTreeColSplitterTarget final : public nsDisplayItem {
  public:
   nsDisplayXULTreeColSplitterTarget(nsDisplayListBuilder* aBuilder,
                                     nsIFrame* aFrame)
       : nsDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayXULTreeColSplitterTarget);
   }
-  MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayXULTreeColSplitterTarget)
+#ifdef NS_BUILD_REFCNT_LOGGING
+  virtual ~nsDisplayXULTreeColSplitterTarget() {
+    MOZ_COUNT_DTOR(nsDisplayXULTreeColSplitterTarget);
+  }
+#endif
 
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState,
                        nsTArray<nsIFrame*>* aOutFrames) override;
   NS_DISPLAY_DECL_NAME("XULTreeColSplitterTarget",
                        TYPE_XUL_TREE_COL_SPLITTER_TARGET)
 };
 
--- a/media/mtransport/ipc/WebrtcTCPSocket.cpp
+++ b/media/mtransport/ipc/WebrtcTCPSocket.cpp
@@ -28,17 +28,17 @@ namespace mozilla {
 namespace net {
 
 class WebrtcTCPData {
  public:
   explicit WebrtcTCPData(nsTArray<uint8_t>&& aData) : mData(aData) {
     MOZ_COUNT_CTOR(WebrtcTCPData);
   }
 
-  MOZ_COUNTED_DTOR(WebrtcTCPData)
+  ~WebrtcTCPData() { MOZ_COUNT_DTOR(WebrtcTCPData); }
 
   const nsTArray<uint8_t>& GetData() const { return mData; }
 
  private:
   nsTArray<uint8_t> mData;
 };
 
 NS_IMPL_ISUPPORTS(WebrtcTCPSocket, nsIAuthPromptProvider,
--- a/media/mtransport/nr_socket_tcp.cpp
+++ b/media/mtransport/nr_socket_tcp.cpp
@@ -51,17 +51,17 @@ using namespace net;
 using std::shared_ptr;
 
 class NrTcpSocketData {
  public:
   explicit NrTcpSocketData(nsTArray<uint8_t>&& aData) : mData(aData) {
     MOZ_COUNT_CTOR(NrTcpSocketData);
   }
 
-  MOZ_COUNTED_DTOR(NrTcpSocketData)
+  ~NrTcpSocketData() { MOZ_COUNT_DTOR(NrTcpSocketData); }
 
   const nsTArray<uint8_t>& GetData() const { return mData; }
 
  private:
   nsTArray<uint8_t> mData;
 };
 
 NrTcpSocket::NrTcpSocket(const shared_ptr<NrSocketProxyConfig>& aConfig)
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -788,17 +788,17 @@ class MediaPipelineTransmit::VideoFrameF
     if (!mListener) {
       return;
     }
 
     mListener->OnVideoFrameConverted(aVideoFrame);
   }
 
  protected:
-  MOZ_COUNTED_DTOR_OVERRIDE(VideoFrameFeeder)
+  virtual ~VideoFrameFeeder() { MOZ_COUNT_DTOR(VideoFrameFeeder); }
 
   Mutex mMutex;  // Protects the member below.
   RefPtr<PipelineListener> mListener;
 };
 
 MediaPipelineTransmit::MediaPipelineTransmit(
     const std::string& aPc, RefPtr<MediaTransportHandler> aTransportHandler,
     RefPtr<nsISerialEventTarget> aMainThread,
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -1900,17 +1900,17 @@ class PrefCallback : public PLDHashEntry
         mStrongRef(aCopy->mStrongRef),
         mCanonical(aCopy->mCanonical) {
     MOZ_COUNT_CTOR(PrefCallback);
   }
 
   PrefCallback(const PrefCallback&) = delete;
   PrefCallback(PrefCallback&&) = default;
 
-  MOZ_COUNTED_DTOR(PrefCallback)
+  ~PrefCallback() { MOZ_COUNT_DTOR(PrefCallback); }
 
   bool KeyEquals(const PrefCallback* aKey) const {
     // We want to be able to look up a weakly-referencing PrefCallback after
     // its observer has died so we can remove it from the table. Once the
     // callback's observer dies, its canonical pointer is stale -- in
     // particular, we may have allocated a new observer in the same spot in
     // memory! So we can't just compare canonical pointers to determine whether
     // aKey refers to the same observer as this.
--- a/netwerk/base/nsURIHashKey.h
+++ b/netwerk/base/nsURIHashKey.h
@@ -23,17 +23,17 @@ class nsURIHashKey : public PLDHashEntry
 
   explicit nsURIHashKey(const nsIURI* aKey) : mKey(const_cast<nsIURI*>(aKey)) {
     MOZ_COUNT_CTOR(nsURIHashKey);
   }
   nsURIHashKey(nsURIHashKey&& toMove)
       : PLDHashEntryHdr(std::move(toMove)), mKey(std::move(toMove.mKey)) {
     MOZ_COUNT_CTOR(nsURIHashKey);
   }
-  MOZ_COUNTED_DTOR(nsURIHashKey)
+  ~nsURIHashKey() { MOZ_COUNT_DTOR(nsURIHashKey); }
 
   nsIURI* GetKey() const { return mKey; }
 
   bool KeyEquals(const nsIURI* aKey) const {
     bool eq;
     if (!mKey) {
       return !aKey;
     }
--- a/netwerk/cache/nsCacheDevice.h
+++ b/netwerk/cache/nsCacheDevice.h
@@ -18,18 +18,18 @@ class nsICacheVisitor;
 class nsIInputStream;
 class nsIOutputStream;
 
 /******************************************************************************
  * nsCacheDevice
  *******************************************************************************/
 class nsCacheDevice {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(nsCacheDevice)
-  MOZ_COUNTED_DTOR_VIRTUAL(nsCacheDevice)
+  nsCacheDevice() { MOZ_COUNT_CTOR(nsCacheDevice); }
+  virtual ~nsCacheDevice() { MOZ_COUNT_DTOR(nsCacheDevice); }
 
   virtual nsresult Init() = 0;
   virtual nsresult Shutdown() = 0;
 
   virtual const char* GetDeviceID(void) = 0;
   virtual nsCacheEntry* FindEntry(nsCString* key, bool* collision) = 0;
 
   virtual nsresult DeactivateEntry(nsCacheEntry* entry) = 0;
--- a/netwerk/cache2/CacheFileChunk.h
+++ b/netwerk/cache2/CacheFileChunk.h
@@ -107,27 +107,27 @@ class CacheFileChunkListener : public ns
   NS_IMETHOD OnChunkUpdated(CacheFileChunk* aChunk) = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(CacheFileChunkListener,
                               CACHEFILECHUNKLISTENER_IID)
 
 class ChunkListenerItem {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(ChunkListenerItem)
-  MOZ_COUNTED_DTOR(ChunkListenerItem)
+  ChunkListenerItem() { MOZ_COUNT_CTOR(ChunkListenerItem); }
+  ~ChunkListenerItem() { MOZ_COUNT_DTOR(ChunkListenerItem); }
 
   nsCOMPtr<nsIEventTarget> mTarget;
   nsCOMPtr<CacheFileChunkListener> mCallback;
 };
 
 class ChunkListeners {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(ChunkListeners)
-  MOZ_COUNTED_DTOR(ChunkListeners)
+  ChunkListeners() { MOZ_COUNT_CTOR(ChunkListeners); }
+  ~ChunkListeners() { MOZ_COUNT_DTOR(ChunkListeners); }
 
   nsTArray<ChunkListenerItem*> mItems;
 };
 
 class CacheFileChunk final : public CacheFileIOListener,
                              public CacheMemoryConsumer {
  public:
   NS_DECL_THREADSAFE_ISUPPORTS
--- a/netwerk/cache2/CacheFileIOManager.h
+++ b/netwerk/cache2/CacheFileIOManager.h
@@ -161,17 +161,17 @@ class CacheFileHandles {
     explicit HandleHashKey(KeyTypePointer aKey) {
       MOZ_COUNT_CTOR(HandleHashKey);
       mHash = MakeUnique<uint8_t[]>(SHA1Sum::kHashSize);
       memcpy(mHash.get(), aKey, sizeof(SHA1Sum::Hash));
     }
     HandleHashKey(const HandleHashKey& aOther) {
       MOZ_ASSERT_UNREACHABLE("HandleHashKey copy constructor is forbidden!");
     }
-    MOZ_COUNTED_DTOR(HandleHashKey)
+    ~HandleHashKey() { MOZ_COUNT_DTOR(HandleHashKey); }
 
     bool KeyEquals(KeyTypePointer aKey) const {
       return memcmp(mHash.get(), aKey, sizeof(SHA1Sum::Hash)) == 0;
     }
     static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; }
     static PLDHashNumber HashKey(KeyTypePointer aKey) {
       return (reinterpret_cast<const uint32_t*>(aKey))[0];
     }
--- a/netwerk/ipc/ChannelEventQueue.h
+++ b/netwerk/ipc/ChannelEventQueue.h
@@ -20,27 +20,28 @@
 
 class nsISupports;
 
 namespace mozilla {
 namespace net {
 
 class ChannelEvent {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(ChannelEvent)
-  MOZ_COUNTED_DTOR_VIRTUAL(ChannelEvent) virtual void Run() = 0;
+  ChannelEvent() { MOZ_COUNT_CTOR(ChannelEvent); }
+  virtual ~ChannelEvent() { MOZ_COUNT_DTOR(ChannelEvent); }
+  virtual void Run() = 0;
   virtual already_AddRefed<nsIEventTarget> GetEventTarget() = 0;
 };
 
 // Note that MainThreadChannelEvent should not be used in child process since
 // GetEventTarget() directly returns an unlabeled event target.
 class MainThreadChannelEvent : public ChannelEvent {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(MainThreadChannelEvent)
-  MOZ_COUNTED_DTOR_OVERRIDE(MainThreadChannelEvent)
+  MainThreadChannelEvent() { MOZ_COUNT_CTOR(MainThreadChannelEvent); }
+  virtual ~MainThreadChannelEvent() { MOZ_COUNT_DTOR(MainThreadChannelEvent); }
 
   already_AddRefed<nsIEventTarget> GetEventTarget() override {
     MOZ_ASSERT(XRE_IsParentProcess());
 
     return do_AddRef(GetMainThreadEventTarget());
   }
 };
 
--- a/netwerk/protocol/http/nsCORSListenerProxy.cpp
+++ b/netwerk/protocol/http/nsCORSListenerProxy.cpp
@@ -151,17 +151,17 @@ class nsPreflightCache {
     bool CheckRequest(const nsCString& aMethod,
                       const nsTArray<nsCString>& aCustomHeaders);
 
     nsCString mKey;
     nsTArray<TokenTime> mMethods;
     nsTArray<TokenTime> mHeaders;
   };
 
-  MOZ_COUNTED_DEFAULT_CTOR(nsPreflightCache)
+  nsPreflightCache() { MOZ_COUNT_CTOR(nsPreflightCache); }
 
   ~nsPreflightCache() {
     Clear();
     MOZ_COUNT_DTOR(nsPreflightCache);
   }
 
   bool Initialize() { return true; }
 
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -454,17 +454,17 @@ class nsWSAdmissionManager {
   }
 
   class nsOpenConn {
    public:
     nsOpenConn(nsCString& addr, WebSocketChannel* channel)
         : mAddress(addr), mChannel(channel) {
       MOZ_COUNT_CTOR(nsOpenConn);
     }
-    MOZ_COUNTED_DTOR(nsOpenConn)
+    ~nsOpenConn() { MOZ_COUNT_DTOR(nsOpenConn); }
 
     nsCString mAddress;
     WebSocketChannel* mChannel;
   };
 
   void ConnectNext(nsCString& hostName) {
     MOZ_ASSERT(NS_IsMainThread(), "not main thread");
 
--- a/netwerk/protocol/websocket/WebSocketChannelChild.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannelChild.cpp
@@ -116,18 +116,18 @@ void WebSocketChannelChild::MaybeRelease
 void WebSocketChannelChild::GetEffectiveURL(nsAString& aEffectiveURL) const {
   aEffectiveURL = mEffectiveURL;
 }
 
 bool WebSocketChannelChild::IsEncrypted() const { return mEncrypted; }
 
 class WebSocketEvent {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(WebSocketEvent)
-  MOZ_COUNTED_DTOR_VIRTUAL(WebSocketEvent)
+  WebSocketEvent() { MOZ_COUNT_CTOR(WebSocketEvent); }
+  virtual ~WebSocketEvent() { MOZ_COUNT_DTOR(WebSocketEvent); }
   virtual void Run(WebSocketChannelChild* aChild) = 0;
 };
 
 class WrappedWebSocketEvent : public Runnable {
  public:
   WrappedWebSocketEvent(WebSocketChannelChild* aChild,
                         UniquePtr<WebSocketEvent>&& aWebSocketEvent)
       : Runnable("net::WrappedWebSocketEvent"),
--- a/tools/profiler/core/RegisteredThread.h
+++ b/tools/profiler/core/RegisteredThread.h
@@ -27,17 +27,17 @@ class RacyRegisteredThread final {
       : mProfilingStackOwner(
             mozilla::MakeNotNull<RefPtr<class ProfilingStackOwner>>()),
         mThreadId(aThreadId),
         mSleep(AWAKE),
         mIsBeingProfiled(false) {
     MOZ_COUNT_CTOR(RacyRegisteredThread);
   }
 
-  MOZ_COUNTED_DTOR(RacyRegisteredThread)
+  ~RacyRegisteredThread() { MOZ_COUNT_DTOR(RacyRegisteredThread); }
 
   void SetIsBeingProfiled(bool aIsBeingProfiled) {
     mIsBeingProfiled = aIsBeingProfiled;
   }
 
   bool IsBeingProfiled() const { return mIsBeingProfiled; }
 
   // This is called on every profiler restart. Put things that should happen at
--- a/tools/profiler/core/platform-linux-android.cpp
+++ b/tools/profiler/core/platform-linux-android.cpp
@@ -124,17 +124,17 @@ static void PopulateRegsFromContext(Regi
 int tgkill(pid_t tgid, pid_t tid, int signalno) {
   return syscall(SYS_tgkill, tgid, tid, signalno);
 }
 
 class PlatformData {
  public:
   explicit PlatformData(int aThreadId) { MOZ_COUNT_CTOR(PlatformData); }
 
-  MOZ_COUNTED_DTOR(PlatformData)
+  ~PlatformData() { MOZ_COUNT_DTOR(PlatformData); }
 };
 
 ////////////////////////////////////////////////////////////////////////
 // BEGIN Sampler target specifics
 
 // The only way to reliably interrupt a Linux thread and inspect its register
 // and stack state is by sending a signal to it, and doing the work inside the
 // signal handler.  But we don't want to run much code inside the signal
--- a/uriloader/base/nsDocLoader.h
+++ b/uriloader/base/nsDocLoader.h
@@ -254,30 +254,30 @@ class nsDocLoader : public nsIDocumentLo
     nsresult mStatusCode;
     // Weak mRequest is ok; we'll be told if it decides to go away.
     nsIRequest* const mRequest;
 
     explicit nsStatusInfo(nsIRequest* aRequest)
         : mStatusCode(NS_ERROR_NOT_INITIALIZED), mRequest(aRequest) {
       MOZ_COUNT_CTOR(nsStatusInfo);
     }
-    MOZ_COUNTED_DTOR(nsStatusInfo)
+    ~nsStatusInfo() { MOZ_COUNT_DTOR(nsStatusInfo); }
   };
 
   struct nsRequestInfo : public PLDHashEntryHdr {
     explicit nsRequestInfo(const void* key)
         : mKey(key),
           mCurrentProgress(0),
           mMaxProgress(0),
           mUploading(false),
           mLastStatus(nullptr) {
       MOZ_COUNT_CTOR(nsRequestInfo);
     }
 
-    MOZ_COUNTED_DTOR(nsRequestInfo)
+    ~nsRequestInfo() { MOZ_COUNT_DTOR(nsRequestInfo); }
 
     nsIRequest* Request() {
       return static_cast<nsIRequest*>(const_cast<void*>(mKey));
     }
 
     const void* mKey;  // Must be first for the PLDHashTable stubs to work
     int64_t mCurrentProgress;
     int64_t mMaxProgress;
--- a/widget/BasicEvents.h
+++ b/widget/BasicEvents.h
@@ -500,17 +500,17 @@ class WidgetEvent : public WidgetEventTi
   WidgetEvent() : WidgetEventTime(), mPath(nullptr) {
     MOZ_COUNT_CTOR(WidgetEvent);
   }
 
  public:
   WidgetEvent(bool aIsTrusted, EventMessage aMessage)
       : WidgetEvent(aIsTrusted, aMessage, eBasicEventClass) {}
 
-  MOZ_COUNTED_DTOR_VIRTUAL(WidgetEvent)
+  virtual ~WidgetEvent() { MOZ_COUNT_DTOR(WidgetEvent); }
 
   WidgetEvent(const WidgetEvent& aOther) : WidgetEventTime() {
     MOZ_COUNT_CTOR(WidgetEvent);
     *this = aOther;
   }
   WidgetEvent& operator=(const WidgetEvent& aOther) = default;
 
   WidgetEvent(WidgetEvent&& aOther)
--- a/widget/TouchEvents.h
+++ b/widget/TouchEvents.h
@@ -140,17 +140,17 @@ class WidgetSimpleGestureEvent : public 
 
 class WidgetTouchEvent : public WidgetInputEvent {
  public:
   typedef nsTArray<RefPtr<mozilla::dom::Touch>> TouchArray;
   typedef AutoTArray<RefPtr<mozilla::dom::Touch>, 10> AutoTouchArray;
 
   virtual WidgetTouchEvent* AsTouchEvent() override { return this; }
 
-  MOZ_COUNTED_DEFAULT_CTOR(WidgetTouchEvent)
+  WidgetTouchEvent() { MOZ_COUNT_CTOR(WidgetTouchEvent); }
 
   WidgetTouchEvent(const WidgetTouchEvent& aOther)
       : WidgetInputEvent(aOther.IsTrusted(), aOther.mMessage, aOther.mWidget,
                          eTouchEventClass) {
     MOZ_COUNT_CTOR(WidgetTouchEvent);
     mModifiers = aOther.mModifiers;
     mTime = aOther.mTime;
     mTimeStamp = aOther.mTimeStamp;
@@ -160,17 +160,17 @@ class WidgetTouchEvent : public WidgetIn
   }
 
   WidgetTouchEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
       : WidgetInputEvent(aIsTrusted, aMessage, aWidget, eTouchEventClass) {
     MOZ_COUNT_CTOR(WidgetTouchEvent);
     mFlags.mCancelable = mMessage != eTouchCancel;
   }
 
-  MOZ_COUNTED_DTOR_OVERRIDE(WidgetTouchEvent)
+  virtual ~WidgetTouchEvent() { MOZ_COUNT_DTOR(WidgetTouchEvent); }
 
   virtual WidgetEvent* Duplicate() const override {
     MOZ_ASSERT(mClass == eTouchEventClass,
                "Duplicate() must be overridden by sub class");
     // Not copying widget, it is a weak reference.
     WidgetTouchEvent* result = new WidgetTouchEvent(false, mMessage, nullptr);
     result->AssignTouchEventData(*this, true);
     result->mFlags = mFlags;
--- a/xpcom/base/nsISupportsImpl.h
+++ b/xpcom/base/nsISupportsImpl.h
@@ -137,24 +137,16 @@ class nsAutoOwningThread {
       NS_LogDtor((void*)this, #_type, sizeof(*this) - sizeof(_base)); \
     } while (0)
 
 #  define MOZ_LOG_DTOR(_ptr, _name, _size)   \
     do {                                     \
       NS_LogDtor((void*)_ptr, _name, _size); \
     } while (0)
 
-#  define MOZ_COUNTED_DEFAULT_CTOR(_type) \
-    _type() { MOZ_COUNT_CTOR(_type); }
-
-#  define MOZ_COUNTED_DTOR_META(_type, _prefix, _postfix) \
-    _prefix ~_type() _postfix { MOZ_COUNT_DTOR(_type); }
-#  define MOZ_COUNTED_DTOR_NESTED(_type, _nestedName) \
-    ~_type() { MOZ_COUNT_DTOR(_nestedName); }
-
 /* nsCOMPtr.h allows these macros to be defined by clients
  * These logging functions require dynamic_cast<void*>, so they don't
  * do anything useful if we don't have dynamic_cast<void*>.
  * Note: The explicit comparison to nullptr is needed to avoid warnings
  *       when _p is a nullptr itself. */
 #  define NSCAP_LOG_ASSIGNMENT(_c, _p) \
     if (_p != nullptr) NS_LogCOMPtrAddRef((_c), ToSupports(_p))
 
@@ -166,29 +158,19 @@ class nsAutoOwningThread {
 #  define NS_LOG_ADDREF(_p, _rc, _type, _size)
 #  define NS_LOG_RELEASE(_p, _rc, _type)
 #  define MOZ_COUNT_CTOR(_type)
 #  define MOZ_COUNT_CTOR_INHERITED(_type, _base)
 #  define MOZ_LOG_CTOR(_ptr, _name, _size)
 #  define MOZ_COUNT_DTOR(_type)
 #  define MOZ_COUNT_DTOR_INHERITED(_type, _base)
 #  define MOZ_LOG_DTOR(_ptr, _name, _size)
-#  define MOZ_COUNTED_DEFAULT_CTOR(_type) _type() = default;
-#  define MOZ_COUNTED_DTOR_META(_type, _prefix, _postfix) \
-    _prefix ~_type() _postfix = default;
-#  define MOZ_COUNTED_DTOR_NESTED(_type, _nestedName) ~_type() = default;
 
 #endif /* NS_BUILD_REFCNT_LOGGING */
 
-#define MOZ_COUNTED_DTOR(_type) MOZ_COUNTED_DTOR_META(_type, , )
-#define MOZ_COUNTED_DTOR_OVERRIDE(_type) \
-  MOZ_COUNTED_DTOR_META(_type, , override)
-#define MOZ_COUNTED_DTOR_FINAL(_type) MOZ_COUNTED_DTOR_META(_type, , final)
-#define MOZ_COUNTED_DTOR_VIRTUAL(_type) MOZ_COUNTED_DTOR_META(_type, virtual, )
-
 // Support for ISupports classes which interact with cycle collector.
 
 #define NS_NUMBER_OF_FLAGS_IN_REFCNT 2
 #define NS_IN_PURPLE_BUFFER (1 << 0)
 #define NS_IS_PURPLE (1 << 1)
 #define NS_REFCOUNT_CHANGE (1 << NS_NUMBER_OF_FLAGS_IN_REFCNT)
 #define NS_REFCOUNT_VALUE(_val) (_val >> NS_NUMBER_OF_FLAGS_IN_REFCNT)
 
--- a/xpcom/build/IOInterposer.cpp
+++ b/xpcom/build/IOInterposer.cpp
@@ -75,17 +75,17 @@ class PerThreadData {
  public:
   explicit PerThreadData(bool aIsMainThread = false)
       : mIsMainThread(aIsMainThread),
         mIsHandlingObservation(false),
         mCurrentGeneration(0) {
     MOZ_COUNT_CTOR(PerThreadData);
   }
 
-  MOZ_COUNTED_DTOR(PerThreadData)
+  ~PerThreadData() { MOZ_COUNT_DTOR(PerThreadData); }
 
   void CallObservers(mozilla::IOInterposeObserver::Observation& aObservation) {
     // Prevent recursive reporting.
     if (mIsHandlingObservation) {
       return;
     }
 
     mIsHandlingObservation = true;
@@ -157,17 +157,17 @@ class PerThreadData {
 class MasterList {
  public:
   MasterList()
       : mObservedOperations(mozilla::IOInterposeObserver::OpNone),
         mIsEnabled(true) {
     MOZ_COUNT_CTOR(MasterList);
   }
 
-  MOZ_COUNTED_DTOR(MasterList)
+  ~MasterList() { MOZ_COUNT_DTOR(MasterList); }
 
   inline void Disable() { mIsEnabled = false; }
   inline void Enable() { mIsEnabled = true; }
 
   void Register(mozilla::IOInterposeObserver::Operation aOp,
                 mozilla::IOInterposeObserver* aObserver) {
     mozilla::IOInterposer::AutoLock lock(mLock);
 
--- a/xpcom/ds/nsObserverList.h
+++ b/xpcom/ds/nsObserverList.h
@@ -23,17 +23,17 @@ class nsObserverList : public nsCharPtrH
   explicit nsObserverList(const char* aKey) : nsCharPtrHashKey(aKey) {
     MOZ_COUNT_CTOR(nsObserverList);
   }
 
   nsObserverList(nsObserverList&& aOther)
       : nsCharPtrHashKey(std::move(aOther)),
         mObservers(std::move(aOther.mObservers)) {}
 
-  MOZ_COUNTED_DTOR(nsObserverList)
+  ~nsObserverList() { MOZ_COUNT_DTOR(nsObserverList); }
 
   MOZ_MUST_USE nsresult AddObserver(nsIObserver* aObserver, bool aOwnsWeak);
   MOZ_MUST_USE nsresult RemoveObserver(nsIObserver* aObserver);
 
   void NotifyObservers(nsISupports* aSubject, const char* aTopic,
                        const char16_t* aSomeData);
   void GetObserverList(nsISimpleEnumerator** aEnumerator);
 
--- a/xpcom/threads/CondVar.h
+++ b/xpcom/threads/CondVar.h
@@ -118,17 +118,17 @@ class OffTheBooksCondVar : BlockingResou
  */
 class CondVar : public OffTheBooksCondVar {
  public:
   CondVar(OffTheBooksMutex& aLock, const char* aName)
       : OffTheBooksCondVar(aLock, aName) {
     MOZ_COUNT_CTOR(CondVar);
   }
 
-  MOZ_COUNTED_DTOR(CondVar)
+  ~CondVar() { MOZ_COUNT_DTOR(CondVar); }
 
  private:
   CondVar();
   CondVar(const CondVar&);
   CondVar& operator=(const CondVar&);
 };
 
 }  // namespace mozilla
--- a/xpcom/threads/MozPromise.h
+++ b/xpcom/threads/MozPromise.h
@@ -1298,18 +1298,18 @@ class MozPromiseRequestHolder {
 // reject values are forwarded through.
 
 namespace detail {
 
 // Non-templated base class to allow us to use MOZ_COUNT_{C,D}TOR, which cause
 // assertions when used on templated types.
 class MethodCallBase {
  public:
-  MOZ_COUNTED_DEFAULT_CTOR(MethodCallBase)
-  MOZ_COUNTED_DTOR_VIRTUAL(MethodCallBase)
+  MethodCallBase() { MOZ_COUNT_CTOR(MethodCallBase); }
+  virtual ~MethodCallBase() { MOZ_COUNT_DTOR(MethodCallBase); }
 };
 
 template <typename PromiseType, typename MethodType, typename ThisType,
           typename... Storages>
 class MethodCall : public MethodCallBase {
  public:
   template <typename... Args>
   MethodCall(MethodType aMethod, ThisType* aThisVal, Args&&... aArgs)
--- a/xpcom/threads/Mutex.h
+++ b/xpcom/threads/Mutex.h
@@ -125,17 +125,17 @@ class OffTheBooksMutex : public detail::
 class Mutex : public OffTheBooksMutex {
  public:
   explicit Mutex(const char* aName, recordreplay::Behavior aRecorded =
                                         recordreplay::Behavior::Preserve)
       : OffTheBooksMutex(aName, aRecorded) {
     MOZ_COUNT_CTOR(Mutex);
   }
 
-  MOZ_COUNTED_DTOR(Mutex)
+  ~Mutex() { MOZ_COUNT_DTOR(Mutex); }
 
  private:
   Mutex();
   Mutex(const Mutex&);
   Mutex& operator=(const Mutex&);
 };
 
 template <typename T>
--- a/xpcom/threads/TaskDispatcher.h
+++ b/xpcom/threads/TaskDispatcher.h
@@ -162,17 +162,17 @@ class AutoTaskDispatcher : public TaskDi
 
  private:
   struct PerThreadTaskGroup {
    public:
     explicit PerThreadTaskGroup(AbstractThread* aThread) : mThread(aThread) {
       MOZ_COUNT_CTOR(PerThreadTaskGroup);
     }
 
-    MOZ_COUNTED_DTOR(PerThreadTaskGroup)
+    ~PerThreadTaskGroup() { MOZ_COUNT_DTOR(PerThreadTaskGroup); }
 
     RefPtr<AbstractThread> mThread;
     nsTArray<nsCOMPtr<nsIRunnable>> mStateChangeTasks;
     nsTArray<nsCOMPtr<nsIRunnable>> mRegularTasks;
   };
 
   class TaskGroupRunnable : public Runnable {
    public:
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -242,17 +242,17 @@ struct nsThreadShutdownContext {
                           bool aAwaitingShutdownAck)
       : mTerminatingThread(aTerminatingThread),
         mTerminatingPRThread(aTerminatingThread->GetPRThread()),
         mJoiningThread(aJoiningThread),
         mAwaitingShutdownAck(aAwaitingShutdownAck),
         mIsMainThreadJoining(NS_IsMainThread()) {
     MOZ_COUNT_CTOR(nsThreadShutdownContext);
   }
-  MOZ_COUNTED_DTOR(nsThreadShutdownContext)
+  ~nsThreadShutdownContext() { MOZ_COUNT_DTOR(nsThreadShutdownContext); }
 
   // NB: This will be the last reference.
   NotNull<RefPtr<nsThread>> mTerminatingThread;
   PRThread* const mTerminatingPRThread;
   NotNull<nsThread*> MOZ_UNSAFE_REF(
       "Thread manager is holding reference to joining thread") mJoiningThread;
   bool mAwaitingShutdownAck;
   bool mIsMainThreadJoining;