зеркало из https://github.com/mozilla/pjs.git
Followup to bug 348748 to fix the alignment of trailing backslashes in macros
[xxx_cast<foo*>(bar) is three characters shorter than NS_XXX_CAST(foo*, bar)]
This commit is contained in:
Родитель
c830b1f1d7
Коммит
11d0936e48
|
@ -1205,7 +1205,7 @@ private:
|
|||
|
||||
#define NS_INTERFACE_MAP_ENTRY_TEAROFF(_interface, _allocator) \
|
||||
if (aIID.Equals(NS_GET_IID(_interface))) { \
|
||||
foundInterface = static_cast<_interface *>(_allocator); \
|
||||
foundInterface = static_cast<_interface *>(_allocator); \
|
||||
if (!foundInterface) { \
|
||||
*aInstancePtr = nsnull; \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
|
|
|
@ -1103,7 +1103,7 @@ NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, PRBool aFromParser)\
|
|||
if (NS_SUCCEEDED(rv)) \
|
||||
return rv; \
|
||||
\
|
||||
rv = DOMQueryInterface(static_cast<_base_if *>(this), aIID, \
|
||||
rv = DOMQueryInterface(static_cast<_base_if *>(this), aIID, \
|
||||
aInstancePtr); \
|
||||
\
|
||||
if (NS_SUCCEEDED(rv)) \
|
||||
|
@ -1134,7 +1134,7 @@ NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, PRBool aFromParser)\
|
|||
if (NS_SUCCEEDED(rv)) \
|
||||
return rv; \
|
||||
\
|
||||
rv = DOMQueryInterface(static_cast<_base_if *>(this), aIID, \
|
||||
rv = DOMQueryInterface(static_cast<_base_if *>(this), aIID, \
|
||||
aInstancePtr); \
|
||||
\
|
||||
if (NS_SUCCEEDED(rv)) \
|
||||
|
|
|
@ -48,12 +48,12 @@
|
|||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
#define LOG_CHUNK_MOVE(_start, _new_start, _count) \
|
||||
{ \
|
||||
txXPathNode *start = const_cast<txXPathNode*>(_start); \
|
||||
txXPathNode *start = const_cast<txXPathNode*>(_start); \
|
||||
while (start < _start + _count) { \
|
||||
NS_LogDtor(start, "txXPathNode", sizeof(*start)); \
|
||||
++start; \
|
||||
} \
|
||||
start = const_cast<txXPathNode*>(_new_start); \
|
||||
start = const_cast<txXPathNode*>(_new_start); \
|
||||
while (start < _new_start + _count) { \
|
||||
NS_LogCtor(start, "txXPathNode", sizeof(*start)); \
|
||||
++start; \
|
||||
|
|
|
@ -904,7 +904,7 @@ nsClipboardDragDropHookCommand::GetCommandStateParams(const char *aCommandName,
|
|||
NS_NEWXPCOM(theCmd, _cmdClass); \
|
||||
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
|
||||
rv = inCommandTable->RegisterCommand(_cmdName, \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
}
|
||||
|
||||
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
|
||||
|
@ -921,7 +921,7 @@ nsClipboardDragDropHookCommand::GetCommandStateParams(const char *aCommandName,
|
|||
|
||||
#define NS_REGISTER_LAST_COMMAND(_cmdClass, _cmdName) \
|
||||
rv = inCommandTable->RegisterCommand(_cmdName, \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
NS_NEWXPCOM(theCmd, _cmdClass); \
|
||||
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
|
||||
rv = inCommandTable->RegisterCommand(_cmdName, \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
}
|
||||
|
||||
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
|
||||
|
@ -65,7 +65,7 @@
|
|||
|
||||
#define NS_REGISTER_LAST_COMMAND(_cmdClass, _cmdName) \
|
||||
rv = inCommandTable->RegisterCommand(_cmdName, \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
}
|
||||
|
||||
#define NS_REGISTER_STYLE_COMMAND(_cmdClass, _cmdName, _styleTag) \
|
||||
|
@ -73,7 +73,7 @@
|
|||
_cmdClass* theCmd = new _cmdClass(_styleTag); \
|
||||
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
|
||||
rv = inCommandTable->RegisterCommand(_cmdName, \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
}
|
||||
|
||||
#define NS_REGISTER_TAG_COMMAND(_cmdClass, _cmdName, _tagName) \
|
||||
|
@ -81,7 +81,7 @@
|
|||
_cmdClass* theCmd = new _cmdClass(_tagName); \
|
||||
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
|
||||
rv = inCommandTable->RegisterCommand(_cmdName, \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
NS_NEWXPCOM(theCmd, _cmdClass); \
|
||||
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
|
||||
rv = inCommandTable->RegisterCommand(_cmdName, \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
}
|
||||
|
||||
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
|
||||
|
@ -68,7 +68,7 @@
|
|||
|
||||
#define NS_REGISTER_LAST_COMMAND(_cmdClass, _cmdName) \
|
||||
rv = inCommandTable->RegisterCommand(_cmdName, \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1307,7 +1307,7 @@ static nsresult EncodeArray(nsISOAPEncoding* aEncoding, nsIVariant* aSource, nsI
|
|||
|
||||
#define ENCODE_SIMPLE_ARRAY(XPType, VType, Source) \
|
||||
{ \
|
||||
XPType* values = static_cast<XPType*>(array); \
|
||||
XPType* values = static_cast<XPType*>(array); \
|
||||
nsCOMPtr<nsIWritableVariant> p = \
|
||||
do_CreateInstance(NS_VARIANT_CONTRACTID, &rc); \
|
||||
if (NS_FAILED(rc)) break; \
|
||||
|
|
|
@ -91,7 +91,7 @@ STDMETHODIMP _class::QueryInterface(REFIID aIID, void** aInstancePtr) \
|
|||
|
||||
#define NS_IMPL_COM_QUERY_BODY(_interface) \
|
||||
if(IsEqualIID(aIID, __uuidof(_interface)) ) \
|
||||
foundInterface = static_cast<_interface*>(this); \
|
||||
foundInterface = static_cast<_interface*>(this); \
|
||||
else
|
||||
|
||||
#define NS_IMPL_COM_QUERY_TAIL_GUTS \
|
||||
|
|
|
@ -122,7 +122,7 @@ nsXPCComponents_Interfaces::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
|
|||
PRUint32 index = 0;
|
||||
nsIID* clone;
|
||||
#define PUSH_IID(id) \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
sizeof(nsIID))); \
|
||||
if (!clone) \
|
||||
goto oom; \
|
||||
|
@ -467,7 +467,7 @@ nsXPCComponents_InterfacesByID::GetInterfaces(PRUint32 *aCount, nsIID * **aArray
|
|||
PRUint32 index = 0;
|
||||
nsIID* clone;
|
||||
#define PUSH_IID(id) \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
sizeof(nsIID))); \
|
||||
if (!clone) \
|
||||
goto oom; \
|
||||
|
@ -798,7 +798,7 @@ nsXPCComponents_Classes::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
|
|||
PRUint32 index = 0;
|
||||
nsIID* clone;
|
||||
#define PUSH_IID(id) \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
sizeof(nsIID))); \
|
||||
if (!clone) \
|
||||
goto oom; \
|
||||
|
@ -1053,7 +1053,7 @@ nsXPCComponents_ClassesByID::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
|
|||
PRUint32 index = 0;
|
||||
nsIID* clone;
|
||||
#define PUSH_IID(id) \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
sizeof(nsIID))); \
|
||||
if (!clone) \
|
||||
goto oom; \
|
||||
|
@ -1327,7 +1327,7 @@ nsXPCComponents_Results::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
|
|||
PRUint32 index = 0;
|
||||
nsIID* clone;
|
||||
#define PUSH_IID(id) \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
sizeof(nsIID))); \
|
||||
if (!clone) \
|
||||
goto oom; \
|
||||
|
@ -1559,7 +1559,7 @@ nsXPCComponents_ID::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
|
|||
PRUint32 index = 0;
|
||||
nsIID* clone;
|
||||
#define PUSH_IID(id) \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
sizeof(nsIID))); \
|
||||
if (!clone) \
|
||||
goto oom; \
|
||||
|
@ -1786,7 +1786,7 @@ nsXPCComponents_Exception::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
|
|||
PRUint32 index = 0;
|
||||
nsIID* clone;
|
||||
#define PUSH_IID(id) \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
sizeof(nsIID))); \
|
||||
if (!clone) \
|
||||
goto oom; \
|
||||
|
@ -2079,7 +2079,7 @@ nsXPCConstructor::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
|
|||
PRUint32 index = 0;
|
||||
nsIID* clone;
|
||||
#define PUSH_IID(id) \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
sizeof(nsIID))); \
|
||||
if (!clone) \
|
||||
goto oom; \
|
||||
|
@ -2344,7 +2344,7 @@ nsXPCComponents_Constructor::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
|
|||
PRUint32 index = 0;
|
||||
nsIID* clone;
|
||||
#define PUSH_IID(id) \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
sizeof(nsIID))); \
|
||||
if (!clone) \
|
||||
goto oom; \
|
||||
|
@ -3678,7 +3678,7 @@ nsXPCComponents::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
|
|||
PRUint32 index = 0;
|
||||
nsIID* clone;
|
||||
#define PUSH_IID(id) \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
sizeof(nsIID))); \
|
||||
if (!clone) \
|
||||
goto oom; \
|
||||
|
|
|
@ -100,7 +100,7 @@ BackstagePass::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
|
|||
PRUint32 index = 0;
|
||||
nsIID* clone;
|
||||
#define PUSH_IID(id) \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
|
||||
sizeof(nsIID))); \
|
||||
if (!clone) \
|
||||
goto oom; \
|
||||
|
|
|
@ -44,7 +44,7 @@ bool CompareVariant(const _variant_t & left, const _variant_t & right)
|
|||
#define CompareFunction(type) \
|
||||
bool CompareVariant##type(const _variant_t & left, const _variant_t & right) \
|
||||
{ \
|
||||
return static_cast<type>(left) == static_cast<type>(right); \
|
||||
return static_cast<type>(left) == static_cast<type>(right); \
|
||||
}
|
||||
|
||||
CompareFunction(long);
|
||||
|
|
|
@ -616,7 +616,7 @@ public:
|
|||
#else
|
||||
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
|
||||
const nsStyle##name_ * GetStyle##name_ () const { \
|
||||
return static_cast<const nsStyle##name_*>(\
|
||||
return static_cast<const nsStyle##name_*>( \
|
||||
GetStyleDataExternal(eStyleStruct_##name_)); \
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1763,7 +1763,7 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
|
|||
nsStyleContext* parentContext = aContext->GetParent(); \
|
||||
\
|
||||
const nsRuleData##rdtype_& rdata_ = \
|
||||
static_cast<const nsRuleData##rdtype_&>(aData); \
|
||||
static_cast<const nsRuleData##rdtype_&>(aData); \
|
||||
nsStyle##type_* data_ = nsnull; \
|
||||
const nsStyle##type_* parentdata_ = nsnull; \
|
||||
PRBool inherited = aInherited; \
|
||||
|
@ -1774,7 +1774,7 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
|
|||
/* We only need to compute the delta between this computed data and */ \
|
||||
/* our computed data. */ \
|
||||
data_ = new (mPresContext) \
|
||||
nsStyle##type_(*static_cast<nsStyle##type_*>(aStartStruct)); \
|
||||
nsStyle##type_(*static_cast<nsStyle##type_*>(aStartStruct)); \
|
||||
else { \
|
||||
/* XXXldb What about eRuleFullInherited? Which path is faster? */ \
|
||||
if (aRuleDetail != eRuleFullMixed && aRuleDetail != eRuleFullReset) { \
|
||||
|
@ -1811,13 +1811,13 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
|
|||
nsStyleContext* parentContext = aContext->GetParent(); \
|
||||
\
|
||||
const nsRuleData##rdtype_& rdata_ = \
|
||||
static_cast<const nsRuleData##rdtype_&>(aData); \
|
||||
static_cast<const nsRuleData##rdtype_&>(aData); \
|
||||
nsStyle##type_* data_; \
|
||||
if (aStartStruct) \
|
||||
/* We only need to compute the delta between this computed data and */ \
|
||||
/* our computed data. */ \
|
||||
data_ = new (mPresContext) \
|
||||
nsStyle##type_(*static_cast<nsStyle##type_*>(aStartStruct)); \
|
||||
nsStyle##type_(*static_cast<nsStyle##type_*>(aStartStruct)); \
|
||||
else \
|
||||
data_ = new (mPresContext) nsStyle##type_ ctorargs_; \
|
||||
\
|
||||
|
@ -4644,14 +4644,14 @@ nsRuleNode::GetStyle##name_(nsStyleContext* aContext, PRBool aComputeData) \
|
|||
return nsnull; \
|
||||
\
|
||||
data = \
|
||||
static_cast<const nsStyle##name_ *>(Get##name_##Data(aContext)); \
|
||||
static_cast<const nsStyle##name_ *>(Get##name_##Data(aContext)); \
|
||||
\
|
||||
if (NS_LIKELY(data != nsnull)) \
|
||||
return data; \
|
||||
\
|
||||
NS_NOTREACHED("could not create style struct"); \
|
||||
return \
|
||||
static_cast<const nsStyle##name_ *>(\
|
||||
static_cast<const nsStyle##name_ *>( \
|
||||
mPresContext->PresShell()->StyleSet()-> \
|
||||
DefaultStyleData()->GetStyleData(eStyleStruct_##name_)); \
|
||||
}
|
||||
|
|
|
@ -268,7 +268,7 @@ nsStyleContext::GetUniqueStyleData(const nsStyleStructID& aSID)
|
|||
#define UNIQUE_CASE(c_) \
|
||||
case eStyleStruct_##c_: \
|
||||
result = new (presContext) nsStyle##c_( \
|
||||
* static_cast<const nsStyle##c_ *>(current)); \
|
||||
* static_cast<const nsStyle##c_ *>(current)); \
|
||||
break;
|
||||
|
||||
UNIQUE_CASE(Display)
|
||||
|
@ -437,7 +437,7 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther)
|
|||
NS_ASSERTION(NS_IsHintSubset(nsStyle##struct_::MaxDifference(), maxHint), \
|
||||
"Struct placed in the wrong maxHint section"); \
|
||||
const nsStyle##struct_* this##struct_ = \
|
||||
static_cast<const nsStyle##struct_*>(\
|
||||
static_cast<const nsStyle##struct_*>( \
|
||||
PeekStyleData(eStyleStruct_##struct_)); \
|
||||
if (this##struct_) { \
|
||||
const nsStyle##struct_* other##struct_ = aOther->GetStyle##struct_(); \
|
||||
|
|
|
@ -173,23 +173,23 @@ public:
|
|||
|
||||
#define LOG_SCOPE(l, s) \
|
||||
LogScope LOG_SCOPE_TMP_VAR ##__LINE__ (l, \
|
||||
static_cast<void *>(this), \
|
||||
static_cast<void *>(this), \
|
||||
NS_LITERAL_CSTRING(s))
|
||||
|
||||
#define LOG_SCOPE_WITH_PARAM(l, s, pn, pv) \
|
||||
LogScope LOG_SCOPE_TMP_VAR ##__LINE__ (l, \
|
||||
static_cast<void *>(this), \
|
||||
static_cast<void *>(this), \
|
||||
NS_LITERAL_CSTRING(s), \
|
||||
NS_LITERAL_CSTRING(pn), pv)
|
||||
|
||||
#define LOG_FUNC(l, s) \
|
||||
LogFunc(l, \
|
||||
static_cast<void *>(this), \
|
||||
static_cast<void *>(this), \
|
||||
NS_LITERAL_CSTRING(s))
|
||||
|
||||
#define LOG_FUNC_WITH_PARAM(l, s, pn, pv) \
|
||||
LogFunc(l, \
|
||||
static_cast<void *>(this), \
|
||||
static_cast<void *>(this), \
|
||||
NS_LITERAL_CSTRING(s), \
|
||||
NS_LITERAL_CSTRING(pn), pv)
|
||||
|
||||
|
@ -208,7 +208,7 @@ public:
|
|||
|
||||
#define LOG_MSG(l, s, m) \
|
||||
LogMessage(l, \
|
||||
static_cast<void *>(this), \
|
||||
static_cast<void *>(this), \
|
||||
NS_LITERAL_CSTRING(s), \
|
||||
NS_LITERAL_CSTRING(m))
|
||||
|
||||
|
|
|
@ -300,10 +300,10 @@ _class::AggregatedQueryInterface(REFNSIID aIID, void** aInstancePtr) \
|
|||
(void *p, \
|
||||
nsCycleCollectionTraversalCallback &cb) \
|
||||
{ \
|
||||
nsISupports *s = static_cast<nsISupports*>(p); \
|
||||
nsISupports *s = static_cast<nsISupports*>(p); \
|
||||
NS_ASSERTION(CheckForRightISupports(s), \
|
||||
"not the nsISupports pointer we expect"); \
|
||||
_class *tmp = static_cast<_class*>(Downcast(s)); \
|
||||
_class *tmp = static_cast<_class*>(Downcast(s)); \
|
||||
if (!tmp->IsPartOfAggregated()) \
|
||||
NS_IMPL_CYCLE_COLLECTION_DESCRIBE(_class)
|
||||
|
||||
|
|
|
@ -1,476 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsCycleCollectionParticipant_h__
|
||||
#define nsCycleCollectionParticipant_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
#define NS_CYCLECOLLECTIONPARTICIPANT_IID \
|
||||
{ \
|
||||
0x8057ad9e, \
|
||||
0x3ecc, \
|
||||
0x4e89, \
|
||||
{ 0x89, 0xac, 0x0a, 0x71, 0xf3, 0x8b, 0x14, 0xc2 } \
|
||||
}
|
||||
|
||||
/**
|
||||
* Special IID to get at the base nsISupports for a class. Usually this is the
|
||||
* canonical nsISupports pointer, but in the case of tearoffs for example it is
|
||||
* the base nsISupports pointer of the tearoff. This allow the cycle collector
|
||||
* to have separate nsCycleCollectionParticipant's for tearoffs or aggregated
|
||||
* classes.
|
||||
*/
|
||||
#define NS_CYCLECOLLECTIONISUPPORTS_IID \
|
||||
{ \
|
||||
0xc61eac14, \
|
||||
0x5f7a, \
|
||||
0x4481, \
|
||||
{ 0x96, 0x5e, 0x7e, 0xaa, 0x6e, 0xff, 0xa8, 0x5f } \
|
||||
}
|
||||
|
||||
/**
|
||||
* Just holds the IID so NS_GET_IID works.
|
||||
*/
|
||||
class NS_COM nsCycleCollectionISupports
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_CYCLECOLLECTIONISUPPORTS_IID)
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsCycleCollectionISupports,
|
||||
NS_CYCLECOLLECTIONISUPPORTS_IID)
|
||||
|
||||
#undef IMETHOD_VISIBILITY
|
||||
#define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT
|
||||
|
||||
class nsCycleCollectionParticipant;
|
||||
|
||||
struct nsCycleCollectionTraversalCallback
|
||||
{
|
||||
// You must call DescribeNode() with an accurate refcount,
|
||||
// otherwise cycle collection will fail, and probably crash.
|
||||
#ifdef DEBUG_CC
|
||||
virtual void DescribeNode(size_t refcount,
|
||||
size_t objsz,
|
||||
const char *objname) = 0;
|
||||
#else
|
||||
virtual void DescribeNode(size_t refcount) = 0;
|
||||
#endif
|
||||
virtual void NoteScriptChild(PRUint32 langID, void *child) = 0;
|
||||
virtual void NoteXPCOMChild(nsISupports *child) = 0;
|
||||
virtual void NoteNativeChild(void *child,
|
||||
nsCycleCollectionParticipant *helper) = 0;
|
||||
};
|
||||
|
||||
class NS_NO_VTABLE nsCycleCollectionParticipant
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD Traverse(void *p, nsCycleCollectionTraversalCallback &cb) = 0;
|
||||
|
||||
NS_IMETHOD Root(void *p) = 0;
|
||||
NS_IMETHOD Unlink(void *p) = 0;
|
||||
NS_IMETHOD Unroot(void *p) = 0;
|
||||
};
|
||||
|
||||
class NS_COM nsXPCOMCycleCollectionParticipant
|
||||
: public nsCycleCollectionParticipant
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_CYCLECOLLECTIONPARTICIPANT_IID)
|
||||
|
||||
NS_IMETHOD Traverse(void *p, nsCycleCollectionTraversalCallback &cb);
|
||||
|
||||
NS_IMETHOD Root(void *p);
|
||||
NS_IMETHOD Unlink(void *p);
|
||||
NS_IMETHOD Unroot(void *p);
|
||||
|
||||
NS_IMETHOD_(void) UnmarkPurple(nsISupports *p);
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_EXTERNAL_VIS_(PRBool) CheckForRightISupports(nsISupports *s);
|
||||
#endif
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsXPCOMCycleCollectionParticipant,
|
||||
NS_CYCLECOLLECTIONPARTICIPANT_IID)
|
||||
|
||||
#undef IMETHOD_VISIBILITY
|
||||
#define IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Helpers for implementing a QI to nsXPCOMCycleCollectionParticipant
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define NS_CYCLE_COLLECTION_INNERCLASS \
|
||||
cycleCollection
|
||||
|
||||
#define NS_CYCLE_COLLECTION_CLASSNAME(_class) \
|
||||
_class::NS_CYCLE_COLLECTION_INNERCLASS
|
||||
|
||||
#define NS_CYCLE_COLLECTION_NAME(_class) \
|
||||
_class##_cycleCollectorGlobal
|
||||
|
||||
#define NS_IMPL_QUERY_CYCLE_COLLECTION(_class) \
|
||||
if ( aIID.Equals(NS_GET_IID(nsXPCOMCycleCollectionParticipant)) ) { \
|
||||
*aInstancePtr = & NS_CYCLE_COLLECTION_NAME(_class); \
|
||||
return NS_OK; \
|
||||
} else
|
||||
|
||||
#define NS_IMPL_QUERY_CYCLE_COLLECTION_ISUPPORTS(_class) \
|
||||
if ( aIID.Equals(NS_GET_IID(nsCycleCollectionISupports)) ) \
|
||||
foundInterface = NS_CYCLE_COLLECTION_CLASSNAME(_class)::Upcast(this); \
|
||||
else
|
||||
|
||||
#define NS_INTERFACE_MAP_ENTRY_CYCLE_COLLECTION(_class) \
|
||||
NS_IMPL_QUERY_CYCLE_COLLECTION(_class)
|
||||
|
||||
#define NS_INTERFACE_MAP_ENTRY_CYCLE_COLLECTION_ISUPPORTS(_class) \
|
||||
NS_IMPL_QUERY_CYCLE_COLLECTION_ISUPPORTS(_class)
|
||||
|
||||
#define NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(_class) \
|
||||
NS_INTERFACE_MAP_ENTRY_CYCLE_COLLECTION(_class) \
|
||||
NS_INTERFACE_MAP_ENTRY_CYCLE_COLLECTION_ISUPPORTS(_class)
|
||||
|
||||
#define NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(_class) \
|
||||
NS_INTERFACE_MAP_BEGIN(_class) \
|
||||
NS_INTERFACE_MAP_ENTRY_CYCLE_COLLECTION(_class) \
|
||||
NS_INTERFACE_MAP_ENTRY_CYCLE_COLLECTION_ISUPPORTS(_class)
|
||||
|
||||
#define NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(_class) \
|
||||
NS_INTERFACE_MAP_BEGIN(_class) \
|
||||
NS_INTERFACE_MAP_ENTRY_CYCLE_COLLECTION(_class)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Helpers for implementing nsCycleCollectionParticipant::Unlink
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(_class) \
|
||||
NS_IMETHODIMP \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Unlink(void *p) \
|
||||
{ \
|
||||
nsISupports *s = static_cast<nsISupports*>(p); \
|
||||
NS_ASSERTION(CheckForRightISupports(s), \
|
||||
"not the nsISupports pointer we expect"); \
|
||||
_class *tmp = Downcast(s);
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(_class, _base_class) \
|
||||
NS_IMETHODIMP \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Unlink(void *p) \
|
||||
{ \
|
||||
nsISupports *s = static_cast<nsISupports*>(p); \
|
||||
NS_ASSERTION(CheckForRightISupports(s), \
|
||||
"not the nsISupports pointer we expect"); \
|
||||
_class *tmp = static_cast<_class*>(Downcast(s)); \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_base_class)::Unlink(s);
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(_class) \
|
||||
NS_IMETHODIMP \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Unlink(void *p) \
|
||||
{ \
|
||||
_class *tmp = static_cast<_class*>(p);
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(_field) \
|
||||
tmp->_field = NULL;
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(_field) \
|
||||
tmp->_field.Clear();
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(_field) \
|
||||
tmp->_field.Clear();
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_END \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_0(_class) \
|
||||
NS_IMETHODIMP \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Unlink(void *p) \
|
||||
{ \
|
||||
NS_ASSERTION(CheckForRightISupports(static_cast<nsISupports*>(p)), \
|
||||
"not the nsISupports pointer we expect"); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_UNLINK_NATIVE_0(_class) \
|
||||
NS_IMETHODIMP \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Unlink(void *p) \
|
||||
{ \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Helpers for implementing nsCycleCollectionParticipant::Traverse
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef DEBUG_CC
|
||||
#define NS_IMPL_CYCLE_COLLECTION_DESCRIBE(_class) \
|
||||
cb.DescribeNode(tmp->mRefCnt.get(), sizeof(_class), #_class);
|
||||
#else
|
||||
#define NS_IMPL_CYCLE_COLLECTION_DESCRIBE(_class) \
|
||||
cb.DescribeNode(tmp->mRefCnt.get());
|
||||
#endif
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(_class) \
|
||||
NS_IMETHODIMP \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Traverse \
|
||||
(void *p, \
|
||||
nsCycleCollectionTraversalCallback &cb) \
|
||||
{ \
|
||||
nsISupports *s = static_cast<nsISupports*>(p); \
|
||||
NS_ASSERTION(CheckForRightISupports(s), \
|
||||
"not the nsISupports pointer we expect"); \
|
||||
_class *tmp = Downcast(s); \
|
||||
NS_IMPL_CYCLE_COLLECTION_DESCRIBE(_class)
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(_class, _base_class) \
|
||||
NS_IMETHODIMP \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Traverse \
|
||||
(void *p, \
|
||||
nsCycleCollectionTraversalCallback &cb) \
|
||||
{ \
|
||||
nsISupports *s = static_cast<nsISupports*>(p); \
|
||||
NS_ASSERTION(CheckForRightISupports(s), \
|
||||
"not the nsISupports pointer we expect"); \
|
||||
_class *tmp = static_cast<_class*>(Downcast(s)); \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_base_class)::Traverse(s, cb);
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(_class) \
|
||||
NS_IMETHODIMP \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Traverse \
|
||||
(void *p, \
|
||||
nsCycleCollectionTraversalCallback &cb) \
|
||||
{ \
|
||||
_class *tmp = static_cast<_class*>(p); \
|
||||
NS_IMPL_CYCLE_COLLECTION_DESCRIBE(_class)
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(_field) \
|
||||
cb.NoteXPCOMChild(tmp->_field);
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(_field) \
|
||||
cb.NoteXPCOMChild(tmp->_field.get());
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(_field, _base) \
|
||||
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(_base*, tmp->_field));
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(_field) \
|
||||
{ \
|
||||
PRInt32 i; \
|
||||
for (i = 0; i < tmp->_field.Count(); ++i) \
|
||||
cb.NoteXPCOMChild(tmp->_field[i]); \
|
||||
}
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_PTR(_ptr, _ptr_class) \
|
||||
cb.NoteNativeChild(_ptr, &NS_CYCLE_COLLECTION_NATIVE_NAME(_ptr_class));
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(_field, _field_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_PTR(tmp->_field, _field_class)
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY(_array, _element_class) \
|
||||
{ \
|
||||
PRUint32 i, length = (_array).Length(); \
|
||||
for (i = 0; i < length; ++i) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_PTR((_array)[i], \
|
||||
_element_class); \
|
||||
}
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY_MEMBER(_field, \
|
||||
_element_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY(tmp->_field, _element_class)
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Helpers for implementing a concrete nsCycleCollectionParticipant
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(_class, _base) \
|
||||
class NS_CYCLE_COLLECTION_INNERCLASS \
|
||||
: public nsXPCOMCycleCollectionParticipant \
|
||||
{ \
|
||||
public: \
|
||||
NS_IMETHOD Unlink(void *p); \
|
||||
NS_IMETHOD Traverse(void *p, \
|
||||
nsCycleCollectionTraversalCallback &cb); \
|
||||
NS_IMETHOD_(void) UnmarkPurple(nsISupports *s) \
|
||||
{ \
|
||||
Downcast(s)->UnmarkPurple(); \
|
||||
} \
|
||||
static _class* Downcast(nsISupports* s) \
|
||||
{ \
|
||||
return static_cast<_class*>(static_cast<_base*>(s)); \
|
||||
} \
|
||||
static nsISupports* Upcast(_class *p) \
|
||||
{ \
|
||||
return NS_ISUPPORTS_CAST(_base*, p); \
|
||||
} \
|
||||
};
|
||||
|
||||
#define NS_DECL_CYCLE_COLLECTION_CLASS(_class) \
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(_class, _class)
|
||||
|
||||
#define NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(_class, _base_class) \
|
||||
class NS_CYCLE_COLLECTION_INNERCLASS \
|
||||
: public NS_CYCLE_COLLECTION_CLASSNAME(_base_class) \
|
||||
{ \
|
||||
public: \
|
||||
NS_IMETHOD Unlink(void *p); \
|
||||
NS_IMETHOD Traverse(void *p, \
|
||||
nsCycleCollectionTraversalCallback &cb); \
|
||||
static _class* Downcast(nsISupports* s) \
|
||||
{ \
|
||||
return static_cast<_class*>(static_cast<_base_class*>(\
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_base_class)::Downcast(s))); \
|
||||
} \
|
||||
};
|
||||
|
||||
#define NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(_class, \
|
||||
_base_class) \
|
||||
class NS_CYCLE_COLLECTION_INNERCLASS \
|
||||
: public NS_CYCLE_COLLECTION_CLASSNAME(_base_class) \
|
||||
{ \
|
||||
public: \
|
||||
NS_IMETHOD Traverse(void *p, \
|
||||
nsCycleCollectionTraversalCallback &cb); \
|
||||
static _class* Downcast(nsISupports* s) \
|
||||
{ \
|
||||
return static_cast<_class*>(static_cast<_base_class*>(\
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_base_class)::Downcast(s))); \
|
||||
} \
|
||||
};
|
||||
|
||||
/**
|
||||
* This implements a stub UnmarkPurple function for classes that want to be
|
||||
* traversed but whose AddRef/Release functions don't add/remove them to/from
|
||||
* the purple buffer. If you're just using NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
* then you don't need this.
|
||||
*/
|
||||
#define NS_DECL_CYCLE_COLLECTION_UNMARK_PURPLE_STUB(_class) \
|
||||
NS_IMETHODIMP_(void) UnmarkPurple() \
|
||||
{ \
|
||||
} \
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_CLASS(_class) \
|
||||
static NS_CYCLE_COLLECTION_CLASSNAME(_class) \
|
||||
NS_CYCLE_COLLECTION_NAME(_class);
|
||||
|
||||
#define NS_CYCLE_COLLECTION_NATIVE_INNERNAME \
|
||||
_cycleCollectorGlobal
|
||||
|
||||
#define NS_CYCLE_COLLECTION_NATIVE_NAME(_class) \
|
||||
_class::NS_CYCLE_COLLECTION_NATIVE_INNERNAME
|
||||
|
||||
#define NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(_class) \
|
||||
class NS_CYCLE_COLLECTION_INNERCLASS \
|
||||
: public nsCycleCollectionParticipant \
|
||||
{ \
|
||||
public: \
|
||||
NS_IMETHOD Root(void *n); \
|
||||
NS_IMETHOD Unlink(void *n); \
|
||||
NS_IMETHOD Unroot(void *n); \
|
||||
NS_IMETHOD Traverse(void *n, \
|
||||
nsCycleCollectionTraversalCallback &cb); \
|
||||
}; \
|
||||
static NS_CYCLE_COLLECTION_INNERCLASS \
|
||||
NS_CYCLE_COLLECTION_NATIVE_INNERNAME;
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_NATIVE_CLASS(_class) \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_class) NS_CYCLE_COLLECTION_NATIVE_NAME(_class);
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(_class, _root_function) \
|
||||
NS_IMETHODIMP \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Root(void *p) \
|
||||
{ \
|
||||
_class *tmp = static_cast<_class*>(p); \
|
||||
tmp->_root_function(); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(_class, _unroot_function) \
|
||||
NS_IMETHODIMP \
|
||||
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Unroot(void *p) \
|
||||
{ \
|
||||
_class *tmp = static_cast<_class*>(p); \
|
||||
tmp->_unroot_function(); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_0(_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_1(_class, _f) \
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(_f) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(_f) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_2(_class, _f1, _f2) \
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(_f1) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(_f2) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(_f1) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(_f2) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
#define NS_IMPL_CYCLE_COLLECTION_3(_class, _f1, _f2, _f3) \
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(_f1) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(_f2) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(_f3) \
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(_class) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(_f1) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(_f2) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(_f3) \
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
#endif // nsCycleCollectionParticipant_h__
|
|
@ -211,13 +211,13 @@ PR_STATIC_CALLBACK(PRBool) \
|
|||
ENTRY_CLASS##MatchEntry(PLDHashTable *table, const PLDHashEntryHdr *entry, \
|
||||
const void *key) \
|
||||
{ \
|
||||
const ENTRY_CLASS* e = static_cast<const ENTRY_CLASS*>(entry); \
|
||||
const ENTRY_CLASS* e = static_cast<const ENTRY_CLASS*>(entry); \
|
||||
return e->MatchEntry(key); \
|
||||
} \
|
||||
PR_STATIC_CALLBACK(void) \
|
||||
ENTRY_CLASS##ClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry) \
|
||||
{ \
|
||||
ENTRY_CLASS* e = static_cast<ENTRY_CLASS *>(entry); \
|
||||
ENTRY_CLASS* e = static_cast<ENTRY_CLASS *>(entry); \
|
||||
e->~ENTRY_CLASS(); \
|
||||
} \
|
||||
PR_STATIC_CALLBACK(PRBool) \
|
||||
|
@ -353,13 +353,13 @@ nsresult CLASSNAME::Init(PRUint32 aNumInitialEntries) { \
|
|||
return NS_OK; \
|
||||
} \
|
||||
ENTRY_CLASS* CLASSNAME::GetEntry(const KEY_TYPE aKey) { \
|
||||
ENTRY_CLASS* e = static_cast<ENTRY_CLASS*>(\
|
||||
ENTRY_CLASS* e = static_cast<ENTRY_CLASS*>( \
|
||||
PL_DHashTableOperate(&mHashTable, &aKey, \
|
||||
PL_DHASH_LOOKUP)); \
|
||||
return PL_DHASH_ENTRY_IS_BUSY(e) ? e : nsnull; \
|
||||
} \
|
||||
ENTRY_CLASS* CLASSNAME::AddEntry(const KEY_TYPE aKey) { \
|
||||
return static_cast<ENTRY_CLASS*>(\
|
||||
return static_cast<ENTRY_CLASS*>( \
|
||||
PL_DHashTableOperate(&mHashTable, &aKey, \
|
||||
PL_DHASH_ADD)); \
|
||||
} \
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#define NS_IMPL_QUERY_CLASSINFO(_class) \
|
||||
if ( aIID.Equals(NS_GET_IID(nsIClassInfo)) ) { \
|
||||
extern nsIClassInfo *NS_CLASSINFO_NAME(_class); \
|
||||
foundInterface = static_cast<nsIClassInfo*>(NS_CLASSINFO_NAME(_class));\
|
||||
foundInterface = static_cast<nsIClassInfo*>(NS_CLASSINFO_NAME(_class)); \
|
||||
} else
|
||||
|
||||
#define NS_CLASSINFO_HELPER_BEGIN(_class, _c) \
|
||||
|
|
|
@ -438,23 +438,23 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
|
|||
|
||||
#define NS_INTERFACE_TABLE_ENTRY(_class, _interface) \
|
||||
{ &_interface::COMTypeInfo<int>::kIID, \
|
||||
reinterpret_cast<char*>(\
|
||||
static_cast<_interface*>((_class*) 0x1000)) - \
|
||||
reinterpret_cast<char*>((_class*) 0x1000) \
|
||||
reinterpret_cast<char*>( \
|
||||
static_cast<_interface*>((_class*) 0x1000)) - \
|
||||
reinterpret_cast<char*>((_class*) 0x1000) \
|
||||
},
|
||||
|
||||
#define NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, _interface, _implClass) \
|
||||
{ &_interface::COMTypeInfo<int>::kIID, \
|
||||
reinterpret_cast<char*>(\
|
||||
static_cast<_interface*>(\
|
||||
static_cast<_implClass*>(\
|
||||
reinterpret_cast<char*>( \
|
||||
static_cast<_interface*>( \
|
||||
static_cast<_implClass*>( \
|
||||
(_class*) 0x1000))) - \
|
||||
reinterpret_cast<char*>((_class*) 0x1000) \
|
||||
reinterpret_cast<char*>((_class*) 0x1000) \
|
||||
},
|
||||
|
||||
#define NS_INTERFACE_TABLE_END \
|
||||
{ nsnull, 0 } }; \
|
||||
rv = NS_TableDrivenQI(static_cast<void*>(this), \
|
||||
rv = NS_TableDrivenQI(static_cast<void*>(this), \
|
||||
table, aIID, aInstancePtr);
|
||||
|
||||
#define NS_INTERFACE_TABLE_TAIL \
|
||||
|
@ -494,23 +494,23 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
|
|||
|
||||
#define NS_IMPL_QUERY_BODY(_interface) \
|
||||
if ( aIID.Equals(NS_GET_IID(_interface)) ) \
|
||||
foundInterface = static_cast<_interface*>(this); \
|
||||
foundInterface = static_cast<_interface*>(this); \
|
||||
else
|
||||
|
||||
#define NS_IMPL_QUERY_BODY_CONDITIONAL(_interface, condition) \
|
||||
if ( (condition) && aIID.Equals(NS_GET_IID(_interface))) \
|
||||
foundInterface = static_cast<_interface*>(this); \
|
||||
foundInterface = static_cast<_interface*>(this); \
|
||||
else
|
||||
|
||||
#define NS_IMPL_QUERY_BODY_AMBIGUOUS(_interface, _implClass) \
|
||||
if ( aIID.Equals(NS_GET_IID(_interface)) ) \
|
||||
foundInterface = static_cast<_interface*>(\
|
||||
static_cast<_implClass*>(this)); \
|
||||
foundInterface = static_cast<_interface*>( \
|
||||
static_cast<_implClass*>(this)); \
|
||||
else
|
||||
|
||||
#define NS_IMPL_QUERY_BODY_AGGREGATED(_interface, _aggregate) \
|
||||
if ( aIID.Equals(NS_GET_IID(_interface)) ) \
|
||||
foundInterface = static_cast<_interface*>(_aggregate); \
|
||||
foundInterface = static_cast<_interface*>(_aggregate); \
|
||||
else
|
||||
|
||||
#define NS_IMPL_QUERY_TAIL_GUTS \
|
||||
|
@ -1127,7 +1127,7 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
|
|||
#define NS_IMPL_QUERY_CLASSINFO(_class) \
|
||||
if ( aIID.Equals(NS_GET_IID(nsIClassInfo)) ) { \
|
||||
extern nsIClassInfo *NS_CLASSINFO_NAME(_class); \
|
||||
foundInterface = static_cast<nsIClassInfo*>(NS_CLASSINFO_NAME(_class));\
|
||||
foundInterface = static_cast<nsIClassInfo*>(NS_CLASSINFO_NAME(_class)); \
|
||||
} else
|
||||
|
||||
#define NS_CLASSINFO_HELPER_BEGIN(_class, _c) \
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
// convert fragment to |const string_base_type&|
|
||||
#define TO_SUBSTRING(_v) \
|
||||
( (ptrdiff_t(_v) & 0x1) \
|
||||
? reinterpret_cast<const abstract_string_type*>(\
|
||||
? reinterpret_cast<const abstract_string_type*>( \
|
||||
((unsigned long)_v & ~0x1))->ToSubstring() \
|
||||
: *reinterpret_cast<const substring_type*>((_v)) )
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче