Bug 545892 - Always pass WM_NCPAINT events to the default event procedure. r=bent...
[mozilla-central.git] / xpcom / glue / nsTraceRefcnt.h
blobff4e94b9e847b6d21db769f1dcd3763721c8844b
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is Mozilla Communicator client code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * L. David Baron <dbaron@dbaron.org>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
38 #ifndef nsTraceRefcnt_h___
39 #define nsTraceRefcnt_h___
41 #include "nsXPCOM.h"
43 #ifdef NS_BUILD_REFCNT_LOGGING
45 #define NS_LOG_ADDREF(_p, _rc, _type, _size) \
46 NS_LogAddRef((_p), (_rc), (_type), (PRUint32) (_size))
48 #define NS_LOG_RELEASE(_p, _rc, _type) \
49 NS_LogRelease((_p), (_rc), (_type))
51 #define MOZ_COUNT_CTOR(_type) \
52 PR_BEGIN_MACRO \
53 NS_LogCtor((void*)this, #_type, sizeof(*this)); \
54 PR_END_MACRO
56 #define MOZ_COUNT_DTOR(_type) \
57 PR_BEGIN_MACRO \
58 NS_LogDtor((void*)this, #_type, sizeof(*this)); \
59 PR_END_MACRO
61 /* nsCOMPtr.h allows these macros to be defined by clients
62 * These logging functions require dynamic_cast<void*>, so they don't
63 * do anything useful if we don't have dynamic_cast<void*>. */
64 #define NSCAP_LOG_ASSIGNMENT(_c, _p) \
65 if (_p) \
66 NS_LogCOMPtrAddRef((_c),static_cast<nsISupports*>(_p))
68 #define NSCAP_LOG_RELEASE(_c, _p) \
69 if (_p) \
70 NS_LogCOMPtrRelease((_c), static_cast<nsISupports*>(_p))
72 #else /* !NS_BUILD_REFCNT_LOGGING */
74 #define NS_LOG_ADDREF(_p, _rc, _type, _size)
75 #define NS_LOG_RELEASE(_p, _rc, _type)
76 #define MOZ_COUNT_CTOR(_type)
77 #define MOZ_COUNT_DTOR(_type)
79 #endif /* NS_BUILD_REFCNT_LOGGING */
81 #ifdef __cplusplus
83 class nsTraceRefcnt {
84 public:
85 inline static void LogAddRef(void* aPtr, nsrefcnt aNewRefCnt,
86 const char* aTypeName, PRUint32 aInstanceSize) {
87 NS_LogAddRef(aPtr, aNewRefCnt, aTypeName, aInstanceSize);
90 inline static void LogRelease(void* aPtr, nsrefcnt aNewRefCnt,
91 const char* aTypeName) {
92 NS_LogRelease(aPtr, aNewRefCnt, aTypeName);
95 inline static void LogCtor(void* aPtr, const char* aTypeName,
96 PRUint32 aInstanceSize) {
97 NS_LogCtor(aPtr, aTypeName, aInstanceSize);
100 inline static void LogDtor(void* aPtr, const char* aTypeName,
101 PRUint32 aInstanceSize) {
102 NS_LogDtor(aPtr, aTypeName, aInstanceSize);
105 inline static void LogAddCOMPtr(void *aCOMPtr, nsISupports *aObject) {
106 NS_LogCOMPtrAddRef(aCOMPtr, aObject);
109 inline static void LogReleaseCOMPtr(void *aCOMPtr, nsISupports *aObject) {
110 NS_LogCOMPtrRelease(aCOMPtr, aObject);
114 #endif /* defined(__cplusplus) */
116 #endif /* nsTraceRefcnt_h___ */