RefCountType.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
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_RefCountType_h
  6. #define mozilla_RefCountType_h
  7. #include <stdint.h>
  8. /**
  9. * MozRefCountType is Mozilla's reference count type.
  10. *
  11. * We use the same type to represent the refcount of RefCounted objects
  12. * as well, in order to be able to use the leak detection facilities
  13. * that are implemented by XPCOM.
  14. *
  15. * Note that this type is not in the mozilla namespace so that it is
  16. * usable for both C and C++ code.
  17. */
  18. typedef uintptr_t MozRefCountType;
  19. /*
  20. * This is the return type for AddRef() and Release() in nsISupports.
  21. * IUnknown of COM returns an unsigned long from equivalent functions.
  22. *
  23. * The following ifdef exists to maintain binary compatibility with
  24. * IUnknown, the base interface in Microsoft COM.
  25. */
  26. #ifdef XP_WIN
  27. typedef unsigned long MozExternalRefCountType;
  28. #else
  29. typedef uint32_t MozExternalRefCountType;
  30. #endif
  31. #endif