зеркало из https://github.com/mozilla/gecko-dev.git
Bug 562387 - Convert NS_NEWXPCOM/NS_DELETEXPCOM to new/delete. r=bsmedberg
This commit is contained in:
Родитель
2b76dedfb6
Коммит
8952503f91
|
@ -131,7 +131,7 @@ void nsAccessNode::LastRelease()
|
||||||
NS_ASSERTION(!mWeakShell, "A Shutdown() impl forgot to call its parent's Shutdown?");
|
NS_ASSERTION(!mWeakShell, "A Shutdown() impl forgot to call its parent's Shutdown?");
|
||||||
}
|
}
|
||||||
// ... then die.
|
// ... then die.
|
||||||
NS_DELETEXPCOM(this);
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -78,7 +78,7 @@ nsNullPrincipal::Release()
|
||||||
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
|
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
|
||||||
NS_LOG_RELEASE(this, count, "nsNullPrincipal");
|
NS_LOG_RELEASE(this, count, "nsNullPrincipal");
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
NS_DELETEXPCOM(this);
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
|
|
@ -166,7 +166,7 @@ nsPrincipal::Release()
|
||||||
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
|
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
|
||||||
NS_LOG_RELEASE(this, count, "nsPrincipal");
|
NS_LOG_RELEASE(this, count, "nsPrincipal");
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
NS_DELETEXPCOM(this);
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
|
|
@ -75,7 +75,7 @@ nsSystemPrincipal::Release()
|
||||||
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
|
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
|
||||||
NS_LOG_RELEASE(this, count, "nsSystemPrincipal");
|
NS_LOG_RELEASE(this, count, "nsSystemPrincipal");
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
NS_DELETEXPCOM(this);
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
|
|
@ -1360,8 +1360,7 @@ nsXMLHttpRequest::GetAllResponseHeaders(char **_retval)
|
||||||
nsCOMPtr<nsIHttpChannel> httpChannel = GetCurrentHttpChannel();
|
nsCOMPtr<nsIHttpChannel> httpChannel = GetCurrentHttpChannel();
|
||||||
|
|
||||||
if (httpChannel) {
|
if (httpChannel) {
|
||||||
nsHeaderVisitor *visitor = nsnull;
|
nsHeaderVisitor *visitor = new nsHeaderVisitor();
|
||||||
NS_NEWXPCOM(visitor, nsHeaderVisitor);
|
|
||||||
if (!visitor)
|
if (!visitor)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
NS_ADDREF(visitor);
|
NS_ADDREF(visitor);
|
||||||
|
|
|
@ -71,8 +71,7 @@ NS_NewXBLContentSink(nsIXMLContentSink** aResult,
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aResult);
|
NS_ENSURE_ARG_POINTER(aResult);
|
||||||
|
|
||||||
nsXBLContentSink* it;
|
nsXBLContentSink* it = new nsXBLContentSink();
|
||||||
NS_NEWXPCOM(it, nsXBLContentSink);
|
|
||||||
NS_ENSURE_TRUE(it, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(it, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
nsCOMPtr<nsIXMLContentSink> kungFuDeathGrip = it;
|
nsCOMPtr<nsIXMLContentSink> kungFuDeathGrip = it;
|
||||||
|
|
|
@ -124,8 +124,7 @@ NS_NewXMLContentSink(nsIXMLContentSink** aResult,
|
||||||
if (nsnull == aResult) {
|
if (nsnull == aResult) {
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
nsXMLContentSink* it;
|
nsXMLContentSink* it = new nsXMLContentSink();
|
||||||
NS_NEWXPCOM(it, nsXMLContentSink);
|
|
||||||
if (nsnull == it) {
|
if (nsnull == it) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -909,8 +909,7 @@ nsClipboardDragDropHookCommand::GetCommandStateParams(const char *aCommandName,
|
||||||
|
|
||||||
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
|
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
|
||||||
{ \
|
{ \
|
||||||
_cmdClass* theCmd; \
|
_cmdClass* theCmd = new _cmdClass(); \
|
||||||
NS_NEWXPCOM(theCmd, _cmdClass); \
|
|
||||||
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
|
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
|
||||||
rv = inCommandTable->RegisterCommand(_cmdName, \
|
rv = inCommandTable->RegisterCommand(_cmdName, \
|
||||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||||
|
@ -918,8 +917,7 @@ nsClipboardDragDropHookCommand::GetCommandStateParams(const char *aCommandName,
|
||||||
|
|
||||||
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
|
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
|
||||||
{ \
|
{ \
|
||||||
_cmdClass* theCmd; \
|
_cmdClass* theCmd = new _cmdClass(); \
|
||||||
NS_NEWXPCOM(theCmd, _cmdClass); \
|
|
||||||
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
|
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
|
||||||
rv = inCommandTable->RegisterCommand(_cmdName, \
|
rv = inCommandTable->RegisterCommand(_cmdName, \
|
||||||
static_cast<nsIControllerCommand *>(theCmd));
|
static_cast<nsIControllerCommand *>(theCmd));
|
||||||
|
|
|
@ -44,8 +44,7 @@
|
||||||
|
|
||||||
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
|
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
|
||||||
{ \
|
{ \
|
||||||
_cmdClass* theCmd; \
|
_cmdClass* theCmd = new _cmdClass(); \
|
||||||
NS_NEWXPCOM(theCmd, _cmdClass); \
|
|
||||||
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
|
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
|
||||||
rv = inCommandTable->RegisterCommand(_cmdName, \
|
rv = inCommandTable->RegisterCommand(_cmdName, \
|
||||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||||
|
@ -53,8 +52,7 @@
|
||||||
|
|
||||||
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
|
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
|
||||||
{ \
|
{ \
|
||||||
_cmdClass* theCmd; \
|
_cmdClass* theCmd = new _cmdClass(); \
|
||||||
NS_NEWXPCOM(theCmd, _cmdClass); \
|
|
||||||
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
|
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
|
||||||
rv = inCommandTable->RegisterCommand(_cmdName, \
|
rv = inCommandTable->RegisterCommand(_cmdName, \
|
||||||
static_cast<nsIControllerCommand *>(theCmd));
|
static_cast<nsIControllerCommand *>(theCmd));
|
||||||
|
|
|
@ -84,8 +84,7 @@ nsComposeTxtSrvFilterConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||||
{
|
{
|
||||||
return NS_ERROR_NO_AGGREGATION;
|
return NS_ERROR_NO_AGGREGATION;
|
||||||
}
|
}
|
||||||
nsComposeTxtSrvFilter * inst;
|
nsComposeTxtSrvFilter * inst = new nsComposeTxtSrvFilter();
|
||||||
NS_NEWXPCOM(inst, nsComposeTxtSrvFilter);
|
|
||||||
if (NULL == inst)
|
if (NULL == inst)
|
||||||
{
|
{
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
|
@ -47,8 +47,7 @@
|
||||||
|
|
||||||
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
|
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
|
||||||
{ \
|
{ \
|
||||||
_cmdClass* theCmd; \
|
_cmdClass* theCmd = new _cmdClass(); \
|
||||||
NS_NEWXPCOM(theCmd, _cmdClass); \
|
|
||||||
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
|
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
|
||||||
rv = inCommandTable->RegisterCommand(_cmdName, \
|
rv = inCommandTable->RegisterCommand(_cmdName, \
|
||||||
static_cast<nsIControllerCommand *>(theCmd)); \
|
static_cast<nsIControllerCommand *>(theCmd)); \
|
||||||
|
@ -56,8 +55,7 @@
|
||||||
|
|
||||||
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
|
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
|
||||||
{ \
|
{ \
|
||||||
_cmdClass* theCmd; \
|
_cmdClass* theCmd = new _cmdClass(); \
|
||||||
NS_NEWXPCOM(theCmd, _cmdClass); \
|
|
||||||
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
|
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
|
||||||
rv = inCommandTable->RegisterCommand(_cmdName, \
|
rv = inCommandTable->RegisterCommand(_cmdName, \
|
||||||
static_cast<nsIControllerCommand *>(theCmd));
|
static_cast<nsIControllerCommand *>(theCmd));
|
||||||
|
|
|
@ -70,7 +70,7 @@ nsrefcnt nsEditorTxnLog::Release(void)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(0 != mRefCnt, "dup release");
|
NS_PRECONDITION(0 != mRefCnt, "dup release");
|
||||||
if (--mRefCnt == 0) {
|
if (--mRefCnt == 0) {
|
||||||
NS_DELETEXPCOM(this);
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return mRefCnt;
|
return mRefCnt;
|
||||||
|
|
|
@ -153,7 +153,7 @@ NS_IMETHODIMP nsWebBrowser::InternalDestroy()
|
||||||
if (mListenerArray) {
|
if (mListenerArray) {
|
||||||
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
|
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
|
||||||
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
|
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
|
||||||
NS_DELETEXPCOM(state);
|
delete state;
|
||||||
}
|
}
|
||||||
delete mListenerArray;
|
delete mListenerArray;
|
||||||
mListenerArray = nsnull;
|
mListenerArray = nsnull;
|
||||||
|
@ -237,14 +237,14 @@ NS_IMETHODIMP nsWebBrowser::AddWebBrowserListener(nsIWeakReference *aListener, c
|
||||||
// The window hasn't been created yet, so queue up the listener. They'll be
|
// The window hasn't been created yet, so queue up the listener. They'll be
|
||||||
// registered when the window gets created.
|
// registered when the window gets created.
|
||||||
nsAutoPtr<nsWebBrowserListenerState> state;
|
nsAutoPtr<nsWebBrowserListenerState> state;
|
||||||
NS_NEWXPCOM(state, nsWebBrowserListenerState);
|
state = new nsWebBrowserListenerState();
|
||||||
if (!state) return NS_ERROR_OUT_OF_MEMORY;
|
if (!state) return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
state->mWeakPtr = aListener;
|
state->mWeakPtr = aListener;
|
||||||
state->mID = aIID;
|
state->mID = aIID;
|
||||||
|
|
||||||
if (!mListenerArray) {
|
if (!mListenerArray) {
|
||||||
NS_NEWXPCOM(mListenerArray, nsTArray<nsWebBrowserListenerState*>);
|
mListenerArray = new nsTArray<nsWebBrowserListenerState*>();
|
||||||
if (!mListenerArray) {
|
if (!mListenerArray) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -315,9 +315,9 @@ NS_IMETHODIMP nsWebBrowser::RemoveWebBrowserListener(nsIWeakReference *aListener
|
||||||
if (0 >= mListenerArray->Length()) {
|
if (0 >= mListenerArray->Length()) {
|
||||||
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
|
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
|
||||||
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
|
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
|
||||||
NS_DELETEXPCOM(state);
|
delete state;
|
||||||
}
|
}
|
||||||
NS_DELETEXPCOM(mListenerArray);
|
delete mListenerArray;
|
||||||
mListenerArray = nsnull;
|
mListenerArray = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1172,9 +1172,9 @@ NS_IMETHODIMP nsWebBrowser::Create()
|
||||||
}
|
}
|
||||||
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
|
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
|
||||||
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
|
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
|
||||||
NS_DELETEXPCOM(state);
|
delete state;
|
||||||
}
|
}
|
||||||
NS_DELETEXPCOM(mListenerArray);
|
delete mListenerArray;
|
||||||
mListenerArray = nsnull;
|
mListenerArray = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ NS_IMETHODIMP_(nsrefcnt) nsPrintProgress::Release(void)
|
||||||
mRefCnt = 1; /* stabilize */
|
mRefCnt = 1; /* stabilize */
|
||||||
/* enable this to find non-threadsafe destructors: */
|
/* enable this to find non-threadsafe destructors: */
|
||||||
/* NS_ASSERT_OWNINGTHREAD(nsPrintProgress); */
|
/* NS_ASSERT_OWNINGTHREAD(nsPrintProgress); */
|
||||||
NS_DELETEXPCOM(this);
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
|
|
@ -86,15 +86,13 @@ mozInlineSpellCheckerConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
mozInlineSpellChecker* inst;
|
|
||||||
|
|
||||||
*aResult = NULL;
|
*aResult = NULL;
|
||||||
if (NULL != aOuter) {
|
if (NULL != aOuter) {
|
||||||
rv = NS_ERROR_NO_AGGREGATION;
|
rv = NS_ERROR_NO_AGGREGATION;
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_NEWXPCOM(inst, mozInlineSpellChecker);
|
mozInlineSpellChecker* inst = new mozInlineSpellChecker();
|
||||||
if (NULL == inst) {
|
if (NULL == inst) {
|
||||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -74,8 +74,7 @@ nsScriptableRegionConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr <nsIRegion> rgn;
|
nsCOMPtr <nsIRegion> rgn = new nsThebesRegion();
|
||||||
NS_NEWXPCOM(rgn, nsThebesRegion);
|
|
||||||
nsCOMPtr<nsIScriptableRegion> scriptableRgn;
|
nsCOMPtr<nsIScriptableRegion> scriptableRgn;
|
||||||
if (rgn != nsnull)
|
if (rgn != nsnull)
|
||||||
{
|
{
|
||||||
|
|
|
@ -104,7 +104,7 @@ public: \
|
||||||
NS_LOG_RELEASE(this, count, #_class); \
|
NS_LOG_RELEASE(this, count, #_class); \
|
||||||
if (count == 0) { \
|
if (count == 0) { \
|
||||||
mRefCnt = 1; /* stabilize */ \
|
mRefCnt = 1; /* stabilize */ \
|
||||||
NS_DELETEXPCOM(this); \
|
delete this; \
|
||||||
return 0; \
|
return 0; \
|
||||||
} \
|
} \
|
||||||
return count; \
|
return count; \
|
||||||
|
|
|
@ -164,7 +164,7 @@ static nsCompressedMap gLowerMap = {
|
||||||
nsCaseConversionImp2* nsCaseConversionImp2::GetInstance()
|
nsCaseConversionImp2* nsCaseConversionImp2::GetInstance()
|
||||||
{
|
{
|
||||||
if (!gCaseConv)
|
if (!gCaseConv)
|
||||||
NS_NEWXPCOM(gCaseConv, nsCaseConversionImp2);
|
gCaseConv = new nsCaseConversionImp2();
|
||||||
return gCaseConv;
|
return gCaseConv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,7 @@ do_decrement:
|
||||||
|
|
||||||
if(0 == cnt)
|
if(0 == cnt)
|
||||||
{
|
{
|
||||||
NS_DELETEXPCOM(this); // also unlinks us from chain
|
delete this; // also unlinks us from chain
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(1 == cnt)
|
if(1 == cnt)
|
||||||
|
|
|
@ -77,7 +77,7 @@ NS_IMETHODIMP_(nsrefcnt) xpctestNoisy::Release(void)
|
||||||
printf("Noisy %d - decremented refcount to %d\n", mID, mRefCnt.get());
|
printf("Noisy %d - decremented refcount to %d\n", mID, mRefCnt.get());
|
||||||
NS_LOG_RELEASE(this, mRefCnt, "xpctestNoisy");
|
NS_LOG_RELEASE(this, mRefCnt, "xpctestNoisy");
|
||||||
if (mRefCnt == 0) {
|
if (mRefCnt == 0) {
|
||||||
NS_DELETEXPCOM(this);
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return mRefCnt;
|
return mRefCnt;
|
||||||
|
|
|
@ -789,8 +789,7 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow)
|
||||||
//
|
//
|
||||||
// now register ourselves as a focus listener, so that we get called
|
// now register ourselves as a focus listener, so that we get called
|
||||||
// when the focus changes in the window
|
// when the focus changes in the window
|
||||||
nsDocViewerFocusListener *focusListener;
|
nsDocViewerFocusListener *focusListener = new nsDocViewerFocusListener();
|
||||||
NS_NEWXPCOM(focusListener, nsDocViewerFocusListener);
|
|
||||||
NS_ENSURE_TRUE(focusListener, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(focusListener, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
focusListener->Init(this);
|
focusListener->Init(this);
|
||||||
|
|
|
@ -591,15 +591,13 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
|
||||||
{ \
|
{ \
|
||||||
nsresult rv; \
|
nsresult rv; \
|
||||||
\
|
\
|
||||||
_InstanceClass * inst; \
|
|
||||||
\
|
|
||||||
*aResult = NULL; \
|
*aResult = NULL; \
|
||||||
if (NULL != aOuter) { \
|
if (NULL != aOuter) { \
|
||||||
rv = NS_ERROR_NO_AGGREGATION; \
|
rv = NS_ERROR_NO_AGGREGATION; \
|
||||||
return rv; \
|
return rv; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
NS_NEWXPCOM(inst, _InstanceClass); \
|
_InstanceClass * inst = new _InstanceClass(); \
|
||||||
if (NULL == inst) { \
|
if (NULL == inst) { \
|
||||||
rv = NS_ERROR_OUT_OF_MEMORY; \
|
rv = NS_ERROR_OUT_OF_MEMORY; \
|
||||||
return rv; \
|
return rv; \
|
||||||
|
|
|
@ -142,8 +142,7 @@ nsBulletFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
||||||
if (newRequest) {
|
if (newRequest) {
|
||||||
|
|
||||||
if (!mListener) {
|
if (!mListener) {
|
||||||
nsBulletListener *listener;
|
nsBulletListener *listener = new nsBulletListener();
|
||||||
NS_NEWXPCOM(listener, nsBulletListener);
|
|
||||||
NS_ADDREF(listener);
|
NS_ADDREF(listener);
|
||||||
listener->SetFrame(this);
|
listener->SetFrame(this);
|
||||||
listener->QueryInterface(NS_GET_IID(imgIDecoderObserver), getter_AddRefs(mListener));
|
listener->QueryInterface(NS_GET_IID(imgIDecoderObserver), getter_AddRefs(mListener));
|
||||||
|
|
|
@ -222,8 +222,7 @@ nsImageBoxFrame::Init(nsIContent* aContent,
|
||||||
nsIFrame* aPrevInFlow)
|
nsIFrame* aPrevInFlow)
|
||||||
{
|
{
|
||||||
if (!mListener) {
|
if (!mListener) {
|
||||||
nsImageBoxListener *listener;
|
nsImageBoxListener *listener = new nsImageBoxListener();
|
||||||
NS_NEWXPCOM(listener, nsImageBoxListener);
|
|
||||||
NS_ADDREF(listener);
|
NS_ADDREF(listener);
|
||||||
listener->SetFrame(this);
|
listener->SetFrame(this);
|
||||||
listener->QueryInterface(NS_GET_IID(imgIDecoderObserver), getter_AddRefs(mListener));
|
listener->QueryInterface(NS_GET_IID(imgIDecoderObserver), getter_AddRefs(mListener));
|
||||||
|
|
|
@ -145,7 +145,7 @@ nsrefcnt nsJAR::Release(void)
|
||||||
mRefCnt = 1; /* stabilize */
|
mRefCnt = 1; /* stabilize */
|
||||||
/* enable this to find non-threadsafe destructors: */
|
/* enable this to find non-threadsafe destructors: */
|
||||||
/* NS_ASSERT_OWNINGTHREAD(nsJAR); */
|
/* NS_ASSERT_OWNINGTHREAD(nsJAR); */
|
||||||
NS_DELETEXPCOM(this);
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (1 == count && mCache) {
|
else if (1 == count && mCache) {
|
||||||
|
|
|
@ -94,8 +94,7 @@ NS_IMETHODIMP nsIconProtocolHandler::NewURI(const nsACString &aSpec,
|
||||||
nsIURI **result)
|
nsIURI **result)
|
||||||
{
|
{
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> uri;
|
nsCOMPtr<nsIURI> uri = new nsMozIconURI();
|
||||||
NS_NEWXPCOM(uri, nsMozIconURI);
|
|
||||||
if (!uri) return NS_ERROR_OUT_OF_MEMORY;
|
if (!uri) return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
nsresult rv = uri->SetSpec(aSpec);
|
nsresult rv = uri->SetSpec(aSpec);
|
||||||
|
|
|
@ -661,7 +661,7 @@ nsresult imgLoader::CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup
|
||||||
if (aProxyRequest) {
|
if (aProxyRequest) {
|
||||||
proxyRequest = static_cast<imgRequestProxy *>(aProxyRequest);
|
proxyRequest = static_cast<imgRequestProxy *>(aProxyRequest);
|
||||||
} else {
|
} else {
|
||||||
NS_NEWXPCOM(proxyRequest, imgRequestProxy);
|
proxyRequest = new imgRequestProxy();
|
||||||
if (!proxyRequest) return NS_ERROR_OUT_OF_MEMORY;
|
if (!proxyRequest) return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
NS_ADDREF(proxyRequest);
|
NS_ADDREF(proxyRequest);
|
||||||
|
|
|
@ -80,7 +80,7 @@ NS_IMETHODIMP imgTools::DecodeImageData(nsIInputStream* aInStr,
|
||||||
NS_ENSURE_ARG_POINTER(aInStr);
|
NS_ENSURE_ARG_POINTER(aInStr);
|
||||||
// If the caller didn't provide a container, create one
|
// If the caller didn't provide a container, create one
|
||||||
if (!*aContainer) {
|
if (!*aContainer) {
|
||||||
NS_NEWXPCOM(*aContainer, imgContainer);
|
*aContainer = new imgContainer();
|
||||||
if (!*aContainer)
|
if (!*aContainer)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
NS_ADDREF(*aContainer);
|
NS_ADDREF(*aContainer);
|
||||||
|
|
|
@ -288,8 +288,7 @@ nsMIMEInputStreamConstructor(nsISupports *outer, REFNSIID iid, void **result)
|
||||||
if (outer)
|
if (outer)
|
||||||
return NS_ERROR_NO_AGGREGATION;
|
return NS_ERROR_NO_AGGREGATION;
|
||||||
|
|
||||||
nsMIMEInputStream *inst;
|
nsMIMEInputStream *inst = new nsMIMEInputStream();
|
||||||
NS_NEWXPCOM(inst, nsMIMEInputStream);
|
|
||||||
if (!inst)
|
if (!inst)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
|
|
@ -1675,8 +1675,7 @@ nsStandardURL::SchemeIs(const char *scheme, PRBool *result)
|
||||||
/* virtual */ nsStandardURL*
|
/* virtual */ nsStandardURL*
|
||||||
nsStandardURL::StartClone()
|
nsStandardURL::StartClone()
|
||||||
{
|
{
|
||||||
nsStandardURL *clone;
|
nsStandardURL *clone = new nsStandardURL();
|
||||||
NS_NEWXPCOM(clone, nsStandardURL);
|
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,8 +133,7 @@ nsResURL::EnsureFile()
|
||||||
/* virtual */ nsStandardURL*
|
/* virtual */ nsStandardURL*
|
||||||
nsResURL::StartClone()
|
nsResURL::StartClone()
|
||||||
{
|
{
|
||||||
nsResURL *clone;
|
nsResURL *clone = new nsResURL();
|
||||||
NS_NEWXPCOM(clone, nsResURL);
|
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,8 +335,7 @@ nsResProtocolHandler::NewURI(const nsACString &aSpec,
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
nsResURL *resURL;
|
nsResURL *resURL = new nsResURL();
|
||||||
NS_NEWXPCOM(resURL, nsResURL);
|
|
||||||
if (!resURL)
|
if (!resURL)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
NS_ADDREF(resURL);
|
NS_ADDREF(resURL);
|
||||||
|
|
|
@ -106,7 +106,7 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
|
||||||
return NS_ERROR_FAILURE; \
|
return NS_ERROR_FAILURE; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
NS_NEWXPCOM(inst, _InstanceClass); \
|
inst = new _InstanceClass(); \
|
||||||
if (NULL == inst) { \
|
if (NULL == inst) { \
|
||||||
if (triggeredByNSSComponent) \
|
if (triggeredByNSSComponent) \
|
||||||
EnsureNSSInitialized(nssInitFailed); \
|
EnsureNSSInitialized(nssInitFailed); \
|
||||||
|
@ -155,7 +155,7 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
|
||||||
return NS_ERROR_FAILURE; \
|
return NS_ERROR_FAILURE; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
NS_NEWXPCOM(inst, _InstanceClass); \
|
inst = new _InstanceClass(); \
|
||||||
if (NULL == inst) { \
|
if (NULL == inst) { \
|
||||||
if (triggeredByNSSComponent) \
|
if (triggeredByNSSComponent) \
|
||||||
EnsureNSSInitialized(nssInitFailed); \
|
EnsureNSSInitialized(nssInitFailed); \
|
||||||
|
|
|
@ -401,8 +401,7 @@ NS_IMETHODIMP nsExternalProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **_
|
||||||
PRBool haveExternalHandler = HaveExternalProtocolHandler(aURI);
|
PRBool haveExternalHandler = HaveExternalProtocolHandler(aURI);
|
||||||
if (haveExternalHandler)
|
if (haveExternalHandler)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIChannel> channel;
|
nsCOMPtr<nsIChannel> channel = new nsExtProtocolChannel();
|
||||||
NS_NEWXPCOM(channel, nsExtProtocolChannel);
|
|
||||||
if (!channel) return NS_ERROR_OUT_OF_MEMORY;
|
if (!channel) return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
((nsExtProtocolChannel*) channel.get())->SetURI(aURI);
|
((nsExtProtocolChannel*) channel.get())->SetURI(aURI);
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
NS_LOG_RELEASE(this, mRefCnt, "nsGtkIMModule");
|
NS_LOG_RELEASE(this, mRefCnt, "nsGtkIMModule");
|
||||||
if (mRefCnt == 0) {
|
if (mRefCnt == 0) {
|
||||||
mRefCnt = 1; /* stabilize */
|
mRefCnt = 1; /* stabilize */
|
||||||
NS_DELETEXPCOM(this);
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return mRefCnt;
|
return mRefCnt;
|
||||||
|
|
|
@ -123,7 +123,7 @@ nsNativeThemeGTKConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_NEWXPCOM(inst, nsNativeThemeGTK);
|
inst = new nsNativeThemeGTK();
|
||||||
if (NULL == inst) {
|
if (NULL == inst) {
|
||||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -197,7 +197,7 @@ nsNativeKeyBindingsConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_NEWXPCOM(inst, nsNativeKeyBindings);
|
inst = new nsNativeKeyBindings();
|
||||||
if (NULL == inst) {
|
if (NULL == inst) {
|
||||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -1217,7 +1217,7 @@ static nsresult nsRwsServiceInit(nsRwsService **aClass)
|
||||||
}
|
}
|
||||||
|
|
||||||
// create an instance of nsRwsService
|
// create an instance of nsRwsService
|
||||||
NS_NEWXPCOM(sRwsInstance, nsRwsService);
|
sRwsInstance = new nsRwsService();
|
||||||
if (sRwsInstance == 0)
|
if (sRwsInstance == 0)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ nsNativeThemeQtConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||||
if (NULL != aOuter)
|
if (NULL != aOuter)
|
||||||
return NS_ERROR_NO_AGGREGATION;
|
return NS_ERROR_NO_AGGREGATION;
|
||||||
|
|
||||||
NS_NEWXPCOM(inst, nsNativeThemeQt);
|
inst = new nsNativeThemeQt();
|
||||||
if (NULL == inst)
|
if (NULL == inst)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ _class::Internal::Release(void) \
|
||||||
NS_LOG_RELEASE(this, agg->mRefCnt, #_class); \
|
NS_LOG_RELEASE(this, agg->mRefCnt, #_class); \
|
||||||
if (agg->mRefCnt == 0) { \
|
if (agg->mRefCnt == 0) { \
|
||||||
agg->mRefCnt = 1; /* stabilize */ \
|
agg->mRefCnt = 1; /* stabilize */ \
|
||||||
NS_DELETEXPCOM(agg); \
|
delete agg; \
|
||||||
return 0; \
|
return 0; \
|
||||||
} \
|
} \
|
||||||
return agg->mRefCnt; \
|
return agg->mRefCnt; \
|
||||||
|
@ -188,7 +188,7 @@ _class::Internal::Release(void) \
|
||||||
NS_LOG_RELEASE(this, count, #_class); \
|
NS_LOG_RELEASE(this, count, #_class); \
|
||||||
if (count == 0) { \
|
if (count == 0) { \
|
||||||
agg->mRefCnt.stabilizeForDeletion(this); \
|
agg->mRefCnt.stabilizeForDeletion(this); \
|
||||||
NS_DELETEXPCOM(agg); \
|
delete agg; \
|
||||||
return 0; \
|
return 0; \
|
||||||
} \
|
} \
|
||||||
return count; \
|
return count; \
|
||||||
|
|
|
@ -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:
|
// yet we still want to see creation information:
|
||||||
|
|
||||||
PRBool loggingThisType = (!gTypesToLog || LogThisType(aClazz));
|
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:
|
// yet we still want to see deletion information:
|
||||||
|
|
||||||
if (aRefcnt == 0 && gAllocLog && loggingThisType && loggingThisObject) {
|
if (aRefcnt == 0 && gAllocLog && loggingThisType && loggingThisObject) {
|
||||||
|
|
|
@ -327,7 +327,7 @@ public: \
|
||||||
NS_LOG_RELEASE(this, mRefCnt, #_class); \
|
NS_LOG_RELEASE(this, mRefCnt, #_class); \
|
||||||
if (mRefCnt == 0) { \
|
if (mRefCnt == 0) { \
|
||||||
mRefCnt = 1; /* stabilize */ \
|
mRefCnt = 1; /* stabilize */ \
|
||||||
NS_DELETEXPCOM(this); \
|
delete this; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
protected: \
|
protected: \
|
||||||
|
@ -411,7 +411,7 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
|
||||||
* the refcount to |0|.
|
* the refcount to |0|.
|
||||||
*/
|
*/
|
||||||
#define NS_IMPL_RELEASE(_class) \
|
#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>
|
* 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)
|
NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _basetype, _destroy)
|
||||||
|
|
||||||
#define NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(_class, _basetype) \
|
#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) \
|
#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 */ \
|
mRefCnt = 1; /* stabilize */ \
|
||||||
/* enable this to find non-threadsafe destructors: */ \
|
/* enable this to find non-threadsafe destructors: */ \
|
||||||
/* NS_ASSERT_OWNINGTHREAD(_class); */ \
|
/* NS_ASSERT_OWNINGTHREAD(_class); */ \
|
||||||
NS_DELETEXPCOM(this); \
|
delete (this); \
|
||||||
return 0; \
|
return 0; \
|
||||||
} \
|
} \
|
||||||
return count; \
|
return count; \
|
||||||
|
|
|
@ -61,27 +61,6 @@
|
||||||
#include "nsISupportsImpl.h"
|
#include "nsISupportsImpl.h"
|
||||||
#endif
|
#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.
|
* Macro for adding a reference to an interface.
|
||||||
* @param _ptr The interface pointer.
|
* @param _ptr The interface pointer.
|
||||||
|
|
|
@ -306,8 +306,7 @@ NS_NewInputStreamTeeAsync(nsIInputStream **result,
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
nsCOMPtr<nsIInputStreamTee> tee;
|
nsCOMPtr<nsIInputStreamTee> tee = new nsInputStreamTee();
|
||||||
NS_NEWXPCOM(tee, nsInputStreamTee);
|
|
||||||
if (!tee)
|
if (!tee)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
|
|
@ -398,8 +398,7 @@ nsMultiplexInputStreamConstructor(nsISupports *outer,
|
||||||
if (outer)
|
if (outer)
|
||||||
return NS_ERROR_NO_AGGREGATION;
|
return NS_ERROR_NO_AGGREGATION;
|
||||||
|
|
||||||
nsMultiplexInputStream *inst;
|
nsMultiplexInputStream *inst = new nsMultiplexInputStream();
|
||||||
NS_NEWXPCOM(inst, nsMultiplexInputStream);
|
|
||||||
if (!inst)
|
if (!inst)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ nsProxyEventObject::Release(void)
|
||||||
|
|
||||||
// call the destructor outside of the lock so that we aren't holding the
|
// call the destructor outside of the lock so that we aren't holding the
|
||||||
// lock when we release the object
|
// lock when we release the object
|
||||||
NS_DELETEXPCOM(this);
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -699,7 +699,7 @@ xptiInterfaceInfo::Release(void)
|
||||||
mEntry = nsnull;
|
mEntry = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_DELETEXPCOM(this);
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
|
|
|
@ -150,7 +150,7 @@ Bar::Release(void)
|
||||||
NS_LOG_RELEASE(this, mRefCnt, "Bar");
|
NS_LOG_RELEASE(this, mRefCnt, "Bar");
|
||||||
if (mRefCnt == 0) {
|
if (mRefCnt == 0) {
|
||||||
mRefCnt = 1; /* stabilize */
|
mRefCnt = 1; /* stabilize */
|
||||||
NS_DELETEXPCOM(this);
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return mRefCnt;
|
return mRefCnt;
|
||||||
|
|
|
@ -91,7 +91,7 @@ NS_IMETHODIMP_(nsrefcnt) nsTimerImpl::Release(void)
|
||||||
|
|
||||||
/* enable this to find non-threadsafe destructors: */
|
/* enable this to find non-threadsafe destructors: */
|
||||||
/* NS_ASSERT_OWNINGTHREAD(nsTimerImpl); */
|
/* NS_ASSERT_OWNINGTHREAD(nsTimerImpl); */
|
||||||
NS_DELETEXPCOM(this);
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче