dom/bindings/NonRefcountedDOMObject.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/bindings/NonRefcountedDOMObject.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
     1.5 +/* vim: set ts=2 sw=2 et tw=79: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef mozilla_dom_NonRefcountedDOMObject_h__
    1.11 +#define mozilla_dom_NonRefcountedDOMObject_h__
    1.12 +
    1.13 +#include "nsISupportsImpl.h"
    1.14 +
    1.15 +namespace mozilla {
    1.16 +namespace dom {
    1.17 +
    1.18 +// Natives for DOM classes with 'owned' as the value for nativeOwnership in
    1.19 +// Bindings.conf need to inherit from this class.
    1.20 +// If you're seeing objects of this class leak then natives for one of the DOM
    1.21 +// classes with 'owned' as the value for nativeOwnership in Bindings.conf is
    1.22 +// leaking. If the native for that class has MOZ_COUNT_CTOR/DTOR in its
    1.23 +// constructor/destructor then it should show up in the leak log too.
    1.24 +class NonRefcountedDOMObject
    1.25 +{
    1.26 +protected:
    1.27 +  NonRefcountedDOMObject()
    1.28 +  {
    1.29 +    MOZ_COUNT_CTOR(NonRefcountedDOMObject);
    1.30 +  }
    1.31 +  ~NonRefcountedDOMObject()
    1.32 +  {
    1.33 +    MOZ_COUNT_DTOR(NonRefcountedDOMObject);
    1.34 +  }
    1.35 +};
    1.36 +
    1.37 +} // namespace dom
    1.38 +} // namespace mozilla
    1.39 +
    1.40 +#endif /* mozilla_dom_NonRefcountedDOMObject_h__ */

mercurial