From 921625ab051e296557df28b9941b970ffad10cdc Mon Sep 17 00:00:00 2001 From: Neil Rashbrook Date: Tue, 18 Mar 2014 00:23:03 +0000 Subject: [PATCH] Bug 514280 Stop using nsCOMPtr for concrete types r=bsmedberg --HG-- extra : rebase_source : f8fb50de9292320eb7589dd28dc566d0f5044da6 --- content/canvas/src/DocumentRendererChild.cpp | 2 +- content/media/MediaDecoder.h | 2 +- content/media/MediaDecoderStateMachine.cpp | 4 +- content/media/plugins/MediaPluginHost.h | 2 +- content/media/plugins/MediaResourceServer.cpp | 6 +-- content/media/webaudio/AudioContext.cpp | 2 +- content/xml/document/src/nsXMLContentSink.cpp | 2 +- .../src/nsXULTemplateQueryProcessorRDF.h | 2 +- dom/base/Navigator.h | 2 +- dom/base/nsContentPermissionHelper.cpp | 2 +- dom/base/nsGlobalWindow.cpp | 2 +- dom/camera/DOMCameraControl.cpp | 40 +++++++++---------- dom/camera/DOMCameraControl.h | 32 +++++++-------- dom/camera/DOMCameraManager.cpp | 2 +- .../DeviceStorageRequestChild.cpp | 2 +- dom/ipc/ContentParent.cpp | 4 +- dom/ipc/ContentParent.h | 2 +- dom/plugins/base/nsNPAPIPluginInstance.h | 2 +- dom/smil/nsSMILTimeValueSpec.h | 2 +- editor/composer/src/nsEditorSpellCheck.cpp | 2 +- embedding/components/find/src/nsFind.h | 3 +- extensions/auth/nsAuthFactory.cpp | 3 +- .../spellcheck/src/mozInlineSpellChecker.h | 2 +- gfx/layers/LayerScope.cpp | 2 +- ipc/glue/BackgroundImpl.cpp | 2 +- layout/generic/nsSubDocumentFrame.cpp | 2 +- layout/inspector/nsFontFaceList.cpp | 2 +- layout/mathml/nsMathMLmactionFrame.h | 2 +- layout/style/MediaQueryList.h | 3 +- media/mtransport/nriceresolver.cpp | 2 +- media/mtransport/transportlayerprsock.h | 2 +- netwerk/base/src/BackgroundFileSaver.cpp | 2 +- netwerk/base/src/nsUDPSocket.cpp | 2 +- netwerk/cache/nsCacheEntryDescriptor.cpp | 2 +- netwerk/cache2/CacheIndex.cpp | 2 +- netwerk/test/TestUDPSocket.cpp | 4 +- parser/xml/src/nsSAXXMLReader.cpp | 2 +- security/manager/ssl/src/nsNSSCallbacks.cpp | 4 +- security/manager/ssl/src/nsNSSCallbacks.h | 3 +- storage/src/VacuumManager.cpp | 4 +- .../url-classifier/nsUrlClassifierDBService.h | 2 +- toolkit/profile/nsToolkitProfileService.cpp | 10 ++--- widget/android/nsAppShell.cpp | 2 +- widget/xpwidgets/nsBaseWidget.h | 2 +- xpcom/ds/nsINIParserImpl.cpp | 2 +- 45 files changed, 93 insertions(+), 91 deletions(-) diff --git a/content/canvas/src/DocumentRendererChild.cpp b/content/canvas/src/DocumentRendererChild.cpp index 2196509d478..3187a179e9a 100644 --- a/content/canvas/src/DocumentRendererChild.cpp +++ b/content/canvas/src/DocumentRendererChild.cpp @@ -47,7 +47,7 @@ DocumentRendererChild::RenderDocument(nsIDOMWindow *window, if (flushLayout) nsContentUtils::FlushLayoutForTree(window); - nsCOMPtr presContext; + nsRefPtr presContext; nsCOMPtr win = do_QueryInterface(window); if (win) { nsIDocShell* docshell = win->GetDocShell(); diff --git a/content/media/MediaDecoder.h b/content/media/MediaDecoder.h index f5a2ef0f098..8d6017e3675 100644 --- a/content/media/MediaDecoder.h +++ b/content/media/MediaDecoder.h @@ -1025,7 +1025,7 @@ protected: // is synchronised on a monitor. The lifetime of this object is // after mPlayState is LOADING and before mPlayState is SHUTDOWN. It // is safe to access it during this period. - nsCOMPtr mDecoderStateMachine; + nsRefPtr mDecoderStateMachine; // Media data resource. nsRefPtr mResource; diff --git a/content/media/MediaDecoderStateMachine.cpp b/content/media/MediaDecoderStateMachine.cpp index c4bd6ac7f5e..244c4b37b04 100644 --- a/content/media/MediaDecoderStateMachine.cpp +++ b/content/media/MediaDecoderStateMachine.cpp @@ -2060,7 +2060,7 @@ public: } private: nsRefPtr mDecoder; - nsCOMPtr mStateMachine; + nsRefPtr mStateMachine; }; // Runnable which dispatches an event to the main thread to dispose of the @@ -2079,7 +2079,7 @@ public: } private: nsRefPtr mDecoder; - nsCOMPtr mStateMachine; + nsRefPtr mStateMachine; }; nsresult MediaDecoderStateMachine::RunStateMachine() diff --git a/content/media/plugins/MediaPluginHost.h b/content/media/plugins/MediaPluginHost.h index a4c7ada9325..8468d869e04 100644 --- a/content/media/plugins/MediaPluginHost.h +++ b/content/media/plugins/MediaPluginHost.h @@ -16,7 +16,7 @@ namespace mozilla { class MediaPluginReader; class MediaPluginHost { - nsCOMPtr mResourceServer; + nsRefPtr mResourceServer; nsTArray mPlugins; MPAPI::Manifest *FindPlugin(const nsACString& aMimeType); diff --git a/content/media/plugins/MediaResourceServer.cpp b/content/media/plugins/MediaResourceServer.cpp index 932b9d8936b..8ed6437deeb 100644 --- a/content/media/plugins/MediaResourceServer.cpp +++ b/content/media/plugins/MediaResourceServer.cpp @@ -112,7 +112,7 @@ private: // The MediaResourceServer that owns the MediaResource instances // served. This is used to lookup the MediaResource from the URL. - nsCOMPtr mServer; + nsRefPtr mServer; // Write 'aBufferLength' bytes from 'aBuffer' to 'mOutput'. This // method ensures all the data is written by checking the number @@ -342,7 +342,7 @@ class ResourceSocketListener : public nsIServerSocketListener public: // The MediaResourceServer used to look up the MediaResource // on requests. - nsCOMPtr mServer; + nsRefPtr mServer; public: NS_DECL_THREADSAFE_ISUPPORTS @@ -416,7 +416,7 @@ MediaResourceServer::Run() already_AddRefed MediaResourceServer::Start() { - nsCOMPtr server = new MediaResourceServer(); + nsRefPtr server = new MediaResourceServer(); NS_DispatchToMainThread(server, NS_DISPATCH_SYNC); return server.forget(); } diff --git a/content/media/webaudio/AudioContext.cpp b/content/media/webaudio/AudioContext.cpp index 7e5b0d65644..c526703cb63 100644 --- a/content/media/webaudio/AudioContext.cpp +++ b/content/media/webaudio/AudioContext.cpp @@ -460,7 +460,7 @@ AudioContext::DecodeAudioData(const ArrayBuffer& aBuffer, aBuffer.Data(), aBuffer.Length(), contentType); - nsCOMPtr failureCallback; + nsRefPtr failureCallback; if (aFailureCallback.WasPassed()) { failureCallback = &aFailureCallback.Value(); } diff --git a/content/xml/document/src/nsXMLContentSink.cpp b/content/xml/document/src/nsXMLContentSink.cpp index 17c873bad97..104d80a9bc9 100644 --- a/content/xml/document/src/nsXMLContentSink.cpp +++ b/content/xml/document/src/nsXMLContentSink.cpp @@ -202,7 +202,7 @@ nsXMLContentSink::MaybePrettyPrint() mCSSLoader->SetEnabled(true); } - nsCOMPtr printer; + nsRefPtr printer; nsresult rv = NS_NewXMLPrettyPrinter(getter_AddRefs(printer)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.h b/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.h index 3884248b148..8662f5ac066 100644 --- a/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.h +++ b/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.h @@ -44,7 +44,7 @@ class nsXULTemplateQueryProcessorRDF MOZ_FINAL : public nsIXULTemplateQueryProce public nsIRDFObserver { public: - typedef nsTArray > ResultArray; + typedef nsTArray > ResultArray; nsXULTemplateQueryProcessorRDF(); diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h index d250afc1183..cf4bf07b182 100644 --- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -338,7 +338,7 @@ private: nsRefPtr mVoicemail; #endif #ifdef MOZ_B2G_BT - nsCOMPtr mBluetooth; + nsRefPtr mBluetooth; #endif #ifdef MOZ_AUDIO_CHANNEL_MANAGER nsRefPtr mAudioChannelManager; diff --git a/dom/base/nsContentPermissionHelper.cpp b/dom/base/nsContentPermissionHelper.cpp index 0500e83890e..53a7b044a0c 100644 --- a/dom/base/nsContentPermissionHelper.cpp +++ b/dom/base/nsContentPermissionHelper.cpp @@ -42,7 +42,7 @@ class ContentPermissionRequestParent : public PContentPermissionRequestParent nsCOMPtr mPrincipal; nsCOMPtr mElement; - nsCOMPtr mProxy; + nsRefPtr mProxy; nsTArray mRequests; private: diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 1e9667dbdb9..3b815ccd445 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -5033,7 +5033,7 @@ nsGlobalWindow::GetDevicePixelRatio(ErrorResult& aError) return 1.0; } - nsCOMPtr presContext; + nsRefPtr presContext; mDocShell->GetPresContext(getter_AddRefs(presContext)); if (!presContext) { return 1.0; diff --git a/dom/camera/DOMCameraControl.cpp b/dom/camera/DOMCameraControl.cpp index 98df9650ab9..1685db5b51c 100644 --- a/dom/camera/DOMCameraControl.cpp +++ b/dom/camera/DOMCameraControl.cpp @@ -613,7 +613,7 @@ nsDOMCameraControl::SensorAngle() already_AddRefed nsDOMCameraControl::GetOnShutter() { - nsCOMPtr cb = mOnShutterCb; + nsRefPtr cb = mOnShutterCb; return cb.forget(); } @@ -627,7 +627,7 @@ nsDOMCameraControl::SetOnShutter(CameraShutterCallback* aCb) already_AddRefed nsDOMCameraControl::GetOnClosed() { - nsCOMPtr onClosed = mOnClosedCb; + nsRefPtr onClosed = mOnClosedCb; return onClosed.forget(); } @@ -640,7 +640,7 @@ nsDOMCameraControl::SetOnClosed(CameraClosedCallback* aCb) already_AddRefed nsDOMCameraControl::GetOnRecorderStateChange() { - nsCOMPtr cb = mOnRecorderStateChangeCb; + nsRefPtr cb = mOnRecorderStateChangeCb; return cb.forget(); } @@ -654,7 +654,7 @@ nsDOMCameraControl::SetOnRecorderStateChange(CameraRecorderStateChange* aCb) already_AddRefed nsDOMCameraControl::GetOnPreviewStateChange() { - nsCOMPtr cb = mOnPreviewStateChangeCb; + nsRefPtr cb = mOnPreviewStateChangeCb; return cb.forget(); } void @@ -783,7 +783,7 @@ nsDOMCameraControl::SetConfiguration(const CameraConfiguration& aConfiguration, { MOZ_ASSERT(mCameraControl); - nsCOMPtr cb = mTakePictureOnSuccessCb; + nsRefPtr cb = mTakePictureOnSuccessCb; if (cb) { // We're busy taking a picture, can't change modes right now. if (aOnError.WasPassed()) { @@ -822,12 +822,12 @@ nsDOMCameraControl::AutoFocus(CameraAutoFocusCallback& aOnSuccess, { MOZ_ASSERT(mCameraControl); - nsCOMPtr cb = mAutoFocusOnSuccessCb.forget(); + nsRefPtr cb = mAutoFocusOnSuccessCb.forget(); bool cancel = false; if (cb) { // we have a callback, which means we're already in the process of // auto-focusing--cancel the old callback - nsCOMPtr ecb = mAutoFocusOnErrorCb.forget(); + nsRefPtr ecb = mAutoFocusOnErrorCb.forget(); if (ecb) { ErrorResult ignored; ecb->Call(NS_LITERAL_STRING("Interrupted"), ignored); @@ -852,7 +852,7 @@ nsDOMCameraControl::TakePicture(const CameraPictureOptions& aOptions, { MOZ_ASSERT(mCameraControl); - nsCOMPtr cb = mTakePictureOnSuccessCb; + nsRefPtr cb = mTakePictureOnSuccessCb; if (cb) { // There is already a call to TakePicture() in progress, abort this one and // invoke the error callback (if one was passed in). @@ -971,7 +971,7 @@ nsDOMCameraControl::OnHardwareStateChange(CameraControlListener::HardwareState a // The hardware is open, so we can return a camera to JS, even if // the preview hasn't started yet. if (mGetCameraOnSuccessCb) { - nsCOMPtr cb = mGetCameraOnSuccessCb.forget(); + nsRefPtr cb = mGetCameraOnSuccessCb.forget(); ErrorResult ignored; mGetCameraOnErrorCb = nullptr; cb->Call(*this, *mCurrentConfiguration, ignored); @@ -981,12 +981,12 @@ nsDOMCameraControl::OnHardwareStateChange(CameraControlListener::HardwareState a case CameraControlListener::kHardwareClosed: if (mReleaseOnSuccessCb) { // If we have this event handler, this was a solicited hardware close. - nsCOMPtr cb = mReleaseOnSuccessCb.forget(); + nsRefPtr cb = mReleaseOnSuccessCb.forget(); mReleaseOnErrorCb = nullptr; cb->Call(ignored); } else if(mOnClosedCb) { // If not, something else closed the hardware. - nsCOMPtr cb = mOnClosedCb; + nsRefPtr cb = mOnClosedCb; cb->Call(ignored); } break; @@ -1003,7 +1003,7 @@ nsDOMCameraControl::OnShutter() DOM_CAMERA_LOGI("DOM ** SNAP **\n"); - nsCOMPtr cb = mOnShutterCb; + nsRefPtr cb = mOnShutterCb; if (cb) { ErrorResult ignored; cb->Call(ignored); @@ -1030,7 +1030,7 @@ nsDOMCameraControl::OnPreviewStateChange(CameraControlListener::PreviewState aSt break; } - nsCOMPtr cb = mOnPreviewStateChangeCb; + nsRefPtr cb = mOnPreviewStateChangeCb; ErrorResult ignored; cb->Call(state, ignored); } @@ -1048,7 +1048,7 @@ nsDOMCameraControl::OnRecorderStateChange(CameraControlListener::RecorderState a switch (aState) { case CameraControlListener::kRecorderStarted: if (mStartRecordingOnSuccessCb) { - nsCOMPtr cb = mStartRecordingOnSuccessCb.forget(); + nsRefPtr cb = mStartRecordingOnSuccessCb.forget(); mStartRecordingOnErrorCb = nullptr; cb->Call(ignored); } @@ -1091,7 +1091,7 @@ nsDOMCameraControl::OnRecorderStateChange(CameraControlListener::RecorderState a return; } - nsCOMPtr cb = mOnRecorderStateChangeCb; + nsRefPtr cb = mOnRecorderStateChangeCb; if (cb) { cb->Call(state, ignored); } @@ -1117,7 +1117,7 @@ nsDOMCameraControl::OnConfigurationChange(DOMCameraConfiguration* aConfiguration DOM_CAMERA_LOGI(" recorder profile : %s\n", NS_ConvertUTF16toUTF8(mCurrentConfiguration->mRecorderProfile).get()); - nsCOMPtr cb = mSetConfigurationOnSuccessCb.forget(); + nsRefPtr cb = mSetConfigurationOnSuccessCb.forget(); mSetConfigurationOnErrorCb = nullptr; if (cb) { ErrorResult ignored; @@ -1130,7 +1130,7 @@ nsDOMCameraControl::OnAutoFocusComplete(bool aAutoFocusSucceeded) { MOZ_ASSERT(NS_IsMainThread()); - nsCOMPtr cb = mAutoFocusOnSuccessCb.forget(); + nsRefPtr cb = mAutoFocusOnSuccessCb.forget(); mAutoFocusOnErrorCb = nullptr; if (cb) { ErrorResult ignored; @@ -1143,7 +1143,7 @@ nsDOMCameraControl::OnTakePictureComplete(nsIDOMBlob* aPicture) { MOZ_ASSERT(NS_IsMainThread()); - nsCOMPtr cb = mTakePictureOnSuccessCb.forget(); + nsRefPtr cb = mTakePictureOnSuccessCb.forget(); mTakePictureOnErrorCb = nullptr; if (!cb) { // Warn because it shouldn't be possible to get here without @@ -1164,7 +1164,7 @@ nsDOMCameraControl::OnError(CameraControlListener::CameraErrorContext aContext, NS_LossyConvertUTF16toASCII(aError).get()); MOZ_ASSERT(NS_IsMainThread()); - nsCOMPtr* errorCb; + nsRefPtr* errorCb; switch (aContext) { case CameraControlListener::kInStartCamera: mGetCameraOnSuccessCb = nullptr; @@ -1240,7 +1240,7 @@ nsDOMCameraControl::OnError(CameraControlListener::CameraErrorContext aContext, } // kung-fu death grip - nsCOMPtr cb = (*errorCb).forget(); + nsRefPtr cb = (*errorCb).forget(); ErrorResult ignored; cb->Call(aError, ignored); } diff --git a/dom/camera/DOMCameraControl.h b/dom/camera/DOMCameraControl.h index 93968d8a500..d03a23c94ff 100644 --- a/dom/camera/DOMCameraControl.h +++ b/dom/camera/DOMCameraControl.h @@ -168,24 +168,24 @@ protected: nsRefPtr mCapabilities; // solicited camera control event handlers - nsCOMPtr mGetCameraOnSuccessCb; - nsCOMPtr mGetCameraOnErrorCb; - nsCOMPtr mAutoFocusOnSuccessCb; - nsCOMPtr mAutoFocusOnErrorCb; - nsCOMPtr mTakePictureOnSuccessCb; - nsCOMPtr mTakePictureOnErrorCb; - nsCOMPtr mStartRecordingOnSuccessCb; - nsCOMPtr mStartRecordingOnErrorCb; - nsCOMPtr mReleaseOnSuccessCb; - nsCOMPtr mReleaseOnErrorCb; - nsCOMPtr mSetConfigurationOnSuccessCb; - nsCOMPtr mSetConfigurationOnErrorCb; + nsRefPtr mGetCameraOnSuccessCb; + nsRefPtr mGetCameraOnErrorCb; + nsRefPtr mAutoFocusOnSuccessCb; + nsRefPtr mAutoFocusOnErrorCb; + nsRefPtr mTakePictureOnSuccessCb; + nsRefPtr mTakePictureOnErrorCb; + nsRefPtr mStartRecordingOnSuccessCb; + nsRefPtr mStartRecordingOnErrorCb; + nsRefPtr mReleaseOnSuccessCb; + nsRefPtr mReleaseOnErrorCb; + nsRefPtr mSetConfigurationOnSuccessCb; + nsRefPtr mSetConfigurationOnErrorCb; // unsolicited event handlers - nsCOMPtr mOnShutterCb; - nsCOMPtr mOnClosedCb; - nsCOMPtr mOnRecorderStateChangeCb; - nsCOMPtr mOnPreviewStateChangeCb; + nsRefPtr mOnShutterCb; + nsRefPtr mOnClosedCb; + nsRefPtr mOnRecorderStateChangeCb; + nsRefPtr mOnPreviewStateChangeCb; // Camera event listener; we only need this weak reference so that // we can remove the listener from the camera when we're done diff --git a/dom/camera/DOMCameraManager.cpp b/dom/camera/DOMCameraManager.cpp index be9ef630d96..2d08ee90084 100644 --- a/dom/camera/DOMCameraManager.cpp +++ b/dom/camera/DOMCameraManager.cpp @@ -119,7 +119,7 @@ nsDOMCameraManager::GetCamera(const nsAString& aCamera, cameraId = 1; } - nsCOMPtr errorCallback = nullptr; + nsRefPtr errorCallback = nullptr; if (aOnError.WasPassed()) { errorCallback = &aOnError.Value(); } diff --git a/dom/devicestorage/DeviceStorageRequestChild.cpp b/dom/devicestorage/DeviceStorageRequestChild.cpp index e58a83279a3..f33bc1af7a3 100644 --- a/dom/devicestorage/DeviceStorageRequestChild.cpp +++ b/dom/devicestorage/DeviceStorageRequestChild.cpp @@ -190,7 +190,7 @@ DeviceStorageRequestChild:: cursor->mFiles.AppendElement(dsf); } - nsCOMPtr event = new ContinueCursorEvent(cursor); + nsRefPtr event = new ContinueCursorEvent(cursor); event->Continue(); break; } diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index bbb4b54a2b2..69aeab87de2 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -3329,7 +3329,7 @@ ContentParent::RecvAddIdleObserver(const uint64_t& aObserver, const uint32_t& aI do_GetService("@mozilla.org/widget/idleservice;1", &rv); NS_ENSURE_SUCCESS(rv, false); - nsCOMPtr listener = new ParentIdleListener(this, aObserver); + nsRefPtr listener = new ParentIdleListener(this, aObserver); mIdleListeners.Put(aObserver, listener); idleService->AddIdleObserver(listener, aIdleTimeInS); return true; @@ -3343,7 +3343,7 @@ ContentParent::RecvRemoveIdleObserver(const uint64_t& aObserver, const uint32_t& do_GetService("@mozilla.org/widget/idleservice;1", &rv); NS_ENSURE_SUCCESS(rv, false); - nsCOMPtr listener; + nsRefPtr listener; bool found = mIdleListeners.Get(aObserver, &listener); if (found) { mIdleListeners.Remove(aObserver); diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 2b334671bef..86b251ebc8d 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -585,7 +585,7 @@ private: nsRefPtr mConsoleService; nsConsoleService* GetConsoleService(); - nsDataHashtable > mIdleListeners; + nsDataHashtable > mIdleListeners; #ifdef MOZ_X11 // Dup of child's X socket, used to scope its resources to this diff --git a/dom/plugins/base/nsNPAPIPluginInstance.h b/dom/plugins/base/nsNPAPIPluginInstance.h index 2c2cc893503..b0eb3d5ea92 100644 --- a/dom/plugins/base/nsNPAPIPluginInstance.h +++ b/dom/plugins/base/nsNPAPIPluginInstance.h @@ -326,7 +326,7 @@ protected: friend class PluginEventRunnable; - nsTArray> mPostedEvents; + nsTArray> mPostedEvents; void PopPostedEvent(PluginEventRunnable* r); void OnSurfaceTextureFrameAvailable(); diff --git a/dom/smil/nsSMILTimeValueSpec.h b/dom/smil/nsSMILTimeValueSpec.h index 17018662f9d..b49dd44b245 100644 --- a/dom/smil/nsSMILTimeValueSpec.h +++ b/dom/smil/nsSMILTimeValueSpec.h @@ -124,7 +124,7 @@ protected: private: nsSMILTimeValueSpec* mSpec; }; - nsCOMPtr mEventListener; + nsRefPtr mEventListener; }; #endif // NS_SMILTIMEVALUESPEC_H_ diff --git a/editor/composer/src/nsEditorSpellCheck.cpp b/editor/composer/src/nsEditorSpellCheck.cpp index bfdc354b148..74bdfc97b32 100644 --- a/editor/composer/src/nsEditorSpellCheck.cpp +++ b/editor/composer/src/nsEditorSpellCheck.cpp @@ -144,7 +144,7 @@ public: nsString mDictionary; private: - nsCOMPtr mSpellCheck; + nsRefPtr mSpellCheck; }; NS_IMPL_ISUPPORTS1(DictionaryFetcher, nsIContentPrefCallback2) diff --git a/embedding/components/find/src/nsFind.h b/embedding/components/find/src/nsFind.h index 8f3f43de73f..43a8f2e0a66 100644 --- a/embedding/components/find/src/nsFind.h +++ b/embedding/components/find/src/nsFind.h @@ -8,6 +8,7 @@ #include "nsIFind.h" +#include "nsAutoPtr.h" #include "nsCOMPtr.h" #include "nsCycleCollectionParticipant.h" #include "nsIDOMNode.h" @@ -69,7 +70,7 @@ protected: // The iterator we use to move through the document: nsresult InitIterator(nsIDOMNode* aStartNode, int32_t aStartOffset, nsIDOMNode* aEndNode, int32_t aEndOffset); - nsCOMPtr mIterator; + nsRefPtr mIterator; }; #endif // nsFind_h__ diff --git a/extensions/auth/nsAuthFactory.cpp b/extensions/auth/nsAuthFactory.cpp index 68fa90836b4..eb600c1ce5f 100644 --- a/extensions/auth/nsAuthFactory.cpp +++ b/extensions/auth/nsAuthFactory.cpp @@ -4,6 +4,7 @@ #include "mozilla/ModuleUtils.h" #include "nsAuth.h" +#include "nsAutoPtr.h" //----------------------------------------------------------------------------- @@ -112,7 +113,7 @@ nsSambaNTLMAuthConstructor(nsISupports *outer, REFNSIID iid, void **result) if (outer) return NS_ERROR_NO_AGGREGATION; - nsCOMPtr auth = new nsAuthSambaNTLM(); + nsRefPtr auth = new nsAuthSambaNTLM(); if (!auth) return NS_ERROR_OUT_OF_MEMORY; diff --git a/extensions/spellcheck/src/mozInlineSpellChecker.h b/extensions/spellcheck/src/mozInlineSpellChecker.h index a6482d90e83..32871da783f 100644 --- a/extensions/spellcheck/src/mozInlineSpellChecker.h +++ b/extensions/spellcheck/src/mozInlineSpellChecker.h @@ -171,7 +171,7 @@ private: // When mPendingSpellCheck is non-null, this is the callback passed when // it was initialized. - nsCOMPtr mPendingInitEditorSpellCheckCallback; + nsRefPtr mPendingInitEditorSpellCheckCallback; // Set when we have spellchecked after the last edit operation. See the // commment at the top of the .cpp file for more info. diff --git a/gfx/layers/LayerScope.cpp b/gfx/layers/LayerScope.cpp index cecbd2eadd3..c1c8a2f17da 100644 --- a/gfx/layers/LayerScope.cpp +++ b/gfx/layers/LayerScope.cpp @@ -314,7 +314,7 @@ public: private: nsTArray > mHandlers; nsCOMPtr mDebugSenderThread; - nsCOMPtr mCurrentSender; + nsRefPtr mCurrentSender; nsCOMPtr mServerSocket; }; diff --git a/ipc/glue/BackgroundImpl.cpp b/ipc/glue/BackgroundImpl.cpp index f883c1c3cae..98709c24216 100644 --- a/ipc/glue/BackgroundImpl.cpp +++ b/ipc/glue/BackgroundImpl.cpp @@ -1521,7 +1521,7 @@ ChildImpl::GetOrCreateForCurrentThread( return true; } - nsCOMPtr runnable = new CreateActorRunnable(); + nsRefPtr runnable = new CreateActorRunnable(); if (NS_FAILED(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))) { CRASH_IN_CHILD_PROCESS("Failed to dispatch to main thread!"); return false; diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index 0982ee81392..d56977e237d 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -1042,7 +1042,7 @@ EndSwapDocShellsForDocument(nsIDocument* aDocument, void*) nsCOMPtr cv; ds->GetContentViewer(getter_AddRefs(cv)); while (cv) { - nsCOMPtr pc; + nsRefPtr pc; cv->GetPresContext(getter_AddRefs(pc)); if (pc && pc->GetPresShell()) { pc->GetPresShell()->SetNeverPainting(ds->IsInvisible()); diff --git a/layout/inspector/nsFontFaceList.cpp b/layout/inspector/nsFontFaceList.cpp index 3537490ec61..f74b8a28602 100644 --- a/layout/inspector/nsFontFaceList.cpp +++ b/layout/inspector/nsFontFaceList.cpp @@ -84,7 +84,7 @@ nsFontFaceList::AddFontsFromTextRun(gfxTextRun* aTextRun, existingFace->AddMatchType(iter.GetGlyphRun()->mMatchType); } else { // A new font entry we haven't seen before - nsCOMPtr ff = + nsRefPtr ff = new nsFontFace(fe, aTextRun->GetFontGroup(), iter.GetGlyphRun()->mMatchType); mFontFaces.Put(fe, ff); diff --git a/layout/mathml/nsMathMLmactionFrame.h b/layout/mathml/nsMathMLmactionFrame.h index fe11e8c1b69..321dc97f797 100644 --- a/layout/mathml/nsMathMLmactionFrame.h +++ b/layout/mathml/nsMathMLmactionFrame.h @@ -62,7 +62,7 @@ private: int32_t mActionType; int32_t mChildCount; int32_t mSelection; - nsCOMPtr mListener; + nsRefPtr mListener; // helper to return the frame for the attribute selection="number" nsIFrame* diff --git a/layout/style/MediaQueryList.h b/layout/style/MediaQueryList.h index d527c7f06fc..3a6477ab683 100644 --- a/layout/style/MediaQueryList.h +++ b/layout/style/MediaQueryList.h @@ -11,7 +11,6 @@ #include "nsISupports.h" #include "nsCycleCollectionParticipant.h" #include "nsAutoPtr.h" -#include "nsCOMPtr.h" #include "nsTArray.h" #include "prclist.h" #include "mozilla/Attributes.h" @@ -44,7 +43,7 @@ public: struct HandleChangeData { nsRefPtr mql; - nsCOMPtr callback; + nsRefPtr callback; }; typedef FallibleTArray< nsRefPtr > CallbackList; diff --git a/media/mtransport/nriceresolver.cpp b/media/mtransport/nriceresolver.cpp index f1870fd75dd..7814bf93e1d 100644 --- a/media/mtransport/nriceresolver.cpp +++ b/media/mtransport/nriceresolver.cpp @@ -149,7 +149,7 @@ int NrIceResolver::resolve(nr_resolver_resource *resource, int _status; MOZ_ASSERT(allocated_resolvers_ > 0); ASSERT_ON_THREAD(sts_thread_); - nsCOMPtr pr; + nsRefPtr pr; if (resource->transport_protocol != IPPROTO_UDP && resource->transport_protocol != IPPROTO_TCP) { diff --git a/media/mtransport/transportlayerprsock.h b/media/mtransport/transportlayerprsock.h index 50b81630454..4cec052bf29 100644 --- a/media/mtransport/transportlayerprsock.h +++ b/media/mtransport/transportlayerprsock.h @@ -109,7 +109,7 @@ class TransportLayerPrsock : public TransportLayer { } PRFileDesc *fd_; - nsCOMPtr handler_; + nsRefPtr handler_; nsCOMPtr stservice_; }; diff --git a/netwerk/base/src/BackgroundFileSaver.cpp b/netwerk/base/src/BackgroundFileSaver.cpp index ea2598eaad6..0f36eca3721 100644 --- a/netwerk/base/src/BackgroundFileSaver.cpp +++ b/netwerk/base/src/BackgroundFileSaver.cpp @@ -82,7 +82,7 @@ public: } private: - nsCOMPtr mSaver; + nsRefPtr mSaver; nsCOMPtr mTarget; }; diff --git a/netwerk/base/src/nsUDPSocket.cpp b/netwerk/base/src/nsUDPSocket.cpp index b8df89644bd..f800f6ce58e 100644 --- a/netwerk/base/src/nsUDPSocket.cpp +++ b/netwerk/base/src/nsUDPSocket.cpp @@ -352,7 +352,7 @@ nsUDPSocket::OnSocketReady(PRFileDesc *fd, int16_t outFlags) return; } - nsCOMPtr os = new nsUDPOutputStream(this, mFD, prClientAddr); + nsRefPtr os = new nsUDPOutputStream(this, mFD, prClientAddr); rv = NS_AsyncCopy(pipeIn, os, mSts, NS_ASYNCCOPY_VIA_READSEGMENTS, 1400); diff --git a/netwerk/cache/nsCacheEntryDescriptor.cpp b/netwerk/cache/nsCacheEntryDescriptor.cpp index f60e849c353..11822d3faf8 100644 --- a/netwerk/cache/nsCacheEntryDescriptor.cpp +++ b/netwerk/cache/nsCacheEntryDescriptor.cpp @@ -64,7 +64,7 @@ public: } private: - nsCOMPtr mDescriptor; + nsRefPtr mDescriptor; nsICacheListener *mListener; nsCOMPtr mThread; }; diff --git a/netwerk/cache2/CacheIndex.cpp b/netwerk/cache2/CacheIndex.cpp index 3cd15787dde..5f17eb8ddac 100644 --- a/netwerk/cache2/CacheIndex.cpp +++ b/netwerk/cache2/CacheIndex.cpp @@ -1698,7 +1698,7 @@ private: char *mBuf; uint32_t mBufSize; int32_t mBufPos; - nsCOMPtr mHash; + nsRefPtr mHash; }; nsresult diff --git a/netwerk/test/TestUDPSocket.cpp b/netwerk/test/TestUDPSocket.cpp index c504301ba2c..624d7d3385b 100644 --- a/netwerk/test/TestUDPSocket.cpp +++ b/netwerk/test/TestUDPSocket.cpp @@ -213,7 +213,7 @@ main(int32_t argc, char *argv[]) NS_ENSURE_SUCCESS(rv, -1); // Create UDPServerListener to process UDP packets - nsCOMPtr serverListener = new UDPServerListener(); + nsRefPtr serverListener = new UDPServerListener(); // Bind server socket to 127.0.0.1 rv = server->Init(0, true); @@ -223,7 +223,7 @@ main(int32_t argc, char *argv[]) server->AsyncListen(serverListener); // Bind clinet on arbitrary port - nsCOMPtr clientListener = new UDPClientListener(); + nsRefPtr clientListener = new UDPClientListener(); client->Init(0, true); client->AsyncListen(clientListener); diff --git a/parser/xml/src/nsSAXXMLReader.cpp b/parser/xml/src/nsSAXXMLReader.cpp index d4374716eaf..90c5dece36d 100644 --- a/parser/xml/src/nsSAXXMLReader.cpp +++ b/parser/xml/src/nsSAXXMLReader.cpp @@ -87,7 +87,7 @@ nsSAXXMLReader::HandleStartElement(const char16_t *aName, if (!mContentHandler) return NS_OK; - nsCOMPtr atts = new nsSAXAttributes(); + nsRefPtr atts = new nsSAXAttributes(); if (!atts) return NS_ERROR_OUT_OF_MEMORY; nsAutoString uri, localName, qName; diff --git a/security/manager/ssl/src/nsNSSCallbacks.cpp b/security/manager/ssl/src/nsNSSCallbacks.cpp index 04e20d4a998..f54d97e9a1e 100644 --- a/security/manager/ssl/src/nsNSSCallbacks.cpp +++ b/security/manager/ssl/src/nsNSSCallbacks.cpp @@ -59,7 +59,7 @@ public: nsNSSHttpRequestSession *mRequestSession; - nsCOMPtr mListener; + nsRefPtr mListener; bool mResponsibleForDoneSignal; TimeStamp mStartTime; }; @@ -167,7 +167,7 @@ nsHTTPDownloadEvent::Run() } struct nsCancelHTTPDownloadEvent : nsRunnable { - nsCOMPtr mListener; + nsRefPtr mListener; NS_IMETHOD Run() { mListener->FreeLoadGroup(true); diff --git a/security/manager/ssl/src/nsNSSCallbacks.h b/security/manager/ssl/src/nsNSSCallbacks.h index 0df1e87255e..391434e148a 100644 --- a/security/manager/ssl/src/nsNSSCallbacks.h +++ b/security/manager/ssl/src/nsNSSCallbacks.h @@ -7,6 +7,7 @@ #ifndef _NSNSSCALLBACKS_H_ #define _NSNSSCALLBACKS_H_ +#include "nsAutoPtr.h" #include "nsCOMPtr.h" #include "pk11func.h" #include "nspr.h" @@ -120,7 +121,7 @@ public: PRIntervalTime mTimeoutInterval; - nsCOMPtr mListener; + nsRefPtr mListener; protected: nsNSSHttpRequestSession(); diff --git a/storage/src/VacuumManager.cpp b/storage/src/VacuumManager.cpp index e8daa802f6a..4b7314bbe1b 100644 --- a/storage/src/VacuumManager.cpp +++ b/storage/src/VacuumManager.cpp @@ -206,7 +206,7 @@ Vacuumer::execute() rv = mDBConn->CreateAsyncStatement(pageSizeQuery, getter_AddRefs(pageSizeStmt)); NS_ENSURE_SUCCESS(rv, false); - nsCOMPtr callback = new BaseCallback(); + nsRefPtr callback = new BaseCallback(); nsCOMPtr ps; rv = pageSizeStmt->ExecuteAsync(callback, getter_AddRefs(ps)); NS_ENSURE_SUCCESS(rv, false); @@ -375,7 +375,7 @@ VacuumManager::Observe(nsISupports *aSubject, } int32_t index; for (index = startIndex; index < entries.Count(); ++index) { - nsCOMPtr vacuum = new Vacuumer(entries[index]); + nsRefPtr vacuum = new Vacuumer(entries[index]); // Only vacuum one database per day. if (vacuum->execute()) { break; diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.h b/toolkit/components/url-classifier/nsUrlClassifierDBService.h index a951b2ee4d9..668385b7673 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.h +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.h @@ -81,7 +81,7 @@ private: nsresult CheckClean(const nsACString &lookupKey, bool *clean); - nsCOMPtr mWorker; + nsRefPtr mWorker; nsCOMPtr mWorkerProxy; nsInterfaceHashtable mCompleters; diff --git a/toolkit/profile/nsToolkitProfileService.cpp b/toolkit/profile/nsToolkitProfileService.cpp index f8450ce2411..dffcf8e5476 100644 --- a/toolkit/profile/nsToolkitProfileService.cpp +++ b/toolkit/profile/nsToolkitProfileService.cpp @@ -50,7 +50,7 @@ public: NS_DECL_NSITOOLKITPROFILE friend class nsToolkitProfileService; - nsCOMPtr mNext; + nsRefPtr mNext; nsToolkitProfile *mPrev; ~nsToolkitProfile() { } @@ -85,7 +85,7 @@ public: ~nsToolkitProfileLock(); private: - nsCOMPtr mProfile; + nsRefPtr mProfile; nsCOMPtr mDirectory; nsCOMPtr mLocalDirectory; @@ -156,7 +156,7 @@ private: { mCurrent = first; } private: ~ProfileEnumerator() { } - nsCOMPtr mCurrent; + nsRefPtr mCurrent; }; }; @@ -274,7 +274,7 @@ nsToolkitProfile::Lock(nsIProfileUnlocker* *aUnlocker, nsIProfileLock* *aResult) return NS_OK; } - nsCOMPtr lock = new nsToolkitProfileLock(); + nsRefPtr lock = new nsToolkitProfileLock(); if (!lock) return NS_ERROR_OUT_OF_MEMORY; nsresult rv = lock->Init(this, aUnlocker); @@ -595,7 +595,7 @@ nsresult NS_LockProfilePath(nsIFile* aPath, nsIFile* aTempPath, nsIProfileUnlocker* *aUnlocker, nsIProfileLock* *aResult) { - nsCOMPtr lock = new nsToolkitProfileLock(); + nsRefPtr lock = new nsToolkitProfileLock(); if (!lock) return NS_ERROR_OUT_OF_MEMORY; nsresult rv = lock->Init(aPath, aTempPath, aUnlocker); diff --git a/widget/android/nsAppShell.cpp b/widget/android/nsAppShell.cpp index 58fa05937f6..8e121e10aa6 100644 --- a/widget/android/nsAppShell.cpp +++ b/widget/android/nsAppShell.cpp @@ -362,7 +362,7 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait) int32_t tabId = curEvent->MetaState(); const nsTArray& points = curEvent->Points(); RefCountedJavaObject* buffer = curEvent->ByteBuffer(); - nsCOMPtr sr = new ThumbnailRunnable(mBrowserApp, tabId, points, buffer); + nsRefPtr sr = new ThumbnailRunnable(mBrowserApp, tabId, points, buffer); MessageLoop::current()->PostIdleTask(FROM_HERE, NewRunnableMethod(sr.get(), &ThumbnailRunnable::Run)); break; } diff --git a/widget/xpwidgets/nsBaseWidget.h b/widget/xpwidgets/nsBaseWidget.h index 89a95da610a..9113d738769 100644 --- a/widget/xpwidgets/nsBaseWidget.h +++ b/widget/xpwidgets/nsBaseWidget.h @@ -406,7 +406,7 @@ protected: nsRefPtr mBasicLayerManager; nsRefPtr mCompositorChild; nsRefPtr mCompositorParent; - nsCOMPtr mShutdownObserver; + nsRefPtr mShutdownObserver; nscolor mBackground; nscolor mForeground; nsCursor mCursor; diff --git a/xpcom/ds/nsINIParserImpl.cpp b/xpcom/ds/nsINIParserImpl.cpp index 86d6241356c..b7dd443414d 100644 --- a/xpcom/ds/nsINIParserImpl.cpp +++ b/xpcom/ds/nsINIParserImpl.cpp @@ -34,7 +34,7 @@ nsINIParserFactory::CreateINIParser(nsIFile* aINIFile, { *aResult = nullptr; - nsCOMPtr p(new nsINIParserImpl()); + nsRefPtr p(new nsINIParserImpl()); if (!p) return NS_ERROR_OUT_OF_MEMORY;