Bug 2053404 - Cleanup default state for static-analysis on Windows / xpcom part r=xpcom-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D311042
This commit is contained in:
committed by
sguelton@mozilla.com
parent
91315ffa71
commit
abe92e3c5b
@@ -35,7 +35,7 @@ static int64_t LowMemoryEventsPhysicalDistinguishedAmount() {
|
||||
}
|
||||
|
||||
class LowEventsReporter final : public nsIMemoryReporter {
|
||||
~LowEventsReporter() {}
|
||||
~LowEventsReporter() = default;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
@@ -495,8 +495,6 @@ static void MozCrashWarningReporter(JSContext*, JSErrorReport*) {
|
||||
MOZ_CRASH("Why is someone touching JSAPI without an AutoJSAPI?");
|
||||
}
|
||||
|
||||
JSHolderMap::Entry::Entry() : Entry(nullptr, nullptr, nullptr) {}
|
||||
|
||||
JSHolderMap::Entry::Entry(void* aHolder, nsScriptObjectTracer* aTracer,
|
||||
JS::Zone* aZone)
|
||||
: mHolder(aHolder),
|
||||
@@ -561,8 +559,6 @@ void JSHolderMap::Iter::UpdateForRemovals() {
|
||||
Settle();
|
||||
}
|
||||
|
||||
JSHolderMap::JSHolderMap() : mJSHolderMap(256) {}
|
||||
|
||||
bool JSHolderMap::RemoveEntry(EntryVector& aJSHolders, Entry* aEntry) {
|
||||
MOZ_ASSERT(aEntry);
|
||||
MOZ_ASSERT(!aEntry->mHolder);
|
||||
|
||||
@@ -90,7 +90,7 @@ class JSHolderMap {
|
||||
public:
|
||||
class Iter;
|
||||
|
||||
JSHolderMap();
|
||||
JSHolderMap() = default;
|
||||
~JSHolderMap() { MOZ_RELEASE_ASSERT(!mHasIterator); }
|
||||
|
||||
bool Has(void* aHolder) const;
|
||||
@@ -102,13 +102,13 @@ class JSHolderMap {
|
||||
|
||||
private:
|
||||
struct Entry {
|
||||
void* mHolder;
|
||||
nsScriptObjectTracer* mTracer;
|
||||
void* mHolder = nullptr;
|
||||
nsScriptObjectTracer* mTracer = nullptr;
|
||||
#ifdef DEBUG
|
||||
JS::Zone* mZone;
|
||||
JS::Zone* mZone = nullptr;
|
||||
#endif
|
||||
|
||||
Entry();
|
||||
Entry() = default;
|
||||
Entry(void* aHolder, nsScriptObjectTracer* aTracer, JS::Zone* aZone);
|
||||
};
|
||||
|
||||
@@ -126,7 +126,7 @@ class JSHolderMap {
|
||||
bool RemoveEntry(EntryVector& aJSHolders, Entry* aEntry);
|
||||
|
||||
// A map from a holder pointer to a pointer to an entry in a vector.
|
||||
EntryMap mJSHolderMap;
|
||||
EntryMap mJSHolderMap{256};
|
||||
|
||||
// A vector of holders not associated with a particular zone or that can
|
||||
// contain pointers to GC things in more than one zone.
|
||||
|
||||
@@ -368,7 +368,7 @@ class nsAutoRefCnt {
|
||||
namespace mozilla {
|
||||
class ThreadSafeAutoRefCnt {
|
||||
public:
|
||||
constexpr ThreadSafeAutoRefCnt() : mValue(0) {}
|
||||
constexpr ThreadSafeAutoRefCnt() = default;
|
||||
constexpr explicit ThreadSafeAutoRefCnt(nsrefcnt aValue) : mValue(aValue) {}
|
||||
|
||||
ThreadSafeAutoRefCnt(const ThreadSafeAutoRefCnt&) = delete;
|
||||
@@ -454,7 +454,7 @@ class ThreadSafeAutoRefCnt {
|
||||
static const bool isThreadSafe = true;
|
||||
|
||||
private:
|
||||
std::atomic<nsrefcnt> mValue;
|
||||
std::atomic<nsrefcnt> mValue{0};
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -756,7 +756,7 @@ struct SegmentStats {
|
||||
};
|
||||
|
||||
class WindowsAddressSpaceReporter final : public nsIMemoryReporter {
|
||||
~WindowsAddressSpaceReporter() {}
|
||||
~WindowsAddressSpaceReporter() = default;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
@@ -926,7 +926,7 @@ NS_IMPL_ISUPPORTS(WindowsAddressSpaceReporter, nsIMemoryReporter)
|
||||
|
||||
#ifdef HAVE_VSIZE_MAX_CONTIGUOUS_REPORTER
|
||||
class VsizeMaxContiguousReporter final : public nsIMemoryReporter {
|
||||
~VsizeMaxContiguousReporter() {}
|
||||
~VsizeMaxContiguousReporter() = default;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
@@ -947,7 +947,7 @@ NS_IMPL_ISUPPORTS(VsizeMaxContiguousReporter, nsIMemoryReporter)
|
||||
|
||||
#ifdef HAVE_PRIVATE_REPORTER
|
||||
class PrivateReporter final : public nsIMemoryReporter {
|
||||
~PrivateReporter() {}
|
||||
~PrivateReporter() = default;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
@@ -66,14 +66,14 @@ class ChunkedList {
|
||||
mozilla::Atomic<T> mElements[kLength];
|
||||
mozilla::UniquePtr<ListChunk> mNext;
|
||||
|
||||
ListChunk() : mNext(nullptr) {}
|
||||
ListChunk() = default;
|
||||
};
|
||||
|
||||
ListChunk mList;
|
||||
mozilla::Atomic<size_t> mLength;
|
||||
mozilla::Atomic<size_t> mLength{0};
|
||||
|
||||
public:
|
||||
ChunkedList() : mLength(0) {}
|
||||
ChunkedList() = default;
|
||||
|
||||
~ChunkedList() {
|
||||
// There can be writes happening after this destructor runs, so keep
|
||||
|
||||
@@ -46,7 +46,7 @@ class Probe {
|
||||
nsresult Trigger();
|
||||
|
||||
protected:
|
||||
~Probe() {};
|
||||
~Probe() = default;
|
||||
|
||||
Probe(const nsCID& aGUID, const nsACString& aName, ProbeManager* aManager);
|
||||
friend class ProbeManager;
|
||||
|
||||
@@ -72,12 +72,12 @@ class CategoryNode {
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf);
|
||||
|
||||
private:
|
||||
CategoryNode() : mLock("CategoryLeaf") {}
|
||||
CategoryNode() = default;
|
||||
|
||||
void* operator new(size_t aSize, CategoryAllocator* aArena);
|
||||
|
||||
nsTHashtable<CategoryLeaf> mTable MOZ_GUARDED_BY(mLock);
|
||||
mozilla::Mutex mLock;
|
||||
mozilla::Mutex mLock{"CategoryLeaf"};
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -85,7 +85,7 @@ struct PLDHashEntryHdr {
|
||||
//
|
||||
class Checker {
|
||||
public:
|
||||
constexpr Checker() : mState(kIdle), mIsWritable(true) {}
|
||||
constexpr Checker() = default;
|
||||
|
||||
Checker& operator=(Checker&& aOther) {
|
||||
// Atomic<> doesn't have an |operator=(Atomic<>&&)|.
|
||||
@@ -190,8 +190,8 @@ class Checker {
|
||||
static const uint32_t kReadMax = 9999;
|
||||
static const uint32_t kWrite = 10000;
|
||||
|
||||
mozilla::Atomic<uint32_t, mozilla::SequentiallyConsistent> mState;
|
||||
mozilla::Atomic<bool, mozilla::SequentiallyConsistent> mIsWritable;
|
||||
mozilla::Atomic<uint32_t, mozilla::SequentiallyConsistent> mState{kIdle};
|
||||
mozilla::Atomic<bool, mozilla::SequentiallyConsistent> mIsWritable{true};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -363,10 +363,6 @@ nsresult nsPropertiesParser::ParseBuffer(const char16_t* aBuffer,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsPersistentProperties::nsPersistentProperties() : mIn(nullptr), mTable(16) {}
|
||||
|
||||
nsPersistentProperties::~nsPersistentProperties() = default;
|
||||
|
||||
size_t nsPersistentProperties::SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) {
|
||||
// The memory used by mTable is accounted for in mArena.
|
||||
|
||||
@@ -8,26 +8,25 @@
|
||||
#include "mozilla/ArenaAllocator.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPersistentProperties2.h"
|
||||
#include "nsIUnicharInputStream.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTHashMap.h"
|
||||
|
||||
class nsIUnicharInputStream;
|
||||
|
||||
class nsPersistentProperties final : public nsIPersistentProperties {
|
||||
public:
|
||||
nsPersistentProperties();
|
||||
nsPersistentProperties() = default;
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIPROPERTIES
|
||||
NS_DECL_NSIPERSISTENTPROPERTIES
|
||||
|
||||
private:
|
||||
~nsPersistentProperties();
|
||||
~nsPersistentProperties() = default;
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIUnicharInputStream> mIn;
|
||||
|
||||
nsTHashMap<nsDepCharHashKey, const char16_t*> mTable;
|
||||
nsTHashMap<nsDepCharHashKey, const char16_t*> mTable{16};
|
||||
mozilla::ArenaAllocator<2048, 4> mArena;
|
||||
};
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ class nsAnonTempFileRemover final : public nsIObserver, public nsINamed {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsAnonTempFileRemover() {}
|
||||
nsAnonTempFileRemover() = default;
|
||||
|
||||
nsresult Init() {
|
||||
// We add the idle observer in a timer, so that the app has enough
|
||||
@@ -239,7 +239,7 @@ class nsAnonTempFileRemover final : public nsIObserver, public nsINamed {
|
||||
}
|
||||
|
||||
private:
|
||||
~nsAnonTempFileRemover() {}
|
||||
~nsAnonTempFileRemover() = default;
|
||||
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
};
|
||||
|
||||
@@ -74,8 +74,6 @@ nsresult nsDirectoryService::GetCurrentProcessDirectory(nsIFile** aFile) {
|
||||
|
||||
StaticRefPtr<nsDirectoryService> nsDirectoryService::gService;
|
||||
|
||||
nsDirectoryService::nsDirectoryService() : mHashtable(128) {}
|
||||
|
||||
nsresult nsDirectoryService::Create(REFNSIID aIID, void** aResult) {
|
||||
if (NS_WARN_IF(!aResult)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
@@ -29,7 +29,7 @@ class nsDirectoryService final : public nsIDirectoryService,
|
||||
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
|
||||
|
||||
nsDirectoryService();
|
||||
nsDirectoryService() = default;
|
||||
|
||||
static void RealInit();
|
||||
void RegisterCategoryProviders();
|
||||
@@ -45,7 +45,7 @@ class nsDirectoryService final : public nsIDirectoryService,
|
||||
~nsDirectoryService();
|
||||
nsCOMPtr<nsIFile> mXCurProcD;
|
||||
|
||||
nsInterfaceHashtable<nsCStringHashKey, nsIFile> mHashtable;
|
||||
nsInterfaceHashtable<nsCStringHashKey, nsIFile> mHashtable{128};
|
||||
nsTArray<nsCOMPtr<nsIDirectoryServiceProvider>> mProviders;
|
||||
};
|
||||
|
||||
|
||||
@@ -760,7 +760,7 @@ static nsresult ReadDir(nsDir* aDir, PRDirFlags aFlags, nsString& aName) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
while (true) {
|
||||
BOOL rv;
|
||||
if (aDir->firstEntry) {
|
||||
aDir->firstEntry = false;
|
||||
@@ -3721,7 +3721,7 @@ NS_IMPL_ISUPPORTS_INHERITED(nsDriveEnumerator, nsSimpleEnumerator,
|
||||
nsDriveEnumerator::nsDriveEnumerator(bool aUseDOSDevicePathSyntax)
|
||||
: mUseDOSDevicePathSyntax(aUseDOSDevicePathSyntax) {}
|
||||
|
||||
nsDriveEnumerator::~nsDriveEnumerator() {}
|
||||
nsDriveEnumerator::~nsDriveEnumerator() = default;
|
||||
|
||||
nsresult nsDriveEnumerator::Init() {
|
||||
/* If the length passed to GetLogicalDriveStrings is smaller
|
||||
|
||||
@@ -82,7 +82,7 @@ class nsLocalFile final : public nsILocalFileWin {
|
||||
};
|
||||
|
||||
nsLocalFile(const nsLocalFile& aOther);
|
||||
~nsLocalFile() {}
|
||||
~nsLocalFile() = default;
|
||||
|
||||
bool mDirty; // cached information can only be used when this is false
|
||||
bool mResolveDirty;
|
||||
|
||||
@@ -101,7 +101,7 @@ struct nsXPTCVariant {
|
||||
|
||||
// As this type contains an anonymous union, we need to provide an explicit
|
||||
// destructor.
|
||||
~nsXPTCVariant() {}
|
||||
~nsXPTCVariant() {} // NOLINT()
|
||||
};
|
||||
|
||||
static_assert(offsetof(nsXPTCVariant, val) == offsetof(nsXPTCVariant, ext),
|
||||
|
||||
@@ -75,7 +75,7 @@ class InputTaskManager : public TaskManager {
|
||||
void NotifyVsync() { mInputPriorityController.WillRunVsync(); }
|
||||
|
||||
private:
|
||||
InputTaskManager() : mInputQueueState(STATE_DISABLED) {}
|
||||
InputTaskManager() = default;
|
||||
|
||||
class InputPriorityController {
|
||||
public:
|
||||
@@ -124,7 +124,7 @@ class InputTaskManager : public TaskManager {
|
||||
|
||||
int32_t GetPriorityModifierForEventLoopTurnForStrictVsyncAlignment();
|
||||
|
||||
Atomic<InputEventQueueState> mInputQueueState;
|
||||
Atomic<InputEventQueueState> mInputQueueState{STATE_DISABLED};
|
||||
|
||||
static StaticRefPtr<InputTaskManager> gInputTaskManager;
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class TaskManager {
|
||||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TaskManager)
|
||||
|
||||
TaskManager() : mTaskCount(0) {}
|
||||
TaskManager() = default;
|
||||
|
||||
// Subclasses implementing task manager will have this function called to
|
||||
// determine whether their associated tasks are currently suspended. This
|
||||
@@ -106,7 +106,7 @@ class TaskManager {
|
||||
bool mCurrentSuspended = false;
|
||||
int32_t mCurrentPriorityModifier = 0;
|
||||
|
||||
std::atomic<uint32_t> mTaskCount;
|
||||
std::atomic<uint32_t> mTaskCount{};
|
||||
};
|
||||
|
||||
// A Task is the the base class for any unit of work that may be scheduled.
|
||||
|
||||
Reference in New Issue
Block a user