diff --git a/dom/animation/KeyframeUtils.cpp b/dom/animation/KeyframeUtils.cpp index 6b60479bad5e..f48607e0d809 100644 --- a/dom/animation/KeyframeUtils.cpp +++ b/dom/animation/KeyframeUtils.cpp @@ -62,9 +62,9 @@ enum class ListAllowance { eDisallow, eAllow }; * mValues. */ struct PropertyValuesPair { - PropertyValuesPair() : mProperty(eCSSProperty_UNKNOWN) {} + PropertyValuesPair() = default; - CSSPropertyId mProperty; + CSSPropertyId mProperty{eCSSProperty_UNKNOWN}; nsTArray mValues; }; diff --git a/dom/audiochannel/AudioChannelService.cpp b/dom/audiochannel/AudioChannelService.cpp index 4c5db66e20ca..09355c5ec0b0 100644 --- a/dom/audiochannel/AudioChannelService.cpp +++ b/dom/audiochannel/AudioChannelService.cpp @@ -162,8 +162,6 @@ AudioChannelService::AudioChannelService() { } } -AudioChannelService::~AudioChannelService() = default; - void AudioChannelService::RegisterAudioChannelAgent(AudioChannelAgent* aAgent, AudibleState aAudible) { MOZ_ASSERT(aAgent); diff --git a/dom/audiochannel/AudioChannelService.h b/dom/audiochannel/AudioChannelService.h index 5860a1a0d1bd..b379a7e0c73d 100644 --- a/dom/audiochannel/AudioChannelService.h +++ b/dom/audiochannel/AudioChannelService.h @@ -156,7 +156,7 @@ class AudioChannelService final : public nsIObserver { private: AudioChannelService(); - ~AudioChannelService(); + ~AudioChannelService() = default; void RefreshAgents(nsPIDOMWindowOuter* aWindow, const std::function& aFunc); diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 28d4463e29b0..9b2e705cdfec 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -1175,7 +1175,7 @@ class BeaconStreamListener final : public nsIStreamListener { ~BeaconStreamListener() = default; public: - BeaconStreamListener() : mLoadGroup(nullptr) {} + BeaconStreamListener() = default; void SetLoadGroup(nsILoadGroup* aLoadGroup) { mLoadGroup = aLoadGroup; } @@ -1184,7 +1184,7 @@ class BeaconStreamListener final : public nsIStreamListener { NS_DECL_NSIREQUESTOBSERVER private: - nsCOMPtr mLoadGroup; + nsCOMPtr mLoadGroup{}; }; NS_IMPL_ISUPPORTS(BeaconStreamListener, nsIStreamListener, nsIRequestObserver) diff --git a/dom/cache/Action.cpp b/dom/cache/Action.cpp index 97dc23cb7cf9..9df8df2a9dae 100644 --- a/dom/cache/Action.cpp +++ b/dom/cache/Action.cpp @@ -14,10 +14,6 @@ void Action::CancelOnInitiatingThread() { mCanceled = true; } -Action::Action() : mCanceled(false) {} - -Action::~Action() = default; - bool Action::IsCanceled() const { return mCanceled; } } // namespace mozilla::dom::cache diff --git a/dom/cache/Action.h b/dom/cache/Action.h index d3d13e2c7aa9..6012c9bc280e 100644 --- a/dom/cache/Action.h +++ b/dom/cache/Action.h @@ -45,7 +45,7 @@ class Action : public SafeRefCounted { }; // virtual because deleted through base class pointer - virtual ~Action(); + virtual ~Action() = default; // Execute operations on the target thread. Once complete call // Resolver::Resolve(). This can be done sync or async. @@ -85,7 +85,7 @@ class Action : public SafeRefCounted { MOZ_DECLARE_REFCOUNTED_TYPENAME(cache::Action) protected: - Action(); + Action() = default; // Check if this Action has been canceled. May be called from any thread, // but typically used from the target thread. @@ -93,7 +93,7 @@ class Action : public SafeRefCounted { private: // Accessible from any thread. - Atomic mCanceled; + Atomic mCanceled{false}; }; } // namespace mozilla::dom::cache diff --git a/dom/clients/manager/ClientState.cpp b/dom/clients/manager/ClientState.cpp index b25411211a82..2552ca4ba74f 100644 --- a/dom/clients/manager/ClientState.cpp +++ b/dom/clients/manager/ClientState.cpp @@ -38,8 +38,6 @@ ClientWindowState& ClientWindowState::operator=(ClientWindowState&& aRight) { return *this; } -ClientWindowState::~ClientWindowState() = default; - mozilla::dom::VisibilityState ClientWindowState::VisibilityState() const { return mData->visibilityState(); } @@ -82,8 +80,6 @@ ClientWorkerState& ClientWorkerState::operator=(ClientWorkerState&& aRight) { return *this; } -ClientWorkerState::~ClientWorkerState() = default; - StorageAccess ClientWorkerState::GetStorageAccess() const { return mData->storageAccess(); } diff --git a/dom/clients/manager/ClientState.h b/dom/clients/manager/ClientState.h index 3d601e52bbf0..2aa4f5ab5b41 100644 --- a/dom/clients/manager/ClientState.h +++ b/dom/clients/manager/ClientState.h @@ -50,7 +50,7 @@ class ClientWindowState final { ClientWindowState& operator=(ClientWindowState&& aRight); - ~ClientWindowState(); + ~ClientWindowState() = default; mozilla::dom::VisibilityState VisibilityState() const; @@ -84,7 +84,7 @@ class ClientWorkerState final { ClientWorkerState& operator=(ClientWorkerState&& aRight); - ~ClientWorkerState(); + ~ClientWorkerState() = default; StorageAccess GetStorageAccess() const; diff --git a/dom/commandhandler/nsControllerCommandTable.cpp b/dom/commandhandler/nsControllerCommandTable.cpp index 7c5e09c1b4d6..94e595140695 100644 --- a/dom/commandhandler/nsControllerCommandTable.cpp +++ b/dom/commandhandler/nsControllerCommandTable.cpp @@ -14,14 +14,6 @@ using mozilla::ControllerCommand; -// this value is used to size the hash table. Just a sensible upper bound -#define NUM_COMMANDS_LENGTH 32 - -nsControllerCommandTable::nsControllerCommandTable() - : mCommandsTable(NUM_COMMANDS_LENGTH) {} - -nsControllerCommandTable::~nsControllerCommandTable() = default; - void nsControllerCommandTable::RegisterCommand(const nsACString& aName, ControllerCommand* aCommand) { MOZ_DIAGNOSTIC_ASSERT(mMutable); diff --git a/dom/commandhandler/nsControllerCommandTable.h b/dom/commandhandler/nsControllerCommandTable.h index 25eeac36f1db..a1320e392e94 100644 --- a/dom/commandhandler/nsControllerCommandTable.h +++ b/dom/commandhandler/nsControllerCommandTable.h @@ -17,7 +17,7 @@ class nsICommandParams; class nsControllerCommandTable final { public: - nsControllerCommandTable(); + nsControllerCommandTable() = default; NS_INLINE_DECL_REFCOUNTING(nsControllerCommandTable); @@ -38,10 +38,12 @@ class nsControllerCommandTable final { void GetSupportedCommands(nsTArray&) const; private: - ~nsControllerCommandTable(); + ~nsControllerCommandTable() = default; + // This value is used to size the hash table. Just a sensible upper bound + static constexpr size_t num_commands_length = 32; // Hash table of nsIControllerCommands, keyed by command name. nsRefPtrHashtable - mCommandsTable; + mCommandsTable{num_commands_length}; // Are we mutable? bool mMutable = true; diff --git a/dom/console/ConsoleReportCollector.cpp b/dom/console/ConsoleReportCollector.cpp index 2a2db2a2baa7..f178a42f6407 100644 --- a/dom/console/ConsoleReportCollector.cpp +++ b/dom/console/ConsoleReportCollector.cpp @@ -16,9 +16,6 @@ using mozilla::dom::ConsoleUtils; NS_IMPL_ISUPPORTS(ConsoleReportCollector, nsIConsoleReportCollector) -ConsoleReportCollector::ConsoleReportCollector() - : mMutex("mozilla::ConsoleReportCollector") {} - void ConsoleReportCollector::AddConsoleReport( uint32_t aErrorFlags, const nsACString& aCategory, PropertiesFile aPropertiesFile, const nsACString& aSourceFileURI, diff --git a/dom/console/ConsoleReportCollector.h b/dom/console/ConsoleReportCollector.h index b2e43b62a67d..c4ed4ff684e5 100644 --- a/dom/console/ConsoleReportCollector.h +++ b/dom/console/ConsoleReportCollector.h @@ -17,7 +17,7 @@ class ConsoleReportCollected; class ConsoleReportCollector final : public nsIConsoleReportCollector { public: - ConsoleReportCollector(); + ConsoleReportCollector() = default; void AddConsoleReport(uint32_t aErrorFlags, const nsACString& aCategory, PropertiesFile aPropertiesFile, @@ -76,7 +76,7 @@ class ConsoleReportCollector final : public nsIConsoleReportCollector { const CopyableTArray mStringParams; }; - Mutex mMutex; + Mutex mMutex{"mozilla::ConsoleReportCollector"}; // protected by mMutex nsTArray mPendingReports MOZ_GUARDED_BY(mMutex); diff --git a/dom/gamepad/windows/WindowsGamepad.cpp b/dom/gamepad/windows/WindowsGamepad.cpp index 524db5269e68..0c8a384b7cf9 100644 --- a/dom/gamepad/windows/WindowsGamepad.cpp +++ b/dom/gamepad/windows/WindowsGamepad.cpp @@ -149,7 +149,7 @@ class Gamepad { } private: - Gamepad() {} + Gamepad() = default; }; // Drop this in favor of decltype when we require a new enough SDK. @@ -1174,7 +1174,7 @@ class StartWindowsGamepadServiceRunnable final : public Runnable { } private: - ~StartWindowsGamepadServiceRunnable() {} + ~StartWindowsGamepadServiceRunnable() = default; }; class StopWindowsGamepadServiceRunnable final : public Runnable { @@ -1198,7 +1198,7 @@ class StopWindowsGamepadServiceRunnable final : public Runnable { } private: - ~StopWindowsGamepadServiceRunnable() {} + ~StopWindowsGamepadServiceRunnable() = default; }; } // namespace diff --git a/dom/ipc/PreallocatedProcessManager.cpp b/dom/ipc/PreallocatedProcessManager.cpp index 36c854222207..e896a1d80f01 100644 --- a/dom/ipc/PreallocatedProcessManager.cpp +++ b/dom/ipc/PreallocatedProcessManager.cpp @@ -53,7 +53,7 @@ class PreallocatedProcessManagerImpl final : public nsIObserver { static StaticRefPtr sSingleton; PreallocatedProcessManagerImpl(); - ~PreallocatedProcessManagerImpl(); + ~PreallocatedProcessManagerImpl() = default; void Init(); @@ -115,7 +115,6 @@ PreallocatedProcessManagerImpl::PreallocatedProcessManagerImpl() // Note: mPreallocatedProcesses may not be null, but all processes should // be dead (IsDead==true). We block Erase() when our observer sees // shutdown starting. -PreallocatedProcessManagerImpl::~PreallocatedProcessManagerImpl() = default; void PreallocatedProcessManagerImpl::Init() { Preferences::AddStrongObserver(this, "dom.ipc.processPrelaunch.enabled"); diff --git a/dom/ipc/RefMessageBodyService.cpp b/dom/ipc/RefMessageBodyService.cpp index b04f2c87f32e..7524005d71e7 100644 --- a/dom/ipc/RefMessageBodyService.cpp +++ b/dom/ipc/RefMessageBodyService.cpp @@ -63,8 +63,6 @@ MozExternalRefCountType RefMessageBodyService::Release() { return 0; } -RefMessageBodyService::~RefMessageBodyService() = default; - const nsID RefMessageBodyService::Register( already_AddRefed aBody, ErrorResult& aRv) { RefPtr body = aBody; diff --git a/dom/ipc/RefMessageBodyService.h b/dom/ipc/RefMessageBodyService.h index d68e54a63ff4..7df304333d2a 100644 --- a/dom/ipc/RefMessageBodyService.h +++ b/dom/ipc/RefMessageBodyService.h @@ -122,7 +122,7 @@ class RefMessageBodyService final { private: explicit RefMessageBodyService(const StaticMutexAutoLock& aProofOfLock); - ~RefMessageBodyService(); + ~RefMessageBodyService() = default; protected: ::mozilla::ThreadSafeAutoRefCnt mRefCnt; diff --git a/dom/media/CallbackThreadRegistry.cpp b/dom/media/CallbackThreadRegistry.cpp index bf229aa44d35..3b2455c53ed1 100644 --- a/dom/media/CallbackThreadRegistry.cpp +++ b/dom/media/CallbackThreadRegistry.cpp @@ -22,9 +22,6 @@ struct CallbackThreadRegistrySingleton { UniquePtr mRegistry; }; -CallbackThreadRegistry::CallbackThreadRegistry() - : mThreadIds("CallbackThreadRegistry::mThreadIds") {} - /* static */ CallbackThreadRegistry* CallbackThreadRegistry::Get() { static CallbackThreadRegistrySingleton sSingleton; diff --git a/dom/media/CallbackThreadRegistry.h b/dom/media/CallbackThreadRegistry.h index ff07accad5fd..0ec822fd653f 100644 --- a/dom/media/CallbackThreadRegistry.h +++ b/dom/media/CallbackThreadRegistry.h @@ -19,7 +19,7 @@ namespace mozilla { // path. class CallbackThreadRegistry final { public: - CallbackThreadRegistry(); + CallbackThreadRegistry() = default; // It would be nice to be able to assert that all threads have been // unregistered, but we can't: it's legal to suspend an audio stream, so @@ -47,7 +47,8 @@ class CallbackThreadRegistry final { ProfilerThreadId mId; // from profiler_current_thread_id int mUserCount = 0; }; - DataMutex> mThreadIds; + DataMutex> mThreadIds{ + "CallbackThreadRegistry::mThreadIds"}; }; } // namespace mozilla diff --git a/dom/media/GraphDriver.h b/dom/media/GraphDriver.h index a9809c901992..d4f06b9f86db 100644 --- a/dom/media/GraphDriver.h +++ b/dom/media/GraphDriver.h @@ -116,7 +116,8 @@ struct GraphInterface : public nsISupports { mSwitchedRunnable = nullptr; } }; - Variant mResult; + Variant mResult{ + Undefined()}; explicit IterationResult(StillProcessing&& aArg) : mResult(std::move(aArg)) {} @@ -124,7 +125,7 @@ struct GraphInterface : public nsISupports { explicit IterationResult(SwitchDriver&& aArg) : mResult(std::move(aArg)) {} public: - IterationResult() : mResult(Undefined()) {} + IterationResult() = default; IterationResult(const IterationResult&) = delete; IterationResult(IterationResult&&) = default; @@ -393,7 +394,7 @@ class MediaTrackGraphInitThreadRunnable; */ class ThreadedDriver : public GraphDriver { class IterationWaitHelper { - Monitor mMonitor MOZ_UNANNOTATED; + Monitor mMonitor MOZ_UNANNOTATED{"IterationWaitHelper::mMonitor"}; // The below members are guarded by mMonitor. // Whether another iteration is required either to process control @@ -404,7 +405,7 @@ class ThreadedDriver : public GraphDriver { TimeStamp mWakeTime; public: - IterationWaitHelper() : mMonitor("IterationWaitHelper::mMonitor") {} + IterationWaitHelper() = default; /** * If another iteration is needed we wait for aDuration, otherwise we wait diff --git a/dom/media/VideoSegment.cpp b/dom/media/VideoSegment.cpp index 062006f790ac..415731c6e0aa 100644 --- a/dom/media/VideoSegment.cpp +++ b/dom/media/VideoSegment.cpp @@ -190,6 +190,4 @@ VideoSegment::VideoSegment() VideoSegment::VideoSegment(VideoSegment&& aSegment) : MediaSegmentBase(std::move(aSegment)) {} -VideoSegment::~VideoSegment() = default; - } // namespace mozilla diff --git a/dom/media/VideoSegment.h b/dom/media/VideoSegment.h index 3c63623c2c8c..018f49c8753f 100644 --- a/dom/media/VideoSegment.h +++ b/dom/media/VideoSegment.h @@ -116,7 +116,7 @@ class VideoSegment : public MediaSegmentBase { VideoSegment(const VideoSegment&) = delete; VideoSegment& operator=(const VideoSegment&) = delete; - ~VideoSegment(); + ~VideoSegment() = default; void AppendFrame(const VideoChunk& aChunk, const Maybe& aForceBlack = Nothing(), diff --git a/dom/media/eme/mediafoundation/WMFCDMProxy.cpp b/dom/media/eme/mediafoundation/WMFCDMProxy.cpp index e4e04978483f..9d41dfc9ea64 100644 --- a/dom/media/eme/mediafoundation/WMFCDMProxy.cpp +++ b/dom/media/eme/mediafoundation/WMFCDMProxy.cpp @@ -60,7 +60,7 @@ WMFCDMProxy::WMFCDMProxy(dom::MediaKeys* aKeys, const nsAString& aKeySystem, MOZ_ASSERT(NS_IsMainThread()); } -WMFCDMProxy::~WMFCDMProxy() {} +WMFCDMProxy::~WMFCDMProxy() = default; void WMFCDMProxy::Init(PromiseId aPromiseId, const nsAString& aOrigin, const nsAString& aTopLevelOrigin, diff --git a/dom/media/mediaelement/TimeRanges.cpp b/dom/media/mediaelement/TimeRanges.cpp index f1bc5f102834..3daa65076944 100644 --- a/dom/media/mediaelement/TimeRanges.cpp +++ b/dom/media/mediaelement/TimeRanges.cpp @@ -19,8 +19,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TimeRanges) NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_END -TimeRanges::TimeRanges() : mParent(nullptr) {} - TimeRanges::TimeRanges(nsISupports* aParent) : mParent(aParent) {} TimeRanges::TimeRanges(nsISupports* aParent, diff --git a/dom/media/mediaelement/TimeRanges.h b/dom/media/mediaelement/TimeRanges.h index 6af6106fbe58..6f949e8a7f8c 100644 --- a/dom/media/mediaelement/TimeRanges.h +++ b/dom/media/mediaelement/TimeRanges.h @@ -27,7 +27,7 @@ class TimeRanges final : public nsISupports, public nsWrapperCache { NS_DECL_CYCLE_COLLECTING_ISUPPORTS_FINAL NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(TimeRanges) - TimeRanges(); + TimeRanges() = default; explicit TimeRanges(nsISupports* aParent); explicit TimeRanges(const media::TimeIntervals& aTimeIntervals); explicit TimeRanges(const media::TimeRanges& aTimeRanges); diff --git a/dom/media/mediasink/AudioDecoderInputTrack.h b/dom/media/mediasink/AudioDecoderInputTrack.h index 99b733c70906..45f87ff23b1a 100644 --- a/dom/media/mediasink/AudioDecoderInputTrack.h +++ b/dom/media/mediasink/AudioDecoderInputTrack.h @@ -50,9 +50,7 @@ class AudioDecoderInputTrack final : public ProcessedMediaTrack { struct Empty {}; struct ClearFutureData {}; struct DecodedData { - DecodedData() - : mStartTime(media::TimeUnit::Invalid()), - mEndTime(media::TimeUnit::Invalid()) {} + DecodedData() = default; DecodedData(DecodedData&& aDecodedData) : mSegment(std::move(aDecodedData.mSegment)) { mStartTime = aDecodedData.mStartTime; @@ -69,12 +67,12 @@ class AudioDecoderInputTrack final : public ProcessedMediaTrack { mEndTime = media::TimeUnit::Invalid(); } AudioSegment mSegment; - media::TimeUnit mStartTime; - media::TimeUnit mEndTime; + media::TimeUnit mStartTime{media::TimeUnit::Invalid()}; + media::TimeUnit mEndTime{media::TimeUnit::Invalid()}; }; struct EOS {}; - SPSCData() : mData(Empty()) {}; + SPSCData() = default; explicit SPSCData(ClearFutureData&& aArg) : mData(std::move(aArg)) {}; explicit SPSCData(DecodedData&& aArg) : mData(std::move(aArg)) {}; explicit SPSCData(EOS&& aArg) : mData(std::move(aArg)) {}; @@ -88,7 +86,7 @@ class AudioDecoderInputTrack final : public ProcessedMediaTrack { return IsDecodedData() ? &mData.as() : nullptr; } - Variant mData; + Variant mData{Empty()}; }; // Decoder thread API diff --git a/dom/media/ogg/OggCodecStore.cpp b/dom/media/ogg/OggCodecStore.cpp index fad9e65d5eca..aa69fca7743b 100644 --- a/dom/media/ogg/OggCodecStore.cpp +++ b/dom/media/ogg/OggCodecStore.cpp @@ -6,8 +6,6 @@ namespace mozilla { -OggCodecStore::OggCodecStore() : mMonitor("CodecStore") {} - OggCodecState* OggCodecStore::Add(uint32_t serial, UniquePtr codecState) { MonitorAutoLock mon(mMonitor); diff --git a/dom/media/ogg/OggCodecStore.h b/dom/media/ogg/OggCodecStore.h index e671feab3a8d..c81b5d6c060b 100644 --- a/dom/media/ogg/OggCodecStore.h +++ b/dom/media/ogg/OggCodecStore.h @@ -16,7 +16,7 @@ namespace mozilla { // streams. class OggCodecStore { public: - OggCodecStore(); + OggCodecStore() = default; OggCodecState* Add(uint32_t serial, UniquePtr codecState); bool Contains(uint32_t serial); OggCodecState* Get(uint32_t serial); @@ -27,7 +27,7 @@ class OggCodecStore { nsClassHashtable mCodecStates; // Protects the |mCodecStates| and the |mKnownStreams| members. - Monitor mMonitor MOZ_UNANNOTATED; + Monitor mMonitor MOZ_UNANNOTATED{"CodecStore"}; }; } // namespace mozilla diff --git a/dom/media/platforms/omx/OmxPlatformLayer.cpp b/dom/media/platforms/omx/OmxPlatformLayer.cpp index 287b8fb98d85..432a9ad5c5ea 100644 --- a/dom/media/platforms/omx/OmxPlatformLayer.cpp +++ b/dom/media/platforms/omx/OmxPlatformLayer.cpp @@ -185,7 +185,7 @@ UniquePtr ConfigForMime(const nsACString& aMimeType) { class OmxCommonVideoConfig : public OmxVideoConfig { public: - explicit OmxCommonVideoConfig() : OmxVideoConfig() {} + explicit OmxCommonVideoConfig() = default; OMX_ERRORTYPE Apply(OmxPlatformLayer& aOmx, const VideoInfo& aInfo) override { OMX_ERRORTYPE err = OMX_ErrorNone; diff --git a/dom/media/platforms/wmf/DXVA2Manager.cpp b/dom/media/platforms/wmf/DXVA2Manager.cpp index cc39e9779213..9d5d8dffc783 100644 --- a/dom/media/platforms/wmf/DXVA2Manager.cpp +++ b/dom/media/platforms/wmf/DXVA2Manager.cpp @@ -326,7 +326,7 @@ static Atomic sDXVAVideosCount(0); class D3D11DXVA2Manager : public DXVA2Manager { public: D3D11DXVA2Manager(); - virtual ~D3D11DXVA2Manager(); + virtual ~D3D11DXVA2Manager() = default; HRESULT Init(layers::KnowsCompositor* aKnowsCompositor, nsACString& aFailureReason, ID3D11Device* aDevice); @@ -609,8 +609,6 @@ bool D3D11DXVA2Manager::SupportsConfig(const VideoInfo& aInfo, D3D11DXVA2Manager::D3D11DXVA2Manager() : mZeroCopyUsageInfo(new layers::ZeroCopyUsageInfo) {} -D3D11DXVA2Manager::~D3D11DXVA2Manager() {} - IUnknown* D3D11DXVA2Manager::GetDXVADeviceManager() { MutexAutoLock lock(mLock); return mDXGIDeviceManager; diff --git a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp index 57830107e46f..c918b1d8dcde 100644 --- a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp +++ b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp @@ -22,8 +22,6 @@ WMFMediaDataDecoder::WMFMediaDataDecoder(MFTManager* aMFTManager) "WMFMediaDataDecoder")), mMFTManager(aMFTManager) {} -WMFMediaDataDecoder::~WMFMediaDataDecoder() {} - RefPtr WMFMediaDataDecoder::Init() { MOZ_ASSERT(!mIsShutDown); return InitPromise::CreateAndResolve(mMFTManager->GetType(), __func__); diff --git a/dom/media/platforms/wmf/WMFMediaDataDecoder.h b/dom/media/platforms/wmf/WMFMediaDataDecoder.h index a96d6fb3fb34..48c9bbc10359 100644 --- a/dom/media/platforms/wmf/WMFMediaDataDecoder.h +++ b/dom/media/platforms/wmf/WMFMediaDataDecoder.h @@ -19,7 +19,7 @@ namespace mozilla { // by the MFT into a MediaData object. class MFTManager { public: - virtual ~MFTManager() {} + virtual ~MFTManager() = default; // Submit a compressed sample for decoding. // This should forward to the MFTDecoder after performing @@ -126,7 +126,7 @@ class WMFMediaDataDecoder final virtual void SetSeekThreshold(const media::TimeUnit& aTime) override; private: - ~WMFMediaDataDecoder(); + ~WMFMediaDataDecoder() = default; RefPtr ProcessError(HRESULT aError, const char* aReason); diff --git a/dom/media/systemservices/MediaSystemResourceService.cpp b/dom/media/systemservices/MediaSystemResourceService.cpp index d54feafc6536..dfa72f6f24ed 100644 --- a/dom/media/systemservices/MediaSystemResourceService.cpp +++ b/dom/media/systemservices/MediaSystemResourceService.cpp @@ -42,8 +42,6 @@ MediaSystemResourceService::MediaSystemResourceService() : mDestroyed(false) { MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread()); } -MediaSystemResourceService::~MediaSystemResourceService() = default; - void MediaSystemResourceService::Destroy() { mDestroyed = true; } void MediaSystemResourceService::Acquire( diff --git a/dom/media/systemservices/MediaSystemResourceService.h b/dom/media/systemservices/MediaSystemResourceService.h index 8f4b7c777f2c..60e20199b776 100644 --- a/dom/media/systemservices/MediaSystemResourceService.h +++ b/dom/media/systemservices/MediaSystemResourceService.h @@ -38,7 +38,7 @@ class MediaSystemResourceService { private: MediaSystemResourceService(); - ~MediaSystemResourceService(); + ~MediaSystemResourceService() = default; struct MediaSystemResourceRequest { MediaSystemResourceRequest() : mParent(nullptr), mId(-1) {} diff --git a/dom/media/webrtc/jsapi/MediaTransportHandler.h b/dom/media/webrtc/jsapi/MediaTransportHandler.h index 899e83d94f64..b8bbe110b7bf 100644 --- a/dom/media/webrtc/jsapi/MediaTransportHandler.h +++ b/dom/media/webrtc/jsapi/MediaTransportHandler.h @@ -44,8 +44,7 @@ class MediaTransportHandler { // as appropriate. static already_AddRefed Create(); - explicit MediaTransportHandler() - : mStateCacheMutex("MediaTransportHandler::mStateCacheMutex") {} + explicit MediaTransportHandler() = default; typedef MozPromise, nsresult, true> IceLogPromise; @@ -186,7 +185,7 @@ class MediaTransportHandler { Maybe aError = Nothing()); virtual void Destroy() = 0; virtual ~MediaTransportHandler() = default; - mutable Mutex mStateCacheMutex; + mutable Mutex mStateCacheMutex{"MediaTransportHandler::mStateCacheMutex"}; std::map mStateCache; std::map mRtcpStateCache; diff --git a/dom/media/webrtc/sdp/RsdparsaSdp.h b/dom/media/webrtc/sdp/RsdparsaSdp.h index 0c906a031e11..a9d295d4cf28 100644 --- a/dom/media/webrtc/sdp/RsdparsaSdp.h +++ b/dom/media/webrtc/sdp/RsdparsaSdp.h @@ -54,11 +54,11 @@ class RsdparsaSdp final : public Sdp { void Serialize(std::ostream&) const override; private: - RsdparsaSdp() : mOrigin("", 0, 0, sdp::kIPv4, "") {} + RsdparsaSdp() = default; RsdparsaSdp(const RsdparsaSdp& aOrig); RsdparsaSessionHandle mSession; - SdpOrigin mOrigin; + SdpOrigin mOrigin{"", 0, 0, sdp::kIPv4, ""}; UniquePtr mAttributeList; std::vector> mMediaSections; }; diff --git a/dom/media/webrtc/sdp/SipccSdp.h b/dom/media/webrtc/sdp/SipccSdp.h index 20e2b4fbc1da..c6b32d6f0289 100644 --- a/dom/media/webrtc/sdp/SipccSdp.h +++ b/dom/media/webrtc/sdp/SipccSdp.h @@ -62,14 +62,14 @@ class SipccSdp final : public Sdp { private: using InternalResults = SdpParser::InternalResults; - SipccSdp() : mOrigin("", 0, 0, sdp::kIPv4, ""), mAttributeList(nullptr) {} + SipccSdp() = default; bool Load(sdp_t* sdp, InternalResults& results); bool LoadOrigin(sdp_t* sdp, InternalResults& results); - SdpOrigin mOrigin; + SdpOrigin mOrigin{"", 0, 0, sdp::kIPv4, ""}; SipccSdpBandwidths mBandwidths; - SipccSdpAttributeList mAttributeList; + SipccSdpAttributeList mAttributeList{nullptr}; std::vector> mMediaSections; }; diff --git a/dom/media/webspeech/synth/windows/SapiService.cpp b/dom/media/webspeech/synth/windows/SapiService.cpp index 35f8cc3674d2..fbab9749db84 100644 --- a/dom/media/webspeech/synth/windows/SapiService.cpp +++ b/dom/media/webspeech/synth/windows/SapiService.cpp @@ -46,7 +46,7 @@ class SapiCallback final : public nsISpeechTaskCallback { void OnSpeechEvent(const SPEVENT& speechEvent); private: - ~SapiCallback() {} + ~SapiCallback() = default; float GetTimeDurationFromStart() const { TimeDuration duration = TimeStamp::Now() - mStartingTime; @@ -189,7 +189,7 @@ NS_IMPL_RELEASE(SapiService) SapiService::SapiService() : mInitialized(false) {} -SapiService::~SapiService() {} +SapiService::~SapiService() = default; bool SapiService::Init() { AUTO_PROFILER_LABEL("SapiService::Init", OTHER); diff --git a/dom/midi/MIDIMessageQueue.cpp b/dom/midi/MIDIMessageQueue.cpp index 9a7cc145a136..d578553db318 100644 --- a/dom/midi/MIDIMessageQueue.cpp +++ b/dom/midi/MIDIMessageQueue.cpp @@ -8,8 +8,6 @@ namespace mozilla::dom { -MIDIMessageQueue::MIDIMessageQueue() : mMutex("MIDIMessageQueue::mMutex") {} - class MIDIMessageTimestampComparator { public: bool Equals(const MIDIMessage& a, const MIDIMessage& b) const { diff --git a/dom/midi/MIDIMessageQueue.h b/dom/midi/MIDIMessageQueue.h index f314f9ab507f..bb6036189cb4 100644 --- a/dom/midi/MIDIMessageQueue.h +++ b/dom/midi/MIDIMessageQueue.h @@ -27,7 +27,7 @@ class MIDIMessage; */ class MIDIMessageQueue { public: - MIDIMessageQueue(); + MIDIMessageQueue() = default; ~MIDIMessageQueue() = default; // Adds an array of possibly out-of-order messages to our queue. void Add(nsTArray& aMsg); @@ -47,7 +47,7 @@ class MIDIMessageQueue { // Array of messages to be sent. nsTArray mMessageQueue; // Mutex for coordinating cross thread array access. - Mutex mMutex MOZ_UNANNOTATED; + Mutex mMutex MOZ_UNANNOTATED{"MIDIMessageQueue::mMutex"}; }; } // namespace dom diff --git a/dom/quota/PersistenceScope.h b/dom/quota/PersistenceScope.h index 6c1396b30b45..402bb254cba3 100644 --- a/dom/quota/PersistenceScope.h +++ b/dom/quota/PersistenceScope.h @@ -35,10 +35,10 @@ class PersistenceScope { using DataType = Variant; - DataType mData; + DataType mData{Null{}}; public: - PersistenceScope() : mData(Null()) {} + PersistenceScope() = default; bool operator==(const PersistenceScope& aOther) = delete; diff --git a/dom/svg/SVGNumberList.h b/dom/svg/SVGNumberList.h index 3f220d2ea46e..2902583d911c 100644 --- a/dom/svg/SVGNumberList.h +++ b/dom/svg/SVGNumberList.h @@ -153,7 +153,7 @@ class SVGNumberList { */ class SVGNumberListAndInfo : public SVGNumberList { public: - SVGNumberListAndInfo() : mElement(nullptr) {} + SVGNumberListAndInfo() = default; explicit SVGNumberListAndInfo(dom::SVGElement* aElement) : mElement(do_GetWeakReference(static_cast(aElement))) {} @@ -192,7 +192,7 @@ class SVGNumberListAndInfo : public SVGNumberList { // cached baseVal SMILValue. See the comments starting at: // https://bugzilla.mozilla.org/show_bug.cgi?id=515116#c15 // See also https://bugzilla.mozilla.org/show_bug.cgi?id=653497 - nsWeakPtr mElement; + nsWeakPtr mElement{nullptr}; }; } // namespace mozilla diff --git a/dom/workers/WorkerCSPEventListener.cpp b/dom/workers/WorkerCSPEventListener.cpp index cbbe0a63c4f0..f3ba906f63af 100644 --- a/dom/workers/WorkerCSPEventListener.cpp +++ b/dom/workers/WorkerCSPEventListener.cpp @@ -60,9 +60,6 @@ already_AddRefed WorkerCSPEventListener::Create( return listener.forget(); } -WorkerCSPEventListener::WorkerCSPEventListener() - : mMutex("WorkerCSPEventListener::mMutex") {} - NS_IMETHODIMP WorkerCSPEventListener::OnCSPViolationEvent(const nsAString& aJSON, const nsAString& aReportGroupName) { diff --git a/dom/workers/WorkerCSPEventListener.h b/dom/workers/WorkerCSPEventListener.h index ddb7379c89e2..a61bb72dabec 100644 --- a/dom/workers/WorkerCSPEventListener.h +++ b/dom/workers/WorkerCSPEventListener.h @@ -24,10 +24,10 @@ class WorkerCSPEventListener final : public nsICSPEventListener { WorkerPrivate* aWorkerPrivate); private: - WorkerCSPEventListener(); + WorkerCSPEventListener() = default; ~WorkerCSPEventListener() = default; - Mutex mMutex; + Mutex mMutex{"WorkerCSPEventListener::mMutex"}; // Protected by mutex. RefPtr mWorkerRef MOZ_GUARDED_BY(mMutex); diff --git a/dom/workers/WorkerDocumentListener.cpp b/dom/workers/WorkerDocumentListener.cpp index e1bf87f3cd93..0f188cc18ea6 100644 --- a/dom/workers/WorkerDocumentListener.cpp +++ b/dom/workers/WorkerDocumentListener.cpp @@ -13,11 +13,6 @@ namespace mozilla::dom { -WorkerDocumentListener::WorkerDocumentListener() - : mMutex("mozilla::dom::WorkerDocumentListener::mMutex") {} - -WorkerDocumentListener::~WorkerDocumentListener() = default; - RefPtr WorkerDocumentListener::Create( WorkerPrivate* aWorkerPrivate) { MOZ_ASSERT(aWorkerPrivate); diff --git a/dom/workers/WorkerDocumentListener.h b/dom/workers/WorkerDocumentListener.h index 4e8e2594f544..6b6dd89aee98 100644 --- a/dom/workers/WorkerDocumentListener.h +++ b/dom/workers/WorkerDocumentListener.h @@ -18,7 +18,7 @@ class WorkerDocumentListener final { NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WorkerDocumentListener) public: - WorkerDocumentListener(); + WorkerDocumentListener() = default; void OnVisible(bool aVisible); void SetListening(uint64_t aWindowID, bool aListen); @@ -27,9 +27,10 @@ class WorkerDocumentListener final { static RefPtr Create(WorkerPrivate* aWorkerPrivate); private: - ~WorkerDocumentListener(); + ~WorkerDocumentListener() = default; - Mutex mMutex MOZ_UNANNOTATED; // protects mWorkerRef + Mutex mMutex MOZ_UNANNOTATED{ + "mozilla::dom::WorkerDocumentListener::mMutex"}; // protects mWorkerRef RefPtr mWorkerRef; };