Bug 562387 - Convert NS_NEWXPCOM/NS_DELETEXPCOM to new/delete. r=bsmedgerg

This commit is contained in:
Saint Wesonga 2010-06-29 17:14:36 +02:00
parent 17c5a5f186
commit c81affe35c
49 changed files with 67 additions and 117 deletions

View File

@ -131,7 +131,7 @@ void nsAccessNode::LastRelease()
NS_ASSERTION(!mWeakShell, "A Shutdown() impl forgot to call its parent's Shutdown?");
}
// ... then die.
NS_DELETEXPCOM(this);
delete this;
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -76,7 +76,7 @@ nsNullPrincipal::Release()
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
NS_LOG_RELEASE(this, count, "nsNullPrincipal");
if (count == 0) {
NS_DELETEXPCOM(this);
delete this;
}
return count;

View File

@ -164,7 +164,7 @@ nsPrincipal::Release()
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
NS_LOG_RELEASE(this, count, "nsPrincipal");
if (count == 0) {
NS_DELETEXPCOM(this);
delete this;
}
return count;

View File

@ -73,7 +73,7 @@ nsSystemPrincipal::Release()
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
NS_LOG_RELEASE(this, count, "nsSystemPrincipal");
if (count == 0) {
NS_DELETEXPCOM(this);
delete this;
}
return count;

View File

@ -1360,8 +1360,7 @@ nsXMLHttpRequest::GetAllResponseHeaders(char **_retval)
nsCOMPtr<nsIHttpChannel> httpChannel = GetCurrentHttpChannel();
if (httpChannel) {
nsHeaderVisitor *visitor = nsnull;
NS_NEWXPCOM(visitor, nsHeaderVisitor);
nsHeaderVisitor *visitor = new nsHeaderVisitor();
if (!visitor)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(visitor);

View File

@ -71,8 +71,7 @@ NS_NewXBLContentSink(nsIXMLContentSink** aResult,
{
NS_ENSURE_ARG_POINTER(aResult);
nsXBLContentSink* it;
NS_NEWXPCOM(it, nsXBLContentSink);
nsXBLContentSink* it = new nsXBLContentSink();
NS_ENSURE_TRUE(it, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsIXMLContentSink> kungFuDeathGrip = it;

View File

@ -124,8 +124,7 @@ NS_NewXMLContentSink(nsIXMLContentSink** aResult,
if (nsnull == aResult) {
return NS_ERROR_NULL_POINTER;
}
nsXMLContentSink* it;
NS_NEWXPCOM(it, nsXMLContentSink);
nsXMLContentSink* it = new nsXMLContentSink();
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

View File

@ -909,8 +909,7 @@ nsClipboardDragDropHookCommand::GetCommandStateParams(const char *aCommandName,
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd; \
NS_NEWXPCOM(theCmd, _cmdClass); \
_cmdClass* theCmd = new _cmdClass(); \
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd)); \
@ -918,8 +917,7 @@ nsClipboardDragDropHookCommand::GetCommandStateParams(const char *aCommandName,
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd; \
NS_NEWXPCOM(theCmd, _cmdClass); \
_cmdClass* theCmd = new _cmdClass(); \
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd));

View File

@ -44,8 +44,7 @@
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd; \
NS_NEWXPCOM(theCmd, _cmdClass); \
_cmdClass* theCmd = new _cmdClass(); \
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd)); \
@ -53,8 +52,7 @@
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd; \
NS_NEWXPCOM(theCmd, _cmdClass); \
_cmdClass* theCmd = new _cmdClass(); \
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd));

View File

@ -84,8 +84,7 @@ nsComposeTxtSrvFilterConstructor(nsISupports *aOuter, REFNSIID aIID,
{
return NS_ERROR_NO_AGGREGATION;
}
nsComposeTxtSrvFilter * inst;
NS_NEWXPCOM(inst, nsComposeTxtSrvFilter);
nsComposeTxtSrvFilter * inst = new nsComposeTxtSrvFilter();
if (NULL == inst)
{
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -47,8 +47,7 @@
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd; \
NS_NEWXPCOM(theCmd, _cmdClass); \
_cmdClass* theCmd = new _cmdClass(); \
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd)); \
@ -56,8 +55,7 @@
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd; \
NS_NEWXPCOM(theCmd, _cmdClass); \
_cmdClass* theCmd = new _cmdClass(); \
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd));

View File

@ -70,7 +70,7 @@ nsrefcnt nsEditorTxnLog::Release(void)
{
NS_PRECONDITION(0 != mRefCnt, "dup release");
if (--mRefCnt == 0) {
NS_DELETEXPCOM(this);
delete this;
return 0;
}
return mRefCnt;

View File

@ -153,7 +153,7 @@ NS_IMETHODIMP nsWebBrowser::InternalDestroy()
if (mListenerArray) {
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
NS_DELETEXPCOM(state);
delete state;
}
delete mListenerArray;
mListenerArray = nsnull;
@ -236,15 +236,14 @@ NS_IMETHODIMP nsWebBrowser::AddWebBrowserListener(nsIWeakReference *aListener, c
if (!mWebProgress) {
// The window hasn't been created yet, so queue up the listener. They'll be
// registered when the window gets created.
nsAutoPtr<nsWebBrowserListenerState> state;
NS_NEWXPCOM(state, nsWebBrowserListenerState);
nsAutoPtr<nsWebBrowserListenerState> state = new nsWebBrowserListenerState();
if (!state) return NS_ERROR_OUT_OF_MEMORY;
state->mWeakPtr = aListener;
state->mID = aIID;
if (!mListenerArray) {
NS_NEWXPCOM(mListenerArray, nsTArray<nsWebBrowserListenerState*>);
mListenerArray = new nsTArray<nsWebBrowserListenerState*>();
if (!mListenerArray) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -315,9 +314,9 @@ NS_IMETHODIMP nsWebBrowser::RemoveWebBrowserListener(nsIWeakReference *aListener
if (0 >= mListenerArray->Length()) {
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
NS_DELETEXPCOM(state);
delete state;
}
NS_DELETEXPCOM(mListenerArray);
delete mListenerArray;
mListenerArray = nsnull;
}
@ -1172,9 +1171,9 @@ NS_IMETHODIMP nsWebBrowser::Create()
}
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
NS_DELETEXPCOM(state);
delete state;
}
NS_DELETEXPCOM(mListenerArray);
delete mListenerArray;
mListenerArray = nsnull;
}

View File

@ -69,7 +69,7 @@ NS_IMETHODIMP_(nsrefcnt) nsPrintProgress::Release(void)
mRefCnt = 1; /* stabilize */
/* enable this to find non-threadsafe destructors: */
/* NS_ASSERT_OWNINGTHREAD(nsPrintProgress); */
NS_DELETEXPCOM(this);
delete this;
return 0;
}
return count;

View File

@ -92,15 +92,13 @@ mozInlineSpellCheckerConstructor(nsISupports *aOuter, REFNSIID aIID,
nsresult rv;
mozInlineSpellChecker* inst;
*aResult = NULL;
if (NULL != aOuter) {
rv = NS_ERROR_NO_AGGREGATION;
return rv;
}
NS_NEWXPCOM(inst, mozInlineSpellChecker);
mozInlineSpellChecker* inst = new mozInlineSpellChecker();
if (NULL == inst) {
rv = NS_ERROR_OUT_OF_MEMORY;
return rv;

View File

@ -74,8 +74,7 @@ static NS_IMETHODIMP nsScriptableRegionConstructor(nsISupports *aOuter, REFNSIID
return rv;
}
nsCOMPtr <nsIRegion> rgn;
NS_NEWXPCOM(rgn, nsThebesRegion);
nsCOMPtr <nsIRegion> rgn = new nsThebesRegion();
nsCOMPtr<nsIScriptableRegion> scriptableRgn;
if (rgn != nsnull)
{

View File

@ -104,7 +104,7 @@ public: \
NS_LOG_RELEASE(this, count, #_class); \
if (count == 0) { \
mRefCnt = 1; /* stabilize */ \
NS_DELETEXPCOM(this); \
delete this; \
return 0; \
} \
return count; \

View File

@ -164,7 +164,7 @@ static nsCompressedMap gLowerMap = {
nsCaseConversionImp2* nsCaseConversionImp2::GetInstance()
{
if (!gCaseConv)
NS_NEWXPCOM(gCaseConv, nsCaseConversionImp2);
gCaseConv = new nsCaseConversionImp2();
return gCaseConv;
}

View File

@ -237,7 +237,7 @@ do_decrement:
if(0 == cnt)
{
NS_DELETEXPCOM(this); // also unlinks us from chain
delete this; // also unlinks us from chain
return 0;
}
if(1 == cnt)

View File

@ -77,7 +77,7 @@ NS_IMETHODIMP_(nsrefcnt) xpctestNoisy::Release(void)
printf("Noisy %d - decremented refcount to %d\n", mID, mRefCnt.get());
NS_LOG_RELEASE(this, mRefCnt, "xpctestNoisy");
if (mRefCnt == 0) {
NS_DELETEXPCOM(this);
delete this;
return 0;
}
return mRefCnt;

View File

@ -789,8 +789,7 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow)
//
// now register ourselves as a focus listener, so that we get called
// when the focus changes in the window
nsDocViewerFocusListener *focusListener;
NS_NEWXPCOM(focusListener, nsDocViewerFocusListener);
nsDocViewerFocusListener *focusListener = new nsDocViewerFocusListener();
NS_ENSURE_TRUE(focusListener, NS_ERROR_OUT_OF_MEMORY);
focusListener->Init(this);

View File

@ -583,15 +583,13 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
{ \
nsresult rv; \
\
_InstanceClass * inst; \
\
*aResult = NULL; \
if (NULL != aOuter) { \
rv = NS_ERROR_NO_AGGREGATION; \
return rv; \
} \
\
NS_NEWXPCOM(inst, _InstanceClass); \
_InstanceClass * inst = new _InstanceClass(); \
if (NULL == inst) { \
rv = NS_ERROR_OUT_OF_MEMORY; \
return rv; \

View File

@ -142,8 +142,7 @@ nsBulletFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
if (newRequest) {
if (!mListener) {
nsBulletListener *listener;
NS_NEWXPCOM(listener, nsBulletListener);
nsBulletListener *listener = new nsBulletListener();
NS_ADDREF(listener);
listener->SetFrame(this);
listener->QueryInterface(NS_GET_IID(imgIDecoderObserver), getter_AddRefs(mListener));

View File

@ -222,8 +222,7 @@ nsImageBoxFrame::Init(nsIContent* aContent,
nsIFrame* aPrevInFlow)
{
if (!mListener) {
nsImageBoxListener *listener;
NS_NEWXPCOM(listener, nsImageBoxListener);
nsImageBoxListener *listener = new nsImageBoxListener();
NS_ADDREF(listener);
listener->SetFrame(this);
listener->QueryInterface(NS_GET_IID(imgIDecoderObserver), getter_AddRefs(mListener));

View File

@ -145,7 +145,7 @@ nsrefcnt nsJAR::Release(void)
mRefCnt = 1; /* stabilize */
/* enable this to find non-threadsafe destructors: */
/* NS_ASSERT_OWNINGTHREAD(nsJAR); */
NS_DELETEXPCOM(this);
delete this;
return 0;
}
else if (1 == count && mCache) {

View File

@ -94,8 +94,7 @@ NS_IMETHODIMP nsIconProtocolHandler::NewURI(const nsACString &aSpec,
nsIURI **result)
{
nsCOMPtr<nsIURI> uri;
NS_NEWXPCOM(uri, nsMozIconURI);
nsCOMPtr<nsIURI> uri = new nsMozIconURI();
if (!uri) return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = uri->SetSpec(aSpec);

View File

@ -661,7 +661,7 @@ nsresult imgLoader::CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup
if (aProxyRequest) {
proxyRequest = static_cast<imgRequestProxy *>(aProxyRequest);
} else {
NS_NEWXPCOM(proxyRequest, imgRequestProxy);
proxyRequest = new imgRequestProxy();
if (!proxyRequest) return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(proxyRequest);

View File

@ -80,7 +80,7 @@ NS_IMETHODIMP imgTools::DecodeImageData(nsIInputStream* aInStr,
NS_ENSURE_ARG_POINTER(aInStr);
// If the caller didn't provide a container, create one
if (!*aContainer) {
NS_NEWXPCOM(*aContainer, imgContainer);
*aContainer = new imgContainer();
if (!*aContainer)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aContainer);

View File

@ -288,8 +288,7 @@ nsMIMEInputStreamConstructor(nsISupports *outer, REFNSIID iid, void **result)
if (outer)
return NS_ERROR_NO_AGGREGATION;
nsMIMEInputStream *inst;
NS_NEWXPCOM(inst, nsMIMEInputStream);
nsMIMEInputStream *inst = new nsMIMEInputStream();
if (!inst)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -1651,8 +1651,7 @@ nsStandardURL::SchemeIs(const char *scheme, PRBool *result)
/* virtual */ nsStandardURL*
nsStandardURL::StartClone()
{
nsStandardURL *clone;
NS_NEWXPCOM(clone, nsStandardURL);
nsStandardURL *clone = new nsStandardURL();
return clone;
}

View File

@ -1540,8 +1540,6 @@ nsHttpHandler::NewProxiedChannel(nsIURI *uri,
nsIProxyInfo* givenProxyInfo,
nsIChannel **result)
{
nsHttpChannel *httpChannel = nsnull;
LOG(("nsHttpHandler::NewProxiedChannel [proxyInfo=%p]\n",
givenProxyInfo));
@ -1556,7 +1554,7 @@ nsHttpHandler::NewProxiedChannel(nsIURI *uri,
if (NS_FAILED(rv))
return rv;
NS_NEWXPCOM(httpChannel, nsHttpChannel);
nsHttpChannel *httpChannel = new nsHttpChannel();
if (!httpChannel)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(httpChannel);

View File

@ -129,8 +129,7 @@ nsResURL::EnsureFile()
/* virtual */ nsStandardURL*
nsResURL::StartClone()
{
nsResURL *clone;
NS_NEWXPCOM(clone, nsResURL);
nsResURL *clone = new nsResURL();
return clone;
}
@ -304,8 +303,7 @@ nsResProtocolHandler::NewURI(const nsACString &aSpec,
{
nsresult rv;
nsResURL *resURL;
NS_NEWXPCOM(resURL, nsResURL);
nsResURL *resURL = new nsResURL();
if (!resURL)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(resURL);

View File

@ -107,7 +107,7 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
return NS_ERROR_FAILURE; \
} \
\
NS_NEWXPCOM(inst, _InstanceClass); \
inst = new _InstanceClass(); \
if (NULL == inst) { \
if (triggeredByNSSComponent) \
EnsureNSSInitialized(nssInitFailed); \
@ -156,7 +156,7 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
return NS_ERROR_FAILURE; \
} \
\
NS_NEWXPCOM(inst, _InstanceClass); \
inst = new _InstanceClass(); \
if (NULL == inst) { \
if (triggeredByNSSComponent) \
EnsureNSSInitialized(nssInitFailed); \

View File

@ -401,8 +401,7 @@ NS_IMETHODIMP nsExternalProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **_
PRBool haveExternalHandler = HaveExternalProtocolHandler(aURI);
if (haveExternalHandler)
{
nsCOMPtr<nsIChannel> channel;
NS_NEWXPCOM(channel, nsExtProtocolChannel);
nsCOMPtr<nsIChannel> channel = new nsExtProtocolChannel();
if (!channel) return NS_ERROR_OUT_OF_MEMORY;
((nsExtProtocolChannel*) channel.get())->SetURI(aURI);

View File

@ -73,7 +73,7 @@ public:
NS_LOG_RELEASE(this, mRefCnt, "nsGtkIMModule");
if (mRefCnt == 0) {
mRefCnt = 1; /* stabilize */
NS_DELETEXPCOM(this);
delete this;
return 0;
}
return mRefCnt;

View File

@ -123,7 +123,7 @@ nsNativeThemeGTKConstructor(nsISupports *aOuter, REFNSIID aIID,
return rv;
}
NS_NEWXPCOM(inst, nsNativeThemeGTK);
inst = new nsNativeThemeGTK();
if (NULL == inst) {
rv = NS_ERROR_OUT_OF_MEMORY;
return rv;
@ -197,7 +197,7 @@ nsNativeKeyBindingsConstructor(nsISupports *aOuter, REFNSIID aIID,
return rv;
}
NS_NEWXPCOM(inst, nsNativeKeyBindings);
inst = new nsNativeKeyBindings();
if (NULL == inst) {
rv = NS_ERROR_OUT_OF_MEMORY;
return rv;

View File

@ -1217,7 +1217,7 @@ static nsresult nsRwsServiceInit(nsRwsService **aClass)
}
// create an instance of nsRwsService
NS_NEWXPCOM(sRwsInstance, nsRwsService);
sRwsInstance = new nsRwsService();
if (sRwsInstance == 0)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -95,7 +95,7 @@ nsNativeThemeQtConstructor(nsISupports *aOuter, REFNSIID aIID,
if (NULL != aOuter)
return NS_ERROR_NO_AGGREGATION;
NS_NEWXPCOM(inst, nsNativeThemeQt);
inst = new nsNativeThemeQt();
if (NULL == inst)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -155,7 +155,7 @@ _class::Internal::Release(void) \
NS_LOG_RELEASE(this, agg->mRefCnt, #_class); \
if (agg->mRefCnt == 0) { \
agg->mRefCnt = 1; /* stabilize */ \
NS_DELETEXPCOM(agg); \
delete agg; \
return 0; \
} \
return agg->mRefCnt; \
@ -188,7 +188,7 @@ _class::Internal::Release(void) \
NS_LOG_RELEASE(this, count, #_class); \
if (count == 0) { \
agg->mRefCnt.stabilizeForDeletion(this); \
NS_DELETEXPCOM(agg); \
delete agg; \
return 0; \
} \
return count; \

View File

@ -984,7 +984,7 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt,
}
}
// Here's the case where neither NS_NEWXPCOM nor MOZ_COUNT_CTOR were used,
// Here's the case where MOZ_COUNT_CTOR was not used,
// yet we still want to see creation information:
PRBool loggingThisType = (!gTypesToLog || LogThisType(aClazz));
@ -1068,7 +1068,7 @@ NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz)
}
}
// Here's the case where neither NS_DELETEXPCOM nor MOZ_COUNT_DTOR were used,
// Here's the case where MOZ_COUNT_DTOR was not used,
// yet we still want to see deletion information:
if (aRefcnt == 0 && gAllocLog && loggingThisType && loggingThisObject) {

View File

@ -379,7 +379,7 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
return rv; \
} \
\
NS_NEWXPCOM(inst, _InstanceClass); \
inst = new _InstanceClass(); \
if (NULL == inst) { \
rv = NS_ERROR_OUT_OF_MEMORY; \
return rv; \
@ -407,7 +407,7 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
return rv; \
} \
\
NS_NEWXPCOM(inst, _InstanceClass); \
inst = new _InstanceClass(); \
if (NULL == inst) { \
rv = NS_ERROR_OUT_OF_MEMORY; \
return rv; \

View File

@ -327,7 +327,7 @@ public: \
NS_LOG_RELEASE(this, mRefCnt, #_class); \
if (mRefCnt == 0) { \
mRefCnt = 1; /* stabilize */ \
NS_DELETEXPCOM(this); \
delete this; \
} \
} \
protected: \
@ -411,7 +411,7 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
* the refcount to |0|.
*/
#define NS_IMPL_RELEASE(_class) \
NS_IMPL_RELEASE_WITH_DESTROY(_class, NS_DELETEXPCOM(this))
NS_IMPL_RELEASE_WITH_DESTROY(_class, delete (this))
/**
* Use this macro to implement the Release method for a given <i>_class</i>
@ -465,10 +465,10 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _basetype, _destroy)
#define NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(_class, _basetype) \
NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _basetype, NS_DELETEXPCOM(this))
NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _basetype, delete (this))
#define NS_IMPL_CYCLE_COLLECTING_RELEASE(_class) \
NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _class, NS_DELETEXPCOM(this))
NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _class, delete (this))
///////////////////////////////////////////////////////////////////////////////
@ -1278,7 +1278,7 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
mRefCnt = 1; /* stabilize */ \
/* enable this to find non-threadsafe destructors: */ \
/* NS_ASSERT_OWNINGTHREAD(_class); */ \
NS_DELETEXPCOM(this); \
delete (this); \
return 0; \
} \
return count; \

View File

@ -61,27 +61,6 @@
#include "nsISupportsImpl.h"
#endif
/**
* Macro for instantiating a new object that implements nsISupports.
* Note that you can only use this if you adhere to the no arguments
* constructor com policy (which you really should!).
* @param _result Where the new instance pointer is stored
* @param _type The type of object to call "new" with.
*/
#define NS_NEWXPCOM(_result,_type) \
PR_BEGIN_MACRO \
_result = new _type(); \
PR_END_MACRO
/**
* Macro for deleting an object that implements nsISupports.
* @param _ptr The object to delete.
*/
#define NS_DELETEXPCOM(_ptr) \
PR_BEGIN_MACRO \
delete (_ptr); \
PR_END_MACRO
/**
* Macro for adding a reference to an interface.
* @param _ptr The interface pointer.

View File

@ -306,8 +306,7 @@ NS_NewInputStreamTeeAsync(nsIInputStream **result,
{
nsresult rv;
nsCOMPtr<nsIInputStreamTee> tee;
NS_NEWXPCOM(tee, nsInputStreamTee);
nsCOMPtr<nsIInputStreamTee> tee = new nsInputStreamTee();
if (!tee)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -398,8 +398,7 @@ nsMultiplexInputStreamConstructor(nsISupports *outer,
if (outer)
return NS_ERROR_NO_AGGREGATION;
nsMultiplexInputStream *inst;
NS_NEWXPCOM(inst, nsMultiplexInputStream);
nsMultiplexInputStream *inst = new nsMultiplexInputStream();
if (!inst)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -113,7 +113,7 @@ nsProxyEventObject::Release(void)
// call the destructor outside of the lock so that we aren't holding the
// lock when we release the object
NS_DELETEXPCOM(this);
delete this;
return 0;
}

View File

@ -702,7 +702,7 @@ xptiInterfaceInfo::Release(void)
mEntry = nsnull;
}
NS_DELETEXPCOM(this);
delete this;
return 0;
}
return cnt;

View File

@ -150,7 +150,7 @@ Bar::Release(void)
NS_LOG_RELEASE(this, mRefCnt, "Bar");
if (mRefCnt == 0) {
mRefCnt = 1; /* stabilize */
NS_DELETEXPCOM(this);
delete this;
return 0;
}
return mRefCnt;

View File

@ -91,7 +91,7 @@ NS_IMETHODIMP_(nsrefcnt) nsTimerImpl::Release(void)
/* enable this to find non-threadsafe destructors: */
/* NS_ASSERT_OWNINGTHREAD(nsTimerImpl); */
NS_DELETEXPCOM(this);
delete this;
return 0;
}