1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mfbt/RefCountType.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,37 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ 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 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_RefCountType_h 1.11 +#define mozilla_RefCountType_h 1.12 + 1.13 +#include <stdint.h> 1.14 + 1.15 +/** 1.16 + * MozRefCountType is Mozilla's reference count type. 1.17 + * 1.18 + * We use the same type to represent the refcount of RefCounted objects 1.19 + * as well, in order to be able to use the leak detection facilities 1.20 + * that are implemented by XPCOM. 1.21 + * 1.22 + * Note that this type is not in the mozilla namespace so that it is 1.23 + * usable for both C and C++ code. 1.24 + */ 1.25 +typedef uintptr_t MozRefCountType; 1.26 + 1.27 +/* 1.28 + * This is the return type for AddRef() and Release() in nsISupports. 1.29 + * IUnknown of COM returns an unsigned long from equivalent functions. 1.30 + * 1.31 + * The following ifdef exists to maintain binary compatibility with 1.32 + * IUnknown, the base interface in Microsoft COM. 1.33 + */ 1.34 +#ifdef XP_WIN 1.35 +typedef unsigned long MozExternalRefCountType; 1.36 +#else 1.37 +typedef uint32_t MozExternalRefCountType; 1.38 +#endif 1.39 + 1.40 +#endif