Bug 305949 - Fix various XPCOM macros in preparation for stopping exporting nonfrozen XPCOM functions, r=darin sr=bryner

This commit is contained in:
benjamin%smedbergs.us 2006-04-19 16:29:31 +00:00
Родитель 4e4416d6ed
Коммит 06474b13cc
9 изменённых файлов: 64 добавлений и 67 удалений

Просмотреть файл

@ -49,8 +49,10 @@
#include "nsIWritablePropertyBag2.h"
#include "nsInterfaceHashtable.h"
// Set IMETHOD_VISIBILITY to empty so that the class-level NS_COM declaration
// controls member method visibility.
#undef IMETHOD_VISIBILITY
#define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT
#define IMETHOD_VISIBILITY
class NS_COM nsHashPropertyBag : public nsIWritablePropertyBag
, public nsIWritablePropertyBag2

Просмотреть файл

@ -44,8 +44,10 @@
static const PRUint32 kAutoArraySize = 8;
// Set IMETHOD_VISIBILITY to empty so that the class-level NS_COM declaration
// controls member method visibility.
#undef IMETHOD_VISIBILITY
#define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT
#define IMETHOD_VISIBILITY
class NS_COM nsSupportsArray : public nsISupportsArray {
public:
@ -166,7 +168,4 @@ private:
nsSupportsArray(const nsISupportsArray& other);
};
#undef IMETHOD_VISIBILITY
#define IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN
#endif // nsSupportsArray_h__

Просмотреть файл

@ -60,7 +60,7 @@ PR_BEGIN_EXTERN_C
* + greater than zero if the second element should be before the first
* 5. extra data to pass to comparison function
*/
void NS_COM_GLUE NS_QuickSort(void *, unsigned int, unsigned int,
NS_COM_GLUE void NS_QuickSort(void *, unsigned int, unsigned int,
int (*)(const void *, const void *, void *),
void *);

Просмотреть файл

@ -97,7 +97,7 @@ HashCString(const char *str)
return code;
}
PR_IMPLEMENT(PLDHashOperator)
PLDHashOperator
PL_DHashStubEnumRemove(PLDHashTable *table,
PLDHashEntryHdr *entry,
PRUint32 ordinal,

Просмотреть файл

@ -44,7 +44,7 @@
#include NEW_H
// helper function for nsTHashtable::Clear()
PR_EXTERN(PLDHashOperator) PR_CALLBACK
NS_COM_GLUE PLDHashOperator
PL_DHashStubEnumRemove(PLDHashTable *table,
PLDHashEntryHdr *entry,
PRUint32 ordinal,

Просмотреть файл

@ -43,6 +43,42 @@
#include "nsWeakReference.h"
#include "nsCOMPtr.h"
class nsWeakReference : public nsIWeakReference
{
public:
// nsISupports...
NS_DECL_ISUPPORTS
// nsIWeakReference...
NS_DECL_NSIWEAKREFERENCE
private:
friend class nsSupportsWeakReference;
nsWeakReference( nsSupportsWeakReference* referent )
: mReferent(referent)
// ...I can only be constructed by an |nsSupportsWeakReference|
{
// nothing else to do here
}
~nsWeakReference()
// ...I will only be destroyed by calling |delete| myself.
{
if ( mReferent )
mReferent->NoticeProxyDestruction();
}
void
NoticeReferentDestruction()
// ...called (only) by an |nsSupportsWeakReference| from _its_ dtor.
{
mReferent = 0;
}
nsSupportsWeakReference* mReferent;
};
nsresult
nsQueryReferent::operator()( const nsIID& aIID, void** answer ) const
{
@ -114,3 +150,14 @@ nsWeakReference::QueryReferent( const nsIID& aIID, void** aInstancePtr )
{
return mReferent ? mReferent->QueryInterface(aIID, aInstancePtr) : NS_ERROR_NULL_POINTER;
}
void
nsSupportsWeakReference::ClearWeakReferences()
{
if ( mProxy )
{
mProxy->NoticeReferentDestruction();
mProxy = 0;
}
}

Просмотреть файл

@ -47,8 +47,10 @@
class nsWeakReference;
// Set IMETHOD_VISIBILITY to empty so that the class-level NS_COM declaration
// controls member method visibility.
#undef IMETHOD_VISIBILITY
#define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT
#define IMETHOD_VISIBILITY
class NS_COM_GLUE nsSupportsWeakReference : public nsISupportsWeakReference
{
@ -78,66 +80,13 @@ class NS_COM_GLUE nsSupportsWeakReference : public nsISupportsWeakReference
protected:
inline void ClearWeakReferences();
void ClearWeakReferences();
PRBool HasWeakReferences() const {return mProxy != 0;}
};
#undef IMETHOD_VISIBILITY
#define IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN
class NS_COM_GLUE nsWeakReference : public nsIWeakReference
{
public:
// nsISupports...
NS_DECL_ISUPPORTS
// nsIWeakReference...
NS_DECL_NSIWEAKREFERENCE
private:
friend class nsSupportsWeakReference;
nsWeakReference( nsSupportsWeakReference* referent )
: mReferent(referent)
// ...I can only be constructed by an |nsSupportsWeakReference|
{
// nothing else to do here
}
~nsWeakReference()
// ...I will only be destroyed by calling |delete| myself.
{
if ( mReferent )
mReferent->NoticeProxyDestruction();
}
void
NoticeReferentDestruction()
// ...called (only) by an |nsSupportsWeakReference| from _its_ dtor.
{
mReferent = 0;
}
nsSupportsWeakReference* mReferent;
};
inline
void
nsSupportsWeakReference::ClearWeakReferences()
/*
Usually being called from |nsSupportsWeakReference::~nsSupportsWeakReference|
will be good enough, but you may have a case where you need to call disconnect
your weak references in an outer destructor (to prevent some client holding a
weak reference from re-entering your destructor).
*/
{
if ( mProxy )
{
mProxy->NoticeReferentDestruction();
mProxy = 0;
}
}
inline
nsSupportsWeakReference::~nsSupportsWeakReference()
{

Просмотреть файл

@ -104,7 +104,7 @@ static void trace_mux(char mode, const char *format, ...)
#define FLETCHER_ACCUMULATE(A,B,U) ONES_COMPLEMENT_ACCUMULATE(A, U); \
ONES_COMPLEMENT_ACCUMULATE(B, A)
PR_IMPLEMENT(PRUint32)
PRUint32
NS_AccumulateFastLoadChecksum(PRUint32 *aChecksum,
const PRUint8* aBuffer,
PRUint32 aLength,
@ -225,7 +225,7 @@ NS_AccumulateFastLoadChecksum(PRUint32 *aChecksum,
return aLength;
}
PR_IMPLEMENT(PRUint32)
PRUint32
NS_AddFastLoadChecksums(PRUint32 sum1, PRUint32 sum2, PRUint32 sum2ByteCount)
{
PRUint32 A1 = sum1 & 0xffff;

Просмотреть файл

@ -178,13 +178,13 @@ typedef PRUint32 NSFastLoadOID; // nsFastLoadFooter::mObjectMap index
*
* After this, if NS_SUCCEEDED(rv), checksum contains a valid FastLoad sum.
*/
PR_EXTERN(PRUint32)
NS_COM PRUint32
NS_AccumulateFastLoadChecksum(PRUint32 *aChecksum,
const PRUint8* aBuffer,
PRUint32 aLength,
PRBool aLastBuffer);
PR_EXTERN(PRUint32)
NS_COM PRUint32
NS_AddFastLoadChecksums(PRUint32 sum1, PRUint32 sum2, PRUint32 sum2ByteCount);
/**