Bug 1318004 - Use C++11's override and remove virtual where applicable.
MozReview-Commit-ID: H9tAe0YN1tx
--- a/toolkit/components/osfile/NativeOSFileInternals.cpp
+++ b/toolkit/components/osfile/NativeOSFileInternals.cpp
@@ -736,17 +736,17 @@ public:
const uint32_t aBytes,
nsMainThreadPtrHandle<nsINativeOSFileSuccessCallback>& aOnSuccess,
nsMainThreadPtrHandle<nsINativeOSFileErrorCallback>& aOnError)
: AbstractReadEvent(aPath, aBytes,
aOnSuccess, aOnError)
, mResult(new TypedArrayResult(TimeStamp::Now()))
{ }
- ~DoReadToTypedArrayEvent() {
+ ~DoReadToTypedArrayEvent() override {
// If AbstractReadEvent::Run() has bailed out, we may need to cleanup
// mResult, which is main-thread only data
if (!mResult) {
return;
}
NS_ReleaseOnMainThread(mResult.forget());
}
@@ -773,17 +773,17 @@ public:
const uint32_t aBytes,
nsMainThreadPtrHandle<nsINativeOSFileSuccessCallback>& aOnSuccess,
nsMainThreadPtrHandle<nsINativeOSFileErrorCallback>& aOnError)
: AbstractReadEvent(aPath, aBytes, aOnSuccess, aOnError)
, mEncoding(aEncoding)
, mResult(new StringResult(TimeStamp::Now()))
{ }
- ~DoReadToStringEvent() {
+ ~DoReadToStringEvent() override {
// If AbstraactReadEvent::Run() has bailed out, we may need to cleanup
// mResult, which is main-thread only data
if (!mResult) {
return;
}
NS_ReleaseOnMainThread(mResult.forget());
}
--- a/toolkit/components/telemetry/Telemetry.cpp
+++ b/toolkit/components/telemetry/Telemetry.cpp
@@ -423,17 +423,17 @@ class TelemetryIOInterposeObserver : pub
public:
explicit TelemetryIOInterposeObserver(nsIFile* aXreDir);
/**
* An implementation of Observe that records statistics of all
* file IO operations.
*/
- void Observe(Observation& aOb);
+ void Observe(Observation& aOb) override;
/**
* Reflect recorded file IO statistics into Javascript
*/
bool ReflectIntoJS(JSContext *cx, JS::Handle<JSObject*> rootObj);
/**
* Adds a path for inclusion in main thread I/O report.
--- a/toolkit/components/telemetry/TelemetryScalar.cpp
+++ b/toolkit/components/telemetry/TelemetryScalar.cpp
@@ -150,17 +150,17 @@ ScalarInfo::expiration() const
/**
* The base scalar object, that servers as a common ancestor for storage
* purposes.
*/
class ScalarBase
{
public:
- virtual ~ScalarBase() = default;;
+ virtual ~ScalarBase() = default;
// Set, Add and SetMaximum functions as described in the Telemetry IDL.
virtual ScalarResult SetValue(nsIVariant* aValue) = 0;
virtual ScalarResult AddValue(nsIVariant* aValue) { return ScalarResult::OperationNotSupported; }
virtual ScalarResult SetMaximum(nsIVariant* aValue) { return ScalarResult::OperationNotSupported; }
// Convenience methods used by the C++ API.
virtual void SetValue(uint32_t aValue) { mozilla::Unused << HandleUnsupported(); }
@@ -190,17 +190,17 @@ ScalarBase::HandleUnsupported() const
* The implementation for the unsigned int scalar type.
*/
class ScalarUnsigned : public ScalarBase
{
public:
using ScalarBase::SetValue;
ScalarUnsigned() : mStorage(0) {};
- ~ScalarUnsigned() = default;;
+ ~ScalarUnsigned() override = default;
ScalarResult SetValue(nsIVariant* aValue) final;
void SetValue(uint32_t aValue) final;
ScalarResult AddValue(nsIVariant* aValue) final;
void AddValue(uint32_t aValue) final;
ScalarResult SetMaximum(nsIVariant* aValue) final;
void SetMaximum(uint32_t aValue) final;
nsresult GetValue(nsCOMPtr<nsIVariant>& aResult) const final;
@@ -330,17 +330,17 @@ ScalarUnsigned::CheckInput(nsIVariant* a
* The implementation for the string scalar type.
*/
class ScalarString : public ScalarBase
{
public:
using ScalarBase::SetValue;
ScalarString() : mStorage(EmptyString()) {};
- ~ScalarString() = default;;
+ ~ScalarString() override = default;
ScalarResult SetValue(nsIVariant* aValue) final;
ScalarResult SetValue(const nsAString& aValue) final;
nsresult GetValue(nsCOMPtr<nsIVariant>& aResult) const final;
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const final;
private:
nsString mStorage;
@@ -411,17 +411,17 @@ ScalarString::SizeOfIncludingThis(mozill
* The implementation for the boolean scalar type.
*/
class ScalarBoolean : public ScalarBase
{
public:
using ScalarBase::SetValue;
ScalarBoolean() : mStorage(false) {};
- ~ScalarBoolean() = default;;
+ ~ScalarBoolean() override = default;
ScalarResult SetValue(nsIVariant* aValue) final;
void SetValue(bool aValue) final;
nsresult GetValue(nsCOMPtr<nsIVariant>& aResult) const final;
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const final;
private:
bool mStorage;
@@ -510,17 +510,17 @@ internal_ScalarAllocate(uint32_t aScalar
* The implementation for the keyed scalar type.
*/
class KeyedScalar
{
public:
typedef mozilla::Pair<nsCString, nsCOMPtr<nsIVariant>> KeyValuePair;
explicit KeyedScalar(uint32_t aScalarKind) : mScalarKind(aScalarKind) {};
- ~KeyedScalar() = default;;
+ ~KeyedScalar() = default;
// Set, Add and SetMaximum functions as described in the Telemetry IDL.
// These methods implicitly instantiate a Scalar[*] for each key.
ScalarResult SetValue(const nsAString& aKey, nsIVariant* aValue);
ScalarResult AddValue(const nsAString& aKey, nsIVariant* aValue);
ScalarResult SetMaximum(const nsAString& aKey, nsIVariant* aValue);
// Convenience methods used by the C++ API.
--- a/toolkit/components/terminator/nsTerminator.cpp
+++ b/toolkit/components/terminator/nsTerminator.cpp
@@ -170,18 +170,17 @@ RunWatchdog(void* arg)
//
// Utility class, used by UniquePtr<> to close nspr files.
class PR_CloseDelete
{
public:
constexpr PR_CloseDelete() = default;
- PR_CloseDelete(const PR_CloseDelete& aOther)
- = default;
+ PR_CloseDelete(const PR_CloseDelete& aOther) = default;
void operator()(PRFileDesc* aPtr) const
{
PR_Close(aPtr);
}
};
//
--- a/toolkit/identity/IdentityCryptoService.cpp
+++ b/toolkit/identity/IdentityCryptoService.cpp
@@ -51,17 +51,17 @@ class KeyPair : public nsIIdentityKeyPai
{
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIIDENTITYKEYPAIR
KeyPair(SECKEYPrivateKey* aPrivateKey, SECKEYPublicKey* aPublicKey);
private:
- ~KeyPair()
+ ~KeyPair() override
{
nsNSSShutDownPreventionLock locker;
if (isAlreadyShutDown()) {
return;
}
destructorSafeDestroyNSSReference();
shutdown(ShutdownCalledFrom::Object);
}
@@ -91,27 +91,27 @@ NS_IMPL_ISUPPORTS(KeyPair, nsIIdentityKe
class KeyGenRunnable : public Runnable, public nsNSSShutDownObject
{
public:
NS_DECL_NSIRUNNABLE
KeyGenRunnable(KeyType keyType, nsIIdentityKeyGenCallback * aCallback);
private:
- ~KeyGenRunnable()
+ ~KeyGenRunnable() override
{
nsNSSShutDownPreventionLock locker;
if (isAlreadyShutDown()) {
return;
}
destructorSafeDestroyNSSReference();
shutdown(ShutdownCalledFrom::Object);
}
- virtual void virtualDestroyNSSReference() override
+ void virtualDestroyNSSReference() override
{
destructorSafeDestroyNSSReference();
}
void destructorSafeDestroyNSSReference()
{
}
@@ -128,17 +128,17 @@ class SignRunnable : public Runnable, pu
{
public:
NS_DECL_NSIRUNNABLE
SignRunnable(const nsACString & textToSign, SECKEYPrivateKey * privateKey,
nsIIdentitySignCallback * aCallback);
private:
- ~SignRunnable()
+ ~SignRunnable() override
{
nsNSSShutDownPreventionLock locker;
if (isAlreadyShutDown()) {
return;
}
destructorSafeDestroyNSSReference();
shutdown(ShutdownCalledFrom::Object);
}
--- a/toolkit/mozapps/update/updater/updater.cpp
+++ b/toolkit/mozapps/update/updater/updater.cpp
@@ -1110,20 +1110,20 @@ private:
friend class ActionList;
};
class RemoveFile : public Action
{
public:
RemoveFile() : mSkip(0) { }
- int Parse(NS_tchar *line);
- int Prepare();
- int Execute();
- void Finish(int status);
+ int Parse(NS_tchar *line) override;
+ int Prepare() override;
+ int Execute() override;
+ void Finish(int status) override;
private:
mozilla::UniquePtr<NS_tchar[]> mFile;
mozilla::UniquePtr<NS_tchar[]> mRelPath;
int mSkip;
};
int
@@ -1241,20 +1241,20 @@ RemoveFile::Finish(int status)
}
}
class RemoveDir : public Action
{
public:
RemoveDir() : mSkip(0) { }
- virtual int Parse(NS_tchar *line);
- virtual int Prepare(); // check that the source dir exists
- virtual int Execute();
- virtual void Finish(int status);
+ int Parse(NS_tchar *line) override;
+ int Prepare() override; // check that the source dir exists
+ int Execute() override;
+ void Finish(int status) override;
private:
mozilla::UniquePtr<NS_tchar[]> mDir;
mozilla::UniquePtr<NS_tchar[]> mRelPath;
int mSkip;
};
int
@@ -1358,20 +1358,20 @@ RemoveDir::Finish(int status)
}
}
class AddFile : public Action
{
public:
AddFile() : mAdded(false) { }
- virtual int Parse(NS_tchar *line);
- virtual int Prepare();
- virtual int Execute();
- virtual void Finish(int status);
+ int Parse(NS_tchar *line) override;
+ int Prepare() override;
+ int Execute() override;
+ void Finish(int status) override;
private:
mozilla::UniquePtr<NS_tchar[]> mFile;
mozilla::UniquePtr<NS_tchar[]> mRelPath;
bool mAdded;
};
int
@@ -1461,22 +1461,22 @@ AddFile::Finish(int status)
}
}
class PatchFile : public Action
{
public:
PatchFile() : mPatchFile(nullptr), mPatchIndex(-1), buf(nullptr) { }
- virtual ~PatchFile();
-
- virtual int Parse(NS_tchar *line);
- virtual int Prepare(); // should check for patch file and for checksum here
- virtual int Execute();
- virtual void Finish(int status);
+ ~PatchFile() override;
+
+ int Parse(NS_tchar *line) override;
+ int Prepare() override; // should check for patch file and for checksum here
+ int Execute() override;
+ void Finish(int status) override;
private:
int LoadSourceFile(FILE* ofile);
static int sPatchIndex;
const NS_tchar *mPatchFile;
mozilla::UniquePtr<NS_tchar[]> mFile;
@@ -1782,20 +1782,20 @@ PatchFile::Finish(int status)
if (!sStagedUpdate) {
backup_finish(mFile.get(), mFileRelPath.get(), status);
}
}
class AddIfFile : public AddFile
{
public:
- virtual int Parse(NS_tchar *line);
- virtual int Prepare();
- virtual int Execute();
- virtual void Finish(int status);
+ int Parse(NS_tchar *line) override;
+ int Prepare() override;
+ int Execute() override;
+ void Finish(int status) override;
protected:
mozilla::UniquePtr<NS_tchar[]> mTestFile;
};
int
AddIfFile::Parse(NS_tchar *line)
{
@@ -1843,20 +1843,20 @@ AddIfFile::Finish(int status)
return;
AddFile::Finish(status);
}
class AddIfNotFile : public AddFile
{
public:
- virtual int Parse(NS_tchar *line);
- virtual int Prepare();
- virtual int Execute();
- virtual void Finish(int status);
+ int Parse(NS_tchar *line) override;
+ int Prepare() override;
+ int Execute() override;
+ void Finish(int status) override;
protected:
mozilla::UniquePtr<NS_tchar[]> mTestFile;
};
int
AddIfNotFile::Parse(NS_tchar *line)
{
@@ -1904,20 +1904,20 @@ AddIfNotFile::Finish(int status)
return;
AddFile::Finish(status);
}
class PatchIfFile : public PatchFile
{
public:
- virtual int Parse(NS_tchar *line);
- virtual int Prepare(); // should check for patch file and for checksum here
- virtual int Execute();
- virtual void Finish(int status);
+ int Parse(NS_tchar *line) override;
+ int Prepare() override; // should check for patch file and for checksum here
+ int Execute() override;
+ void Finish(int status) override;
private:
mozilla::UniquePtr<NS_tchar[]> mTestFile;
};
int
PatchIfFile::Parse(NS_tchar *line)
{