Skip to content

Commit

Permalink
Bug 1293117 (part 4) - Change many NS_IMETHODIMP occurrences to NS_IM…
Browse files Browse the repository at this point in the history
…ETHOD. r=froydnj.

This patch makes the following changes on many in-class methods.

- NS_IMETHODIMP F() override;      --> NS_IMETHOD F() override;
- NS_IMETHODIMP F() override {...} --> NS_IMETHOD F() override {...}
- NS_IMETHODIMP F() final;         --> NS_IMETHOD F() final;
- NS_IMETHODIMP F() final {...}    --> NS_IMETHOD F() final {...}

Using NS_IMETHOD is the preferred way of marking in-class virtual methods.
Although these transformations add an explicit |virtual|, they are safe --
there's an implicit |virtual| anyway because |override| and |final| only work
with virtual methods.
  • Loading branch information
nnethercote committed Aug 8, 2016
1 parent e27511f commit 990f482
Show file tree
Hide file tree
Showing 73 changed files with 238 additions and 238 deletions.
2 changes: 1 addition & 1 deletion accessible/base/nsAccessibilityService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ class PluginTimerCallBack final : public nsITimerCallback

NS_DECL_ISUPPORTS

NS_IMETHODIMP Notify(nsITimer* aTimer) final
NS_IMETHOD Notify(nsITimer* aTimer) final
{
if (!mContent->IsInUncomposedDoc())
return NS_OK;
Expand Down
4 changes: 2 additions & 2 deletions caps/nsPrincipal.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class nsExpandedPrincipal : public nsIExpandedPrincipal, public mozilla::BasePri

NS_DECL_NSIEXPANDEDPRINCIPAL
NS_DECL_NSISERIALIZABLE
NS_IMETHODIMP_(MozExternalRefCountType) AddRef() override { return nsJSPrincipals::AddRef(); };
NS_IMETHODIMP_(MozExternalRefCountType) Release() override { return nsJSPrincipals::Release(); };
NS_IMETHOD_(MozExternalRefCountType) AddRef() override { return nsJSPrincipals::AddRef(); };
NS_IMETHOD_(MozExternalRefCountType) Release() override { return nsJSPrincipals::Release(); };
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
NS_IMETHOD GetURI(nsIURI** aURI) override;
Expand Down
2 changes: 1 addition & 1 deletion docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9503,7 +9503,7 @@ class nsCopyFaviconCallback final : public nsIFaviconDataCallback
{
}

NS_IMETHODIMP
NS_IMETHOD
OnComplete(nsIURI* aFaviconURI, uint32_t aDataLen,
const uint8_t* aData, const nsACString& aMimeType) override
{
Expand Down
2 changes: 1 addition & 1 deletion dom/base/ImageEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ class EncoderThreadPoolTerminator final : public nsIObserver
public:
NS_DECL_ISUPPORTS

NS_IMETHODIMP Observe(nsISupports *, const char *topic, const char16_t *) override
NS_IMETHOD Observe(nsISupports *, const char *topic, const char16_t *) override
{
NS_ASSERTION(!strcmp(topic, "xpcom-shutdown-threads"),
"Unexpected topic");
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsFrameLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,7 @@ class nsFrameLoaderDestroyRunnable : public Runnable
explicit nsFrameLoaderDestroyRunnable(nsFrameLoader* aFrameLoader)
: mFrameLoader(aFrameLoader), mPhase(eDestroyDocShell) {}

NS_IMETHODIMP Run() override;
NS_IMETHOD Run() override;
};

void
Expand Down
6 changes: 3 additions & 3 deletions dom/base/nsFrameMessageManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,9 @@ class nsScriptCacheCleaner final : public nsIObserver
}
}

NS_IMETHODIMP Observe(nsISupports *aSubject,
const char *aTopic,
const char16_t *aData) override
NS_IMETHOD Observe(nsISupports *aSubject,
const char *aTopic,
const char16_t *aData) override
{
if (strcmp("message-manager-flush-caches", aTopic) == 0) {
nsMessageManagerScriptExecutor::PurgeCache();
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsGlobalWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ class nsGlobalWindowObserver final : public nsIObserver,
return mWindow->Observe(aSubject, aTopic, aData);
}
void Forget() { mWindow = nullptr; }
NS_IMETHODIMP GetInterface(const nsIID& aIID, void** aResult) override
NS_IMETHOD GetInterface(const nsIID& aIID, void** aResult) override
{
if (mWindow && aIID.Equals(NS_GET_IID(nsIDOMWindow)) && mWindow) {
return mWindow->QueryInterface(aIID, aResult);
Expand Down
6 changes: 3 additions & 3 deletions dom/broadcastchannel/BroadcastChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class BCPostMessageRunnable final : public nsIRunnable,
MOZ_ASSERT(mActor);
}

NS_IMETHODIMP Run() override
NS_IMETHOD Run() override
{
MOZ_ASSERT(mActor);
if (mActor->IsActorDestroyed()) {
Expand Down Expand Up @@ -211,7 +211,7 @@ class CloseRunnable final : public nsIRunnable,
MOZ_ASSERT(mBC);
}

NS_IMETHODIMP Run() override
NS_IMETHOD Run() override
{
mBC->Shutdown();
return NS_OK;
Expand Down Expand Up @@ -243,7 +243,7 @@ class TeardownRunnable final : public nsIRunnable,
MOZ_ASSERT(mActor);
}

NS_IMETHODIMP Run() override
NS_IMETHOD Run() override
{
MOZ_ASSERT(mActor);
if (!mActor->IsActorDestroyed()) {
Expand Down
2 changes: 1 addition & 1 deletion dom/browser-element/BrowserElementAudioChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class BaseRunnable : public Runnable
, mAudioChannel(aAudioChannel)
{}

NS_IMETHODIMP Run() override
NS_IMETHOD Run() override
{
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
if (!service) {
Expand Down
2 changes: 1 addition & 1 deletion dom/camera/DOMCameraCapabilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CameraClosedMessage : public Runnable
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
}

NS_IMETHODIMP
NS_IMETHOD
Run() override
{
MOZ_ASSERT(NS_IsMainThread());
Expand Down
8 changes: 4 additions & 4 deletions dom/camera/GonkCameraControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ nsGonkCameraControl::SetThumbnailSize(const Size& aSize)
}
~SetThumbnailSize() { MOZ_COUNT_DTOR(SetThumbnailSize); }

NS_IMETHODIMP
NS_IMETHOD
Run() override
{
nsresult rv = mCameraControl->SetThumbnailSizeImpl(mSize);
Expand Down Expand Up @@ -1096,7 +1096,7 @@ nsGonkCameraControl::SetPictureSize(const Size& aSize)
}
~SetPictureSize() { MOZ_COUNT_DTOR(SetPictureSize); }

NS_IMETHODIMP
NS_IMETHOD
Run() override
{
nsresult rv = mCameraControl->SetPictureSizeImpl(mSize);
Expand Down Expand Up @@ -1480,7 +1480,7 @@ nsGonkCameraControl::OnAutoFocusComplete(bool aSuccess, bool aExpired)
, mExpired(aExpired)
{ }

NS_IMETHODIMP
NS_IMETHOD
Run() override
{
mCameraControl->OnAutoFocusComplete(mSuccess, mExpired);
Expand Down Expand Up @@ -2264,7 +2264,7 @@ nsGonkCameraControl::CreatePoster(Image* aImage, uint32_t aWidth, uint32_t aHeig
mTarget->OnPoster(mDst, mDstLength);
}

NS_IMETHODIMP Run() override
NS_IMETHOD Run() override
{
#ifdef MOZ_WIDGET_GONK
// NV21 (yuv420sp) is 12 bits / pixel
Expand Down
6 changes: 3 additions & 3 deletions dom/canvas/CanvasImageCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ class ImageCacheObserver final : public nsIObserver
mImageCache = nullptr;
}

NS_IMETHODIMP Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aSomeData) override
NS_IMETHOD Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aSomeData) override
{
if (!mImageCache || strcmp(aTopic, "memory-pressure")) {
return NS_OK;
Expand Down
6 changes: 3 additions & 3 deletions dom/crypto/WebCryptoThreadPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class WebCryptoThreadPool final : nsIObserver {
void
Shutdown();

NS_IMETHODIMP Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aData) override;
NS_IMETHOD Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aData) override;

mozilla::Mutex mMutex;
nsCOMPtr<nsIThreadPool> mPool;
Expand Down
2 changes: 1 addition & 1 deletion dom/devicestorage/nsDeviceStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2486,7 +2486,7 @@ class DeviceStoragePermissionCheck final
return Resolve(true);
}

NS_IMETHODIMP GetTypes(nsIArray** aTypes) override
NS_IMETHOD GetTypes(nsIArray** aTypes) override
{
nsString storageType;
mRequest->GetStorageType(storageType);
Expand Down
4 changes: 2 additions & 2 deletions dom/html/nsGenericHTMLElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class nsGenericHTMLElement : public nsGenericHTMLElementBase,
{
GetHTMLAttr(nsGkAtoms::title, aTitle);
}
NS_IMETHODIMP SetTitle(const nsAString& aTitle) override
NS_IMETHOD SetTitle(const nsAString& aTitle) override
{
SetHTMLAttr(nsGkAtoms::title, aTitle);
return NS_OK;
Expand All @@ -82,7 +82,7 @@ class nsGenericHTMLElement : public nsGenericHTMLElementBase,
{
GetHTMLAttr(nsGkAtoms::lang, aLang);
}
NS_IMETHODIMP SetLang(const nsAString& aLang) override
NS_IMETHOD SetLang(const nsAString& aLang) override
{
SetHTMLAttr(nsGkAtoms::lang, aLang);
return NS_OK;
Expand Down
6 changes: 3 additions & 3 deletions dom/ipc/TabParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1419,9 +1419,9 @@ class SynthesizedEventObserver : public nsIObserver
MOZ_ASSERT(mTabParent);
}

NS_IMETHODIMP Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aData) override
NS_IMETHOD Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aData) override
{
if (!mTabParent) {
// We already sent the notification
Expand Down
2 changes: 1 addition & 1 deletion dom/media/MediaRecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ class MediaRecorder::Session: public nsIObserver,
mMediaStreamTracks.Clear();
}

NS_IMETHODIMP Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData) override
NS_IMETHOD Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData) override
{
MOZ_ASSERT(NS_IsMainThread());
LOG(LogLevel::Debug, ("Session.Observe XPCOM_SHUTDOWN %p", this));
Expand Down
2 changes: 1 addition & 1 deletion dom/media/webaudio/AudioBufferSourceNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ AudioBufferSourceNode::NotifyMainThreadStreamFinished()
public:
explicit EndedEventDispatcher(AudioBufferSourceNode* aNode)
: mNode(aNode) {}
NS_IMETHODIMP Run() override
NS_IMETHOD Run() override
{
// If it's not safe to run scripts right now, schedule this to run later
if (!nsContentUtils::IsSafeToRunScript()) {
Expand Down
2 changes: 1 addition & 1 deletion dom/media/webaudio/AudioNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ AudioNode::DisconnectFromOutputIfConnected(AudioNode& aDestination, uint32_t aOu
explicit RunnableRelease(already_AddRefed<AudioNode> aNode)
: mNode(aNode) {}

NS_IMETHODIMP Run() override
NS_IMETHOD Run() override
{
mNode = nullptr;
return NS_OK;
Expand Down
2 changes: 1 addition & 1 deletion dom/notification/DesktopNotification.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class AlertServiceObserver: public nsIObserver

void Disconnect() { mNotification = nullptr; }

NS_IMETHODIMP
NS_IMETHOD
Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aData) override
Expand Down
2 changes: 1 addition & 1 deletion dom/plugins/base/nsPluginStreamListenerPeer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@ class ChannelRedirectProxyCallback : public nsIAsyncVerifyRedirectCallback

NS_DECL_ISUPPORTS

NS_IMETHODIMP OnRedirectVerifyCallback(nsresult aResult) override
NS_IMETHOD OnRedirectVerifyCallback(nsresult aResult) override
{
if (NS_SUCCEEDED(aResult)) {
nsCOMPtr<nsIStreamListener> listener = do_QueryReferent(mWeakListener);
Expand Down
2 changes: 1 addition & 1 deletion dom/storage/DOMStorageCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class DOMStorageCacheHolder : public nsITimerCallback

NS_DECL_ISUPPORTS

NS_IMETHODIMP
NS_IMETHOD
Notify(nsITimer* aTimer) override
{
mCache = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion dom/svg/SVGFEImageElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class SVGFEImageElement final : public SVGFEImageElementBase,
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
virtual EventStates IntrinsicState() const override;

NS_IMETHODIMP Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData) override;
NS_IMETHOD Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData) override;

void MaybeLoadSVGImage();

Expand Down
2 changes: 1 addition & 1 deletion dom/system/gonk/mozstumbler/WriteStumbleOnThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DeleteRunnable : public Runnable
public:
DeleteRunnable() {}

NS_IMETHODIMP
NS_IMETHOD
Run() override
{
nsCOMPtr<nsIFile> tmpFile;
Expand Down
2 changes: 1 addition & 1 deletion dom/system/gonk/mozstumbler/WriteStumbleOnThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class WriteStumbleOnThread : public mozilla::Runnable
: mDesc(aDesc)
{}

NS_IMETHODIMP Run() override;
NS_IMETHOD Run() override;

static void UploadEnded(bool deleteUploadFile);

Expand Down
2 changes: 1 addition & 1 deletion dom/workers/ServiceWorkerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class TeardownRunnable final : public Runnable
MOZ_ASSERT(mActor);
}

NS_IMETHODIMP Run() override
NS_IMETHOD Run() override
{
MOZ_ASSERT(mActor);
mActor->SendShutdown();
Expand Down
2 changes: 1 addition & 1 deletion dom/workers/ServiceWorkerManagerService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class NotifySoftUpdateIfPrincipalOkRunnable final : public Runnable
MOZ_ASSERT(mBackgroundThread);
}

NS_IMETHODIMP
NS_IMETHOD
Run() override
{
if (NS_IsMainThread()) {
Expand Down
8 changes: 4 additions & 4 deletions dom/workers/ServiceWorkerRegistration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,15 +529,15 @@ class UnregisterCallback final : public nsIServiceWorkerUnregisterCallback
MOZ_ASSERT(mPromise);
}

NS_IMETHODIMP
NS_IMETHOD
UnregisterSucceeded(bool aState) override
{
AssertIsOnMainThread();
mPromise->MaybeResolve(aState);
return NS_OK;
}

NS_IMETHODIMP
NS_IMETHOD
UnregisterFailed() override
{
AssertIsOnMainThread();
Expand Down Expand Up @@ -595,15 +595,15 @@ class WorkerUnregisterCallback final : public nsIServiceWorkerUnregisterCallback
MOZ_ASSERT(aProxy);
}

NS_IMETHODIMP
NS_IMETHOD
UnregisterSucceeded(bool aState) override
{
AssertIsOnMainThread();
Finish(Some(aState));
return NS_OK;
}

NS_IMETHODIMP
NS_IMETHOD
UnregisterFailed() override
{
AssertIsOnMainThread();
Expand Down
2 changes: 1 addition & 1 deletion dom/workers/ServiceWorkerUnregisterJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ServiceWorkerUnregisterJob::PushUnsubscribeCallback final :
AssertIsOnMainThread();
}

NS_IMETHODIMP
NS_IMETHOD
OnUnsubscribe(nsresult aStatus, bool) override
{
// Warn if unsubscribing fails, but don't prevent the worker from
Expand Down
2 changes: 1 addition & 1 deletion dom/workers/WorkerScope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ class WorkerScopeSkipWaitingRunnable final : public Runnable
MOZ_ASSERT(aPromiseProxy);
}

NS_IMETHODIMP
NS_IMETHOD
Run() override
{
AssertIsOnMainThread();
Expand Down
2 changes: 1 addition & 1 deletion dom/xslt/xpath/txXPathObjectAdaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class txXPathObjectAdaptor : public txIXPathObject

NS_DECL_ISUPPORTS

NS_IMETHODIMP_(txAExprResult*) GetResult() override
NS_IMETHOD_(txAExprResult*) GetResult() override
{
return mValue;
}
Expand Down
2 changes: 1 addition & 1 deletion extensions/cookie/nsPermissionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class ClearOriginDataObserver final : public nsIObserver {
NS_DECL_ISUPPORTS

// nsIObserver implementation.
NS_IMETHODIMP
NS_IMETHOD
Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData) override
{
MOZ_ASSERT(!nsCRT::strcmp(aTopic, "clear-origin-data"));
Expand Down
Loading

0 comments on commit 990f482

Please sign in to comment.