NonRefcountedDOMObject.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  4. * You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_dom_NonRefcountedDOMObject_h__
  6. #define mozilla_dom_NonRefcountedDOMObject_h__
  7. #include "nsISupportsImpl.h"
  8. namespace mozilla {
  9. namespace dom {
  10. // Natives for DOM classes that aren't refcounted need to inherit from this
  11. // class.
  12. // If you're seeing objects of this class leak then natives for one of the DOM
  13. // classes inheriting from it is leaking. If the native for that class has
  14. // MOZ_COUNT_CTOR/DTOR in its constructor/destructor then it should show up in
  15. // the leak log too.
  16. class NonRefcountedDOMObject
  17. {
  18. protected:
  19. NonRefcountedDOMObject()
  20. {
  21. MOZ_COUNT_CTOR(NonRefcountedDOMObject);
  22. }
  23. ~NonRefcountedDOMObject()
  24. {
  25. MOZ_COUNT_DTOR(NonRefcountedDOMObject);
  26. }
  27. };
  28. } // namespace dom
  29. } // namespace mozilla
  30. #endif /* mozilla_dom_NonRefcountedDOMObject_h__ */