☠☠ backed out by cf0358be9f09 ☠ ☠ | |
author | Randell Jesup <rjesup@wgate.com> |
Wed, 16 Mar 2022 12:01:14 +0000 | |
changeset 610752 | a68ee4b09f92b336cd65524d35c3ff7fd2a9845e |
parent 610751 | 192549182e47282ceebbacc476c3db1e54fadae4 |
child 610753 | cf0358be9f097701fd02780876723576d5597d89 |
push id | 39427 |
push user | abutkovits@mozilla.com |
push date | Wed, 16 Mar 2022 16:31:01 +0000 |
treeherder | mozilla-central@0a3e8683265e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | nika, kershaw |
bugs | 1207753 |
milestone | 100.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/accessible/ipc/win/HandlerProvider.h +++ b/accessible/ipc/win/HandlerProvider.h @@ -110,17 +110,17 @@ class HandlerProvider final : public IGe IA2TextSegment** aAttribRuns, long* aNAttribRuns, HRESULT* result); void GetRelationsInfoMainThread(IARelationData** aRelations, long* aNRelations, HRESULT* result); void GetAllChildrenMainThread(AccChildData** aChildren, ULONG* aNChildren, HRESULT* result); Atomic<uint32_t> mRefCnt; - Mutex mMutex; // Protects mSerializer + Mutex mMutex MOZ_UNANNOTATED; // Protects mSerializer const IID mTargetUnkIid; mscom::InterceptorTargetPtr<IUnknown> mTargetUnk; // Constant, main thread only UniquePtr<mscom::StructToStream> mSerializer; RefPtr<IUnknown> mFastMarshalUnk; struct IA2PayloadDeleter { void operator()(IA2Payload* aPayload) { @@ -131,15 +131,15 @@ class HandlerProvider final : public IGe delete aPayload; } }; using IA2PayloadPtr = UniquePtr<IA2Payload, IA2PayloadDeleter>; // Used when the payload is built prior to marshaling the object by a bulk // fetch operation. See prebuildPayload(). IA2PayloadPtr mPayload; - Mutex mPayloadMutex; // Protects mPayload + Mutex mPayloadMutex MOZ_UNANNOTATED; // Protects mPayload }; } // namespace a11y } // namespace mozilla #endif // mozilla_a11y_HandlerProvider_h
--- a/docshell/base/timeline/MarkersStorage.h +++ b/docshell/base/timeline/MarkersStorage.h @@ -35,14 +35,14 @@ class MarkersStorage : public LinkedList virtual void ClearMarkers() = 0; virtual void PopMarkers(JSContext* aCx, nsTArray<dom::ProfileTimelineMarker>& aStore) = 0; protected: Mutex& GetLock(); private: - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; }; } // namespace mozilla #endif /* mozilla_MarkersStorage_h_ */
--- a/docshell/base/timeline/TimelineConsumers.h +++ b/docshell/base/timeline/TimelineConsumers.h @@ -118,14 +118,14 @@ class TimelineConsumers : public nsIObse static Atomic<bool> sInShutdown; // Counter for how many timelines are currently interested in markers, // and a list of the MarkersStorage interfaces representing them. unsigned long mActiveConsumers; LinkedList<MarkersStorage> mMarkersStores; // Protects this class's data structures. - static StaticMutex sMutex; + static StaticMutex sMutex MOZ_UNANNOTATED; }; } // namespace mozilla #endif /* mozilla_TimelineConsumers_h_ */
--- a/dom/base/BodyStream.h +++ b/dom/base/BodyStream.h @@ -222,17 +222,17 @@ class BodyStream final : public nsIInput // Operation completed. eClosed, }; // We need a mutex because JS engine can release BodyStream on a non-owning // thread. We must be sure that the releasing of resources doesn't trigger // race conditions. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // Protected by mutex. State mState; nsCOMPtr<nsIGlobalObject> mGlobal; RefPtr<BodyStreamHolder> mStreamHolder; nsCOMPtr<nsIEventTarget> mOwningEventTarget;
--- a/dom/cache/Manager.cpp +++ b/dom/cache/Manager.cpp @@ -1096,17 +1096,17 @@ class Manager::CachePutAllAction final : nsresult mAsyncResult; nsTArray<nsID> mBodyIdWrittenList; // Written to on target thread, accessed on initiating thread after target // thread activity is guaranteed complete nsTArray<nsID> mDeletedBodyIdList; // accessed from any thread while mMutex locked - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; nsTArray<nsCOMPtr<nsISupports>> mCopyContextList; Maybe<CacheDirectoryMetadata> mDirectoryMetadata; // Track how much pad amount has been added for new entries so that it can be // removed if an error occurs. int64_t mUpdatedPaddingSize; // Track any pad amount associated with overwritten entries. int64_t mDeletedPaddingSize;
--- a/dom/cache/ReadStream.cpp +++ b/dom/cache/ReadStream.cpp @@ -100,17 +100,17 @@ class ReadStream::Inner final : public R Atomic<State> mState; Atomic<bool> mHasEverBeenRead; bool mAsyncOpenStarted; // The wrapped stream objects may not be threadsafe. We need to be able // to close a stream on our owning thread while an IO thread is simultaneously // reading the same stream. Therefore, protect all access to these stream // objects with a mutex. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; CondVar mCondVar; nsCOMPtr<nsIInputStream> mStream; nsCOMPtr<nsIInputStream> mSnappyStream; }; // ---------------------------------------------------------------------------- // Runnable to notify actors that the ReadStream has closed. This must
--- a/dom/canvas/HostWebGLContext.cpp +++ b/dom/canvas/HostWebGLContext.cpp @@ -27,17 +27,17 @@ #include "WebGLQuery.h" #include "mozilla/StaticMutex.h" namespace mozilla { // - -static StaticMutex sContextSetLock; +static StaticMutex sContextSetLock MOZ_UNANNOTATED; static std::unordered_set<HostWebGLContext*>& DeferredStaticContextSet() { static std::unordered_set<HostWebGLContext*> sContextSet; return sContextSet; } LockedOutstandingContexts::LockedOutstandingContexts() : contexts(DeferredStaticContextSet()) {
--- a/dom/canvas/ImageBitmap.cpp +++ b/dom/canvas/ImageBitmap.cpp @@ -1470,17 +1470,17 @@ class CreateImageBitmapFromBlob final : nsresult DecodeAndCropBlob(const nsACString& aMimeType); // This is called on the main-thread only. nsresult GetMimeTypeSync(nsACString& aMimeType); // This is called on the main-thread only. nsresult GetMimeTypeAsync(); - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // The access to this object is protected by mutex but is always nullified on // the owning thread. RefPtr<ThreadSafeWorkerRef> mWorkerRef; // Touched only on the owning thread. RefPtr<Promise> mPromise;
--- a/dom/canvas/OffscreenCanvasDisplayHelper.h +++ b/dom/canvas/OffscreenCanvasDisplayHelper.h @@ -57,17 +57,17 @@ class OffscreenCanvasDisplayHelper final void MaybeQueueInvalidateElement(); void InvalidateElement(); bool TransformSurface(const gfx::DataSourceSurface::ScopedMap& aSrcMap, const gfx::DataSourceSurface::ScopedMap& aDstMap, gfx::SurfaceFormat aFormat, const gfx::IntSize& aSize, bool aNeedsPremult, gl::OriginPos aOriginPos) const; - mutable Mutex mMutex; + mutable Mutex mMutex MOZ_UNANNOTATED; HTMLCanvasElement* MOZ_NON_OWNING_REF mCanvasElement; RefPtr<layers::ImageContainer> mImageContainer; RefPtr<gfx::SourceSurface> mFrontBufferSurface; OffscreenCanvasDisplayData mData; CanvasContextType mType = CanvasContextType::NoContext; Maybe<uint32_t> mContextManagerId; Maybe<int32_t> mContextChildId;
--- a/dom/console/ConsoleReportCollector.h +++ b/dom/console/ConsoleReportCollector.h @@ -73,17 +73,17 @@ class ConsoleReportCollector final : pub const nsContentUtils::PropertiesFile mPropertiesFile; const nsCString mSourceFileURI; const uint32_t mLineNumber; const uint32_t mColumnNumber; const nsCString mMessageName; const CopyableTArray<nsString> mStringParams; }; - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // protected by mMutex nsTArray<PendingReport> mPendingReports; public: NS_DECL_THREADSAFE_ISUPPORTS };
--- a/dom/file/FileBlobImpl.h +++ b/dom/file/FileBlobImpl.h @@ -126,17 +126,17 @@ class FileBlobImpl : public BlobImpl { const nsAString& aContentType, ErrorResult& aRv) override; class GetTypeRunnable; void GetTypeInternal(nsAString& aType, const MutexAutoLock& aProofOfLock); // FileBlobImpl has getter methods with lazy initialization. Because any // BlobImpl must work thread-safe, we use a mutex. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; nsCOMPtr<nsIFile> mFile; nsString mContentType; nsString mName; nsString mPath; // The path relative to a directory chosen by the user nsString mMozFullPath;
--- a/dom/file/MemoryBlobImpl.h +++ b/dom/file/MemoryBlobImpl.h @@ -92,17 +92,17 @@ class MemoryBlobImpl final : public Base } public: static void EnsureMemoryReporterRegistered(); // sDataOwners and sMemoryReporterRegistered may only be accessed while // holding sDataOwnerMutex! You also must hold the mutex while touching // elements of the linked list that DataOwner inherits from. - static mozilla::StaticMutex sDataOwnerMutex; + static mozilla::StaticMutex sDataOwnerMutex MOZ_UNANNOTATED; static mozilla::StaticAutoPtr<mozilla::LinkedList<DataOwner> > sDataOwners; static bool sMemoryReporterRegistered; void* mData; uint64_t mLength; }; class DataOwnerAdapter final : public StreamBufferSource {
--- a/dom/file/MutableBlobStorage.h +++ b/dom/file/MutableBlobStorage.h @@ -87,17 +87,17 @@ class MutableBlobStorage final { uint64_t aSize) const; bool MaybeCreateTemporaryFile(const MutexAutoLock& aProofOfLock); void MaybeCreateTemporaryFileOnMainThread(const MutexAutoLock& aProofOfLock); [[nodiscard]] nsresult DispatchToIOThread( already_AddRefed<nsIRunnable> aRunnable); - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // All these variables are touched on the main thread only or in the // retargeted thread when used by Append(). They are protected by mMutex. void* mData; uint64_t mDataLen; uint64_t mDataBufferLen;
--- a/dom/file/ipc/RemoteLazyInputStream.h +++ b/dom/file/ipc/RemoteLazyInputStream.h @@ -110,14 +110,14 @@ class RemoteLazyInputStream final : publ // These 2 values are set only when nsIAsyncInputStreamLength::asyncWait() is // called. nsCOMPtr<nsIInputStreamLengthCallback> mLengthCallback; nsCOMPtr<nsIEventTarget> mLengthCallbackEventTarget; // Any member of this class is protected by mutex because touched on // multiple threads. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; }; } // namespace mozilla #endif // mozilla_RemoteLazyInputStream_h
--- a/dom/file/ipc/RemoteLazyInputStreamChild.h +++ b/dom/file/ipc/RemoteLazyInputStreamChild.h @@ -73,17 +73,17 @@ class RemoteLazyInputStreamChild final : ~RemoteLazyInputStreamChild(); // Raw pointers because these streams keep this actor alive. When the last // stream is unregister, the actor will be deleted. This list is protected by // mutex. nsTArray<RemoteLazyInputStream*> mStreams; // This mutex protects mStreams because that can be touched in any thread. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; const nsID mID; const uint64_t mSize; ActorState mState; // This struct and the array are used for creating streams when needed. struct PendingOperation {
--- a/dom/file/uri/BlobURLInputStream.h +++ b/dom/file/uri/BlobURLInputStream.h @@ -55,17 +55,17 @@ class BlobURLInputStream final : public void NotifyWaitTargets(const MutexAutoLock& aProofOfLock); void ReleaseUnderlyingStream(const MutexAutoLock& aProofOfLock); RefPtr<BlobURLChannel> mChannel; const nsCString mBlobURLSpec; // Non-recursive mutex introduced in order to guard access to mState, mError // and mAsyncInputStream - Mutex mStateMachineMutex; + Mutex mStateMachineMutex MOZ_UNANNOTATED; State mState; // Stores the error code if stream is in error state nsresult mError; int64_t mBlobSize; nsCOMPtr<nsIAsyncInputStream> mAsyncInputStream; nsCOMPtr<nsIInputStreamCallback> mAsyncWaitCallback;
--- a/dom/file/uri/BlobURLProtocolHandler.cpp +++ b/dom/file/uri/BlobURLProtocolHandler.cpp @@ -82,17 +82,17 @@ struct DataInfo { // When a blobURL is revoked, we keep it alive for RELEASING_TIMER // milliseconds in order to support pending operations such as navigation, // download and so on. bool mRevoked; }; // The mutex is locked whenever gDataTable is changed, or if gDataTable // is accessed off-main-thread. -static StaticMutex sMutex; +static StaticMutex sMutex MOZ_UNANNOTATED; // All changes to gDataTable must happen on the main thread, while locking // sMutex. Reading from gDataTable on the main thread may happen without // locking, since no changes are possible. Reading it from another thread // must also lock sMutex to prevent data races. static nsClassHashtable<nsCStringHashKey, mozilla::dom::DataInfo>* gDataTable; static mozilla::dom::DataInfo* GetDataInfo(const nsACString& aUri,
--- a/dom/filesystem/GetFilesHelper.h +++ b/dom/filesystem/GetFilesHelper.h @@ -113,17 +113,17 @@ class GetFilesHelper : public Runnable, nsString mDirectoryPath; // Error code to propagate. nsresult mErrorResult; nsTArray<RefPtr<Promise>> mPromises; nsTArray<RefPtr<GetFilesCallback>> mCallbacks; - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // This variable is protected by mutex. bool mCanceled; }; class GetFilesHelperChild final : public GetFilesHelper { public: explicit GetFilesHelperChild(bool aRecursiveFlag)
--- a/dom/gamepad/GamepadPlatformService.h +++ b/dom/gamepad/GamepadPlatformService.h @@ -136,17 +136,17 @@ class GamepadPlatformService final { // mChannelParents stores all the GamepadEventChannelParent instances // which may be accessed by both background thread and monitor thread // simultaneously, so we have a mutex to prevent race condition nsTArray<RefPtr<GamepadEventChannelParent>> mChannelParents; // This mutex protects mChannelParents from race condition // between background and monitor thread - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; std::map<GamepadHandle, GamepadAdded> mGamepadAdded; }; } // namespace dom } // namespace mozilla #endif
--- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -1492,17 +1492,17 @@ class ConnectionPool final { } bool operator<(const IdleThreadInfo& aOther) const { return mIdleTime < aOther.mIdleTime; } }; // This mutex guards mDatabases, see below. - Mutex mDatabasesMutex; + Mutex mDatabasesMutex MOZ_UNANNOTATED; nsTArray<IdleThreadInfo> mIdleThreads; nsTArray<IdleDatabaseInfo> mIdleDatabases; nsTArray<NotNull<DatabaseInfo*>> mDatabasesPerformingIdleMaintenance; nsCOMPtr<nsITimer> mIdleTimer; TimeStamp mTargetIdleTime; // Only modifed on the owning thread, but read on multiple threads. Therefore @@ -6587,17 +6587,17 @@ nsresult DispatchAndReturnFileReferences MOZ_ASSERT(aMemRefCnt); MOZ_ASSERT(aDBRefCnt); MOZ_ASSERT(aResult); *aResult = false; *aMemRefCnt = -1; *aDBRefCnt = -1; - mozilla::Monitor monitor(__func__); + mozilla::Monitor monitor MOZ_ANNOTATED(__func__); bool waiting = true; auto lambda = [&] { AssertIsOnIOThread(); { IndexedDatabaseManager* const mgr = IndexedDatabaseManager::Get(); MOZ_ASSERT(mgr); @@ -6753,17 +6753,17 @@ class DeserializeIndexValueHelper final void OperationCompleted(nsresult aStatus) { mStatus = aStatus; MonitorAutoLock lock(mMonitor); lock.Notify(); } - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; const int64_t mIndexID; const KeyPath& mKeyPath; const bool mMultiEntry; const nsCString mLocale; StructuredCloneReadInfoParent& mCloneReadInfo; nsTArray<IndexUpdateInfo>& mUpdateInfoArray; nsresult mStatus; @@ -21677,17 +21677,17 @@ class FileHelper::ReadCallback final : p } return NS_OK; } private: ~ReadCallback() = default; - mozilla::Mutex mMutex; + mozilla::Mutex mMutex MOZ_UNANNOTATED; mozilla::CondVar mCondVar; bool mInputAvailable; }; NS_IMPL_ADDREF(FileHelper::ReadCallback); NS_IMPL_RELEASE(FileHelper::ReadCallback); NS_INTERFACE_MAP_BEGIN(FileHelper::ReadCallback)
--- a/dom/indexedDB/SchemaUpgrades.cpp +++ b/dom/indexedDB/SchemaUpgrades.cpp @@ -2837,17 +2837,17 @@ class DeserializeUpgradeValueHelper fina void OperationCompleted(nsresult aStatus) { mStatus = aStatus; MonitorAutoLock lock(mMonitor); lock.Notify(); } - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; StructuredCloneReadInfoParent& mCloneReadInfo; nsresult mStatus; }; nsresult DeserializeUpgradeValueToFileIds( StructuredCloneReadInfoParent& aCloneReadInfo, nsAString& aFileIds) { MOZ_ASSERT(!NS_IsMainThread());
--- a/dom/ipc/ProcessHangMonitor.cpp +++ b/dom/ipc/ProcessHangMonitor.cpp @@ -143,17 +143,17 @@ class HangMonitorChild : public PProcess static Atomic<bool, SequentiallyConsistent> sInitializing; private: void ShutdownOnThread(); static Atomic<HangMonitorChild*, SequentiallyConsistent> sInstance; const RefPtr<ProcessHangMonitor> mHangMonitor; - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; // Main thread-only. bool mSentReport; // These fields must be accessed with mMonitor held. bool mTerminateScript; bool mStartDebugger; bool mFinishedStartingDebugger; @@ -277,25 +277,25 @@ class HangMonitorParent : public PProces void ShutdownOnThread(); const RefPtr<ProcessHangMonitor> mHangMonitor; // This field is only accessed on the hang thread. bool mIPCOpen; - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; // Must be accessed with mMonitor held. RefPtr<HangMonitoredProcess> mProcess; bool mShutdownDone; // Map from plugin ID to crash dump ID. Protected by // mBrowserCrashDumpHashLock. nsTHashMap<nsUint32HashKey, nsString> mBrowserCrashDumpIds; - Mutex mBrowserCrashDumpHashLock; + Mutex mBrowserCrashDumpHashLock MOZ_UNANNOTATED; mozilla::ipc::TaskFactory<HangMonitorParent> mMainThreadTaskFactory; }; } // namespace /* HangMonitorChild implementation */ HangMonitorChild::HangMonitorChild(ProcessHangMonitor* aMonitor)
--- a/dom/ipc/RefMessageBodyService.h +++ b/dom/ipc/RefMessageBodyService.h @@ -91,17 +91,17 @@ class RefMessageBody final { private: ~RefMessageBody(); const nsID mPortID; // In case the RefMessageBody is shared and refcounted (see mCount/mMaxCount), // we must enforce that the reading does not happen simultaneously on // different threads. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; UniquePtr<ipc::StructuredCloneData> mCloneData; // When mCount reaches mMaxCount, this object is released by the service. Maybe<uint32_t> mMaxCount; uint32_t mCount; };
--- a/dom/localstorage/ActorsParent.cpp +++ b/dom/localstorage/ActorsParent.cpp @@ -1363,17 +1363,17 @@ class Connection final : public CachingD * connection on demand. This is necessary because we attempt to defer the * creation of the origin directory and the database until absolutely needed, * but the directory creation and origin initialization must happen on the QM * IO thread for invariant reasons. (We can't just use a mutex because there * could be logic on the IO thread that also wants to deal with the same * origin, so we need to queue a runnable and wait our turn.) */ class Connection::InitTemporaryOriginHelper final : public Runnable { - mozilla::Monitor mMonitor; + mozilla::Monitor mMonitor MOZ_UNANNOTATED; const OriginMetadata mOriginMetadata; nsString mOriginDirectoryPath; nsresult mIOThreadResultCode; bool mWaiting; public: explicit InitTemporaryOriginHelper(const OriginMetadata& aOriginMetadata) : Runnable("dom::localstorage::Connection::InitTemporaryOriginHelper"), @@ -2609,17 +2609,17 @@ class ArchivedOriginScope { }; class QuotaClient final : public mozilla::dom::quota::Client { class Observer; class MatchFunction; static QuotaClient* sInstance; - Mutex mShadowDatabaseMutex; + Mutex mShadowDatabaseMutex MOZ_UNANNOTATED; bool mShutdownRequested; public: QuotaClient(); static nsresult Initialize(); static QuotaClient* GetInstance() {
--- a/dom/media/AudioStream.h +++ b/dom/media/AudioStream.h @@ -324,17 +324,17 @@ class AudioStream final { template <typename Function, typename... Args> int InvokeCubeb(Function aFunction, Args&&... aArgs); bool CheckThreadIdChanged(); void AssertIsOnAudioThread() const; soundtouch::SoundTouch* mTimeStretcher; // The monitor is held to protect all access to member variables below. - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; const uint32_t mOutChannels; const AudioConfig::ChannelLayout::ChannelMap mChannelMap; AudioClock mAudioClock; WavDumper mDumpFile; // Owning reference to a cubeb_stream.
--- a/dom/media/Benchmark.cpp +++ b/dom/media/Benchmark.cpp @@ -74,17 +74,17 @@ uint32_t VP9Benchmark::MediaBenchmarkVp9 // static bool VP9Benchmark::IsVP9DecodeFast(bool aDefault) { #if defined(MOZ_WIDGET_ANDROID) return false; #else if (!ShouldRun()) { return false; } - static StaticMutex sMutex; + static StaticMutex sMutex MOZ_UNANNOTATED; uint32_t decodeFps = StaticPrefs::media_benchmark_vp9_fps(); uint32_t hadRecentUpdate = StaticPrefs::media_benchmark_vp9_versioncheck(); bool needBenchmark; { StaticMutexAutoLock lock(sMutex); needBenchmark = !sHasRunTest && (decodeFps == 0 || hadRecentUpdate != sBenchmarkVersionID); sHasRunTest = true;
--- a/dom/media/ChannelMediaResource.h +++ b/dom/media/ChannelMediaResource.h @@ -181,17 +181,17 @@ class ChannelMediaResource NS_DECL_NSISTREAMLISTENER NS_DECL_NSICHANNELEVENTSINK NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER void Revoke(); private: - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // mResource should only be modified on the main thread with the lock. // So it can be read without lock on the main thread or on other threads // with the lock. RefPtr<ChannelMediaResource> mResource; const int64_t mOffset; const uint32_t mLoadID; };
--- a/dom/media/CloneableWithRangeMediaResource.cpp +++ b/dom/media/CloneableWithRangeMediaResource.cpp @@ -108,17 +108,17 @@ class InputStreamReader final : public n lock.Wait(); } } } nsCOMPtr<nsIInputStream> mStream; nsCOMPtr<nsIAsyncInputStream> mAsyncStream; - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; }; NS_IMPL_ADDREF(InputStreamReader); NS_IMPL_RELEASE(InputStreamReader); NS_INTERFACE_MAP_BEGIN(InputStreamReader) NS_INTERFACE_MAP_ENTRY(nsIInputStreamCallback) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInputStreamCallback)
--- a/dom/media/FileBlockCache.h +++ b/dom/media/FileBlockCache.h @@ -135,17 +135,17 @@ class FileBlockCache : public MediaBlock void Close(); // Performs block writes and block moves on its own thread. void PerformBlockIOs(); // Mutex which controls access to mFD and mFDCurrentPos. Don't hold // mDataMutex while holding mFileMutex! mFileMutex must be owned // while accessing any of the following data fields or methods. - Mutex mFileMutex; + Mutex mFileMutex MOZ_UNANNOTATED; // Moves a block already committed to file. nsresult MoveBlockInFile(int32_t aSourceBlockIndex, int32_t aDestBlockIndex); // Seeks file pointer. nsresult Seek(int64_t aOffset); // Reads data from file offset. nsresult ReadFromFile(int64_t aOffset, uint8_t* aDest, int32_t aBytesToRead, int32_t& aBytesRead); nsresult WriteBlockToFile(int32_t aBlockIndex, const uint8_t* aBlockData); @@ -154,17 +154,17 @@ class FileBlockCache : public MediaBlock PRFileDesc* mFD; // The current file offset in the file. int64_t mFDCurrentPos; // Mutex which controls access to all data in this class, except mFD // and mFDCurrentPos. Don't hold mDataMutex while holding mFileMutex! // mDataMutex must be owned while accessing any of the following data // fields or methods. - Mutex mDataMutex; + Mutex mDataMutex MOZ_UNANNOTATED; // Ensures we either are running the event to preform IO, or an event // has been dispatched to preform the IO. // mDataMutex must be owned while calling this. void EnsureWriteScheduled(); // Array of block changes to made. If mBlockChanges[offset/BLOCK_SIZE] == // nullptr, then the block has no pending changes to be written, but if // mBlockChanges[offset/BLOCK_SIZE] != nullptr, then either there's a block
--- a/dom/media/FileMediaResource.h +++ b/dom/media/FileMediaResource.h @@ -104,17 +104,17 @@ class FileMediaResource : public BaseMed // Can be used from any thread. int64_t mSize; // This lock handles synchronisation between calls to Close() and // the Read, Seek, etc calls. Close must not be called while a // Read or Seek is in progress since it resets various internal // values to null. // This lock protects mSeekable, mInput, mSize, and mSizeInitialized. - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; // Seekable stream interface to file. This can be used from any // thread. nsCOMPtr<nsISeekableStream> mSeekable; // Input stream for the media data. This can be used from any // thread. nsCOMPtr<nsIInputStream> mInput;
--- a/dom/media/FrameStatistics.h +++ b/dom/media/FrameStatistics.h @@ -166,16 +166,16 @@ class FrameStatistics { private: FrameStatistics* mFrameStats; }; private: ~FrameStatistics() = default; // ReentrantMonitor to protect access of playback statistics. - mutable ReentrantMonitor mReentrantMonitor; + mutable ReentrantMonitor mReentrantMonitor MOZ_UNANNOTATED; FrameStatisticsData mFrameStatisticsData; }; } // namespace mozilla #endif // FrameStatistics_h_
--- a/dom/media/GraphDriver.h +++ b/dom/media/GraphDriver.h @@ -372,17 +372,17 @@ class GraphDriver { class MediaTrackGraphInitThreadRunnable; /** * This class is a driver that manages its own thread. */ class ThreadedDriver : public GraphDriver { class IterationWaitHelper { - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; // The below members are guarded by mMonitor. bool mNeedAnotherIteration = false; TimeStamp mWakeTime; public: IterationWaitHelper() : mMonitor("IterationWaitHelper::mMonitor") {} /**
--- a/dom/media/GraphRunner.h +++ b/dom/media/GraphRunner.h @@ -75,17 +75,17 @@ class GraphRunner final : public Runnabl IterationState& operator=(const IterationState& aOther) = default; GraphTime StateTime() const { return mStateTime; } GraphTime IterationEnd() const { return mIterationEnd; } AudioMixer* Mixer() const { return mMixer; } }; // Monitor used for yielding mThread through Wait(), and scheduling mThread // through Signal() from a GraphDriver. - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; // The MediaTrackGraph we're running. Weakptr beecause this graph owns us and // guarantees that our lifetime will not go beyond that of itself. MediaTrackGraphImpl* const mGraph; // State being handed over to the graph through OneIteration. Protected by // mMonitor. Maybe<IterationState> mIterationState; // Result from mGraph's OneIteration. Protected by mMonitor. IterationResult mIterationResult;
--- a/dom/media/MediaCache.cpp +++ b/dom/media/MediaCache.cpp @@ -438,17 +438,17 @@ class MediaCache { // This member is main-thread only. It's used to allocate unique // resource IDs to streams. int64_t mNextResourceID = 0; // The monitor protects all the data members here. Also, off-main-thread // readers that need to block will Wait() on this monitor. When new // data becomes available in the cache, we NotifyAll() on this monitor. - mozilla::Monitor mMonitor; + mozilla::Monitor mMonitor MOZ_UNANNOTATED; // This must always be accessed when the monitor is held. nsTArray<MediaCacheStream*> mStreams; // The Blocks describing the cache entries. nsTArray<Block> mIndex; RefPtr<MediaBlockCacheBase> mBlockCache; // The list of free blocks; they are not ordered. BlockList mFreeBlocks;
--- a/dom/media/MediaEventSource.h +++ b/dom/media/MediaEventSource.h @@ -470,17 +470,17 @@ class MediaEventSourceImpl { mListeners.RemoveElementAt(i); continue; } l->Dispatch(std::forward<Ts>(aEvents)...); } } private: - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; nsTArray<RefPtr<Listener>> mListeners; }; template <typename... Es> using MediaEventSource = MediaEventSourceImpl<ListenerPolicy::NonExclusive, Es...>; template <typename... Es>
--- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -713,17 +713,17 @@ class MediaFormatReader::DemuxerProxy::W TimeIntervals GetBuffered() override { MutexAutoLock lock(mMutex); return mBuffered; } void BreakCycles() override {} private: - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; const RefPtr<TaskQueue> mTaskQueue; const bool mGetSamplesMayBlock; const UniquePtr<TrackInfo> mInfo; // mTrackDemuxer is only ever accessed on demuxer's task queue. RefPtr<MediaTrackDemuxer> mTrackDemuxer; // All following members are protected by mMutex nsresult mNextRandomAccessPointResult = NS_OK; TimeUnit mNextRandomAccessPoint;
--- a/dom/media/MediaFormatReader.h +++ b/dom/media/MediaFormatReader.h @@ -387,17 +387,17 @@ class MediaFormatReader final // TaskQueue on which decoder can choose to decode. // Only non-null up until the decoder is created. RefPtr<TaskQueue> mTaskQueue; // Mutex protecting mDescription, mDecoder, mTrackDemuxer and mWorkingInfo // as those can be read outside the TaskQueue. // They are only written on the TaskQueue however, as such mMutex doesn't // need to be held when those members are read on the TaskQueue. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // The platform decoder. RefPtr<MediaDataDecoder> mDecoder; nsCString mDescription; void ShutdownDecoder(); // Only accessed from reader's task queue. bool mUpdateScheduled; bool mDemuxEOS;
--- a/dom/media/MediaManager.h +++ b/dom/media/MediaManager.h @@ -386,17 +386,17 @@ class MediaManager final : public nsIMed // Always exists const RefPtr<TaskQueue> mMediaThread; nsCOMPtr<nsIAsyncShutdownBlocker> mShutdownBlocker; // ONLY accessed from MediaManagerThread RefPtr<MediaEngine> mBackend; static StaticRefPtr<MediaManager> sSingleton; - static StaticMutex sSingletonMutex; + static StaticMutex sSingletonMutex MOZ_UNANNOTATED; // Connect/Disconnect on media thread only MediaEventListener mDeviceListChangeListener; MediaEventProducer<void> mDeviceListChangeEvent; public: RefPtr<media::Parent<media::NonE10s>> mNonE10sParent;
--- a/dom/media/MediaQueue.h +++ b/dom/media/MediaQueue.h @@ -174,17 +174,17 @@ class MediaQueue : private nsRefPtrDeque for (; i < GetSize(); ++i) { RefPtr<T> elem = nsRefPtrDeque<T>::ObjectAt(i); if (elem->GetEndTime().ToMicroseconds() > aTime) { aResult->AppendElement(elem); } } } - mutable RecursiveMutex mRecursiveMutex; + mutable RecursiveMutex mRecursiveMutex MOZ_UNANNOTATED; MediaEventProducer<RefPtr<T>> mPopFrontEvent; MediaEventProducer<RefPtr<T>> mPushEvent; MediaEventProducer<void> mFinishEvent; // True when we've decoded the last frame of data in the // bitstream for which we're queueing frame data. bool mEndOfStream; };
--- a/dom/media/MediaTimer.h +++ b/dom/media/MediaTimer.h @@ -90,17 +90,17 @@ class MediaTimer { // (i.e. the soonest). bool operator<(const Entry& aOther) const { return mTimeStamp > aOther.mTimeStamp; } }; nsCOMPtr<nsIEventTarget> mThread; std::priority_queue<Entry> mEntries; - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; nsCOMPtr<nsITimer> mTimer; TimeStamp mCurrentTimerTarget; // Timestamps only have relative meaning, so we need a base timestamp for // logging purposes. TimeStamp mCreationTimeStamp; int64_t RelativeMicroseconds(const TimeStamp& aTimeStamp) { return (int64_t)(aTimeStamp - mCreationTimeStamp).ToMicroseconds();
--- a/dom/media/MediaTrackGraph.h +++ b/dom/media/MediaTrackGraph.h @@ -728,17 +728,17 @@ class SourceMediaTrack : public MediaTra mUpdateTrack->mData->Clear(); } virtual void AdvanceTimeVaryingValuesToCurrentTime( GraphTime aCurrentTime, GraphTime aBlockedTime) override; // This must be acquired *before* MediaTrackGraphImpl's lock, if they are // held together. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // protected by mMutex float mVolume = 1.0; UniquePtr<TrackData> mUpdateTrack; nsTArray<RefPtr<DirectMediaTrackListener>> mDirectTrackListeners; }; /** * A ref-counted wrapper of a MediaTrack that allows multiple users to share a
--- a/dom/media/MediaTrackGraphImpl.h +++ b/dom/media/MediaTrackGraphImpl.h @@ -762,17 +762,17 @@ class MediaTrackGraphImpl : public Media }; AutoTArray<PendingResumeOperation, 1> mPendingResumeOperations; // mMonitor guards the data below. // MediaTrackGraph normally does its work without holding mMonitor, so it is // not safe to just grab mMonitor from some thread and start monkeying with // the graph. Instead, communicate with the graph thread using provided // mechanisms such as the ControlMessage queue. - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; // Data guarded by mMonitor (must always be accessed with mMonitor held, // regardless of the value of mLifecycleState). /** * State to copy to main thread */ nsTArray<TrackUpdate> mTrackUpdates;
--- a/dom/media/MemoryBlockCache.h +++ b/dom/media/MemoryBlockCache.h @@ -71,17 +71,17 @@ class MemoryBlockCache : public MediaBlo // Initial content length. const size_t mInitialContentLength; // Maximum number of blocks that this MemoryBlockCache expects. const size_t mMaxBlocks; // Mutex which controls access to all members below. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; nsTArray<uint8_t> mBuffer; bool mHasGrown = false; }; } // End namespace mozilla. #endif /* MEMORY_BLOCK_CACHE_H_ */
--- a/dom/media/VideoFrameContainer.h +++ b/dom/media/VideoFrameContainer.h @@ -112,17 +112,17 @@ class VideoFrameContainer { // the last call to Invalidate(). // The next call to Invalidate() will recalculate // and update the intrinsic size on the element, request a frame reflow and // then reset this flag. bool mIntrinsicSizeChanged = false; } mMainThreadState; // mMutex protects all the fields below. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // The intrinsic size is the ideal size which we should render the // ImageContainer's current Image at. // This can differ from the Image's actual size when the media resource // specifies that the Image should be stretched to have the correct aspect // ratio. gfx::IntSize mIntrinsicSize; // We maintain our own mFrameID which is auto-incremented at every // SetCurrentFrame() or NewFrameID() call.
--- a/dom/media/VideoOutput.h +++ b/dom/media/VideoOutput.h @@ -208,17 +208,17 @@ class VideoOutput : public DirectMediaTr v.AppendFrame(nullptr, gfx::IntSize(640, 480), PRINCIPAL_HANDLE_NONE, true, TimeStamp::Now()); mFrames.AppendElement(std::make_pair(NewFrameID(), *v.GetLastChunk())); } SendFramesEnsureLocked(); } } - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; TimeStamp mLastFrameTime; // Once the frame is forced to black, we initialize mBlackImage for use in any // following forced-black frames. RefPtr<Image> mBlackImage; bool mEnabled = true; // This array is accessed from both the direct video thread, and the graph // thread. Protected by mMutex. nsTArray<std::pair<ImageContainer::FrameID, VideoChunk>> mFrames;
--- a/dom/media/doctor/DDMediaLogs.h +++ b/dom/media/doctor/DDMediaLogs.h @@ -170,17 +170,17 @@ struct DDMediaLogs { mLinkName(aLinkName), mLinkingIndex(aLinkingIndex), mUnlinkingIndex(Nothing{}) {} }; // Links between live objects, updated while messages are processed. nsTArray<DDObjectLink> mObjectLinks; // Protects members below. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // Processing thread. nsCOMPtr<nsIThread> mThread; struct PendingPromise { MozPromiseHolder<LogMessagesPromise> mPromiseHolder; const dom::HTMLMediaElement* mMediaElement; };
--- a/dom/media/doctor/MultiWriterQueue.h +++ b/dom/media/doctor/MultiWriterQueue.h @@ -23,17 +23,17 @@ namespace mozilla { class MultiWriterQueueReaderLocking_Mutex { public: MultiWriterQueueReaderLocking_Mutex() : mMutex("MultiWriterQueueReaderLocking_Mutex") {} void Lock() { mMutex.Lock(); }; void Unlock() { mMutex.Unlock(); }; private: - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; }; // Reader non-locking strategy, trusting that PopAll will never be called // concurrently (e.g., by only calling it from a specific thread). class MultiWriterQueueReaderLocking_None { public: #ifndef DEBUG void Lock(){};
--- a/dom/media/doctor/test/gtest/TestMultiWriterQueue.cpp +++ b/dom/media/doctor/test/gtest/TestMultiWriterQueue.cpp @@ -325,17 +325,17 @@ struct DequeWrapperAW : DequeWrapperST { mWriting = false; return true; } }; // Multi-thread writes allowed, make sure you don't pop unless writes can't // happen. struct DequeWrapperMW : DequeWrapperST { - mozilla::Mutex mMutex; + mozilla::Mutex mMutex MOZ_UNANNOTATED; DequeWrapperMW() : mMutex("DequeWrapperMW/MT") {} bool Push(int i) { mozilla::MutexAutoLock lock(mMutex); mDQ.PushFront(reinterpret_cast<void*>(static_cast<uintptr_t>(i))); return true; }
--- a/dom/media/gmp/ChromiumCDMProxy.h +++ b/dom/media/gmp/ChromiumCDMProxy.h @@ -126,17 +126,17 @@ class ChromiumCDMProxy : public CDMProxy ~ChromiumCDMProxy(); // True if Shutdown() has been called. Should only be read and written on // main thread. bool mIsShutdown = false; RefPtr<GMPCrashHelper> mCrashHelper; - Mutex mCDMMutex; + Mutex mCDMMutex MOZ_UNANNOTATED; RefPtr<gmp::ChromiumCDMParent> mCDM; nsCOMPtr<nsISerialEventTarget> mGMPThread; UniquePtr<ChromiumCDMCallbackProxy> mCallback; }; } // namespace mozilla #endif // ChromiumCDMProxy_h_
--- a/dom/media/gmp/GMPPlatform.cpp +++ b/dom/media/gmp/GMPPlatform.cpp @@ -81,30 +81,30 @@ class GMPSyncRunnable final { } private: ~GMPSyncRunnable() = default; bool mDone; GMPTask* mTask; MessageLoop* mMessageLoop; - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; }; class GMPThreadImpl : public GMPThread { public: GMPThreadImpl(); virtual ~GMPThreadImpl(); // GMPThread void Post(GMPTask* aTask) override; void Join() override; private: - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; base::Thread mThread; }; GMPErr CreateThread(GMPThread** aThread) { if (!aThread) { return GMPGenericErr; } @@ -143,17 +143,17 @@ class GMPMutexImpl : public GMPMutex { virtual ~GMPMutexImpl(); // GMPMutex void Acquire() override; void Release() override; void Destroy() override; private: - ReentrantMonitor mMonitor; + ReentrantMonitor mMonitor MOZ_UNANNOTATED; }; GMPErr CreateMutex(GMPMutex** aMutex) { if (!aMutex) { return GMPGenericErr; } *aMutex = new GMPMutexImpl();
--- a/dom/media/gmp/GMPService.h +++ b/dom/media/gmp/GMPService.h @@ -101,18 +101,19 @@ class GeckoMediaPluginService : public m nsresult GMPDispatch(nsIRunnable* event, uint32_t flags = NS_DISPATCH_NORMAL); nsresult GMPDispatch(already_AddRefed<nsIRunnable> event, uint32_t flags = NS_DISPATCH_NORMAL); void ShutdownGMPThread(); static nsCOMPtr<nsIAsyncShutdownClient> GetShutdownBarrier(); - Mutex mMutex; // Protects mGMPThread, mPluginCrashHelpers, - // mGMPThreadShutdown and some members in derived classes. + Mutex mMutex MOZ_UNANNOTATED; // Protects mGMPThread, mPluginCrashHelpers, + // mGMPThreadShutdown and some members in + // derived classes. const nsCOMPtr<nsISerialEventTarget> mMainThread; nsCOMPtr<nsIThread> mGMPThread; bool mGMPThreadShutdown; bool mShuttingDownOnGMPThread; Atomic<bool> mXPCOMWillShutdown;
--- a/dom/media/gmp/GMPServiceParent.h +++ b/dom/media/gmp/GMPServiceParent.h @@ -206,17 +206,17 @@ class GeckoMediaPluginServiceParent fina nsClassHashtable<nsUint32HashKey, nsCString> mTempNodeIds; // Hashes node id to whether that node id is allowed to store data // persistently on disk. nsTHashMap<nsCStringHashKey, bool> mPersistentStorageAllowed; // Synchronization for barrier that ensures we've loaded GMPs from // MOZ_GMP_PATH before allowing GetContentParentFrom() to proceed. - Monitor mInitPromiseMonitor; + Monitor mInitPromiseMonitor MOZ_UNANNOTATED; MozMonitoredPromiseHolder<GenericPromise> mInitPromise; bool mLoadPluginsFromDiskComplete; // Hashes nodeId to the hashtable of storage for that nodeId. nsRefPtrHashtable<nsCStringHashKey, GMPStorage> mTempGMPStorage; // Tracks how many IPC connections to GMPServices running in content // processes we have. When this is empty we can safely shut down.
--- a/dom/media/gmp/GMPStorageChild.h +++ b/dom/media/gmp/GMPStorageChild.h @@ -79,17 +79,17 @@ class GMPStorageChild : public PGMPStora mozilla::ipc::IPCResult RecvReadComplete(const nsCString& aRecordName, const GMPErr& aStatus, nsTArray<uint8_t>&& aBytes); mozilla::ipc::IPCResult RecvWriteComplete(const nsCString& aRecordName, const GMPErr& aStatus); mozilla::ipc::IPCResult RecvShutdown(); private: - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; nsRefPtrHashtable<nsCStringHashKey, GMPRecordImpl> mRecords; GMPChild* mPlugin; bool mShutdown; }; } // namespace gmp } // namespace mozilla
--- a/dom/media/gtest/MockCubeb.h +++ b/dom/media/gtest/MockCubeb.h @@ -177,17 +177,17 @@ class MockCubebStream { cubeb* context = nullptr; const bool mHasInput; const bool mHasOutput; SmartMockCubebStream* const mSelf; private: // Monitor used to block start until mFrozenStart is false. - Monitor mFrozenStartMonitor; + Monitor mFrozenStartMonitor MOZ_UNANNOTATED; // Whether this stream should wait for an explicit start request before // starting. Protected by FrozenStartMonitor. bool mFrozenStart; // Signal to the audio thread that stream is stopped. std::atomic_bool mStreamStop{true}; // Whether or not the output-side of this stream (what is written from the // callback output buffer) is recorded in an internal buffer. The data is then // available via `GetRecordedOutput`.
--- a/dom/media/gtest/TestCDMStorage.cpp +++ b/dom/media/gtest/TestCDMStorage.cpp @@ -1145,17 +1145,17 @@ class CDMStorageTest { : mMessage(aMessage), mContinuation(aContinuation) {} nsCString mMessage; nsCOMPtr<nsIRunnable> mContinuation; }; nsTArray<ExpectedMessage> mExpected; RefPtr<gmp::ChromiumCDMParent> mCDM; - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; Atomic<bool> mFinished; nsCString mNodeId; class CallbackProxy : public ChromiumCDMCallback { public: explicit CallbackProxy(CDMStorageTest* aRunner) : mRunner(aRunner) {} void SetSessionId(uint32_t aPromiseId,
--- a/dom/media/gtest/TestWebMBuffered.cpp +++ b/dom/media/gtest/TestWebMBuffered.cpp @@ -16,17 +16,17 @@ using namespace mozilla; // expects in-order timecodes per the WebM spec. The remaining 6 // SimpleBlocks have the following attributes: static const uint64_t gTimecodes[] = {66000000, 160000000, 166000000, 200000000, 233000000, 320000000}; static const int64_t gEndOffsets[] = {501, 772, 1244, 1380, 1543, 2015}; TEST(WebMBuffered, BasicTests) { - ReentrantMonitor dummy("dummy"); + ReentrantMonitor dummy MOZ_UNANNOTATED("dummy"); WebMBufferedParser parser(0); nsTArray<WebMTimeDataOffset> mapping; parser.Append(nullptr, 0, mapping, dummy); EXPECT_TRUE(mapping.IsEmpty()); EXPECT_EQ(parser.mStartOffset, 0); EXPECT_EQ(parser.mCurrentOffset, 0); @@ -55,17 +55,17 @@ static void ReadFile(const char* aPath, ASSERT_EQ(got, size_t(size)); r = fclose(f); ASSERT_EQ(r, 0); } TEST(WebMBuffered, RealData) { - ReentrantMonitor dummy("dummy"); + ReentrantMonitor dummy MOZ_UNANNOTATED("dummy"); WebMBufferedParser parser(0); nsTArray<uint8_t> webmData; ReadFile("test.webm", webmData); nsTArray<WebMTimeDataOffset> mapping; parser.Append(webmData.Elements(), webmData.Length(), mapping, dummy); EXPECT_EQ(mapping.Length(), 6u); @@ -77,17 +77,17 @@ TEST(WebMBuffered, RealData) EXPECT_EQ(mapping[i].mEndOffset, gEndOffsets[i]); EXPECT_EQ(mapping[i].mSyncOffset, 361); EXPECT_EQ(mapping[i].mTimecode, gTimecodes[i]); } } TEST(WebMBuffered, RealDataAppend) { - ReentrantMonitor dummy("dummy"); + ReentrantMonitor dummy MOZ_UNANNOTATED("dummy"); WebMBufferedParser parser(0); nsTArray<WebMTimeDataOffset> mapping; nsTArray<uint8_t> webmData; ReadFile("test.webm", webmData); uint32_t arrayEntries = mapping.Length(); size_t offset = 0;
--- a/dom/media/hls/HLSDecoder.cpp +++ b/dom/media/hls/HLSDecoder.cpp @@ -39,17 +39,17 @@ class HLSResourceCallbacksSupport explicit HLSResourceCallbacksSupport(HLSDecoder* aResource); void Detach(); void OnLoad(jni::String::Param aUrl); void OnDataArrived(); void OnError(int aErrorCode); private: ~HLSResourceCallbacksSupport() {} - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; HLSDecoder* mDecoder; }; HLSResourceCallbacksSupport::HLSResourceCallbacksSupport(HLSDecoder* aDecoder) : mMutex("HLSResourceCallbacksSupport"), mDecoder(aDecoder) { MOZ_ASSERT(mDecoder); }
--- a/dom/media/hls/HLSDemuxer.cpp +++ b/dom/media/hls/HLSDemuxer.cpp @@ -114,17 +114,17 @@ class HLSDemuxer::HLSDemuxerCallbacksSup Unused << rv; } void Detach() { MutexAutoLock lock(mMutex); mDemuxer = nullptr; } - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; private: ~HLSDemuxerCallbacksSupport() {} HLSDemuxer* mDemuxer; }; HLSDemuxer::HLSDemuxer(int aPlayerId) : mTaskQueue(new TaskQueue(GetMediaThreadPool(MediaThreadType::SUPERVISOR),
--- a/dom/media/hls/HLSDemuxer.h +++ b/dom/media/hls/HLSDemuxer.h @@ -122,15 +122,15 @@ class HLSTrackDemuxer : public MediaTrac RefPtr<HLSDemuxer> mParent; TrackInfo::TrackType mType; Maybe<media::TimeUnit> mNextKeyframeTime; int32_t mLastFormatIndex = -1; // Queued samples extracted by the demuxer, but not yet returned. RefPtr<MediaRawData> mQueuedSample; // Mutex to protect members below across multiple threads. - mutable Mutex mMutex; + mutable Mutex mMutex MOZ_UNANNOTATED; UniquePtr<TrackInfo> mTrackInfo; }; } // namespace mozilla #endif
--- a/dom/media/mediasource/ContainerParser.cpp +++ b/dom/media/mediasource/ContainerParser.cpp @@ -111,17 +111,17 @@ class WebMContainerParser MediaResult IsInitSegmentPresent(const MediaSpan& aData) override { ContainerParser::IsInitSegmentPresent(aData); if (aData.Length() < 4) { return NS_ERROR_NOT_AVAILABLE; } WebMBufferedParser parser(0); nsTArray<WebMTimeDataOffset> mapping; - ReentrantMonitor dummy("dummy"); + ReentrantMonitor dummy MOZ_ANNOTATED("dummy"); bool result = parser.Append(aData.Elements(), aData.Length(), mapping, dummy); if (!result) { return MediaResult(NS_ERROR_FAILURE, RESULT_DETAIL("Invalid webm content")); } return parser.mInitEndOffset > 0 ? NS_OK : NS_ERROR_NOT_AVAILABLE; } @@ -129,17 +129,17 @@ class WebMContainerParser MediaResult IsMediaSegmentPresent(const MediaSpan& aData) override { ContainerParser::IsMediaSegmentPresent(aData); if (aData.Length() < 4) { return NS_ERROR_NOT_AVAILABLE; } WebMBufferedParser parser(0); nsTArray<WebMTimeDataOffset> mapping; - ReentrantMonitor dummy("dummy"); + ReentrantMonitor dummy MOZ_ANNOTATED("dummy"); parser.AppendMediaSegmentOnly(); bool result = parser.Append(aData.Elements(), aData.Length(), mapping, dummy); if (!result) { return MediaResult(NS_ERROR_FAILURE, RESULT_DETAIL("Invalid webm content")); } return parser.GetClusterOffset() >= 0 ? NS_OK : NS_ERROR_NOT_AVAILABLE; @@ -177,17 +177,17 @@ class WebMContainerParser mGlobalOffset = mTotalParsed; } // XXX if it only adds new mappings, overlapped but not available // (e.g. overlap < 0) frames are "lost" from the reported mappings here. nsTArray<WebMTimeDataOffset> mapping; mapping.AppendElements(mOverlappedMapping); mOverlappedMapping.Clear(); - ReentrantMonitor dummy("dummy"); + ReentrantMonitor dummy MOZ_ANNOTATED("dummy"); mParser.Append(aData.Elements(), aData.Length(), mapping, dummy); if (mResource) { mResource->AppendData(aData); } // XXX This is a bit of a hack. Assume if there are no timecodes // present and it's an init segment that it's _just_ an init segment. // We should be more precise.
--- a/dom/media/mediasource/MediaSourceDemuxer.h +++ b/dom/media/mediasource/MediaSourceDemuxer.h @@ -78,17 +78,17 @@ class MediaSourceDemuxer : public MediaD RefPtr<TaskQueue> mTaskQueue; nsTArray<RefPtr<MediaSourceTrackDemuxer>> mDemuxers; nsTArray<RefPtr<TrackBuffersManager>> mSourceBuffers; MozPromiseHolder<InitPromise> mInitPromise; // Monitor to protect members below across multiple threads. - mutable Monitor mMonitor; + mutable Monitor mMonitor MOZ_UNANNOTATED; RefPtr<TrackBuffersManager> mAudioTrack; RefPtr<TrackBuffersManager> mVideoTrack; MediaInfo mInfo; }; class MediaSourceTrackDemuxer : public MediaTrackDemuxer, public DecoderDoctorLifeLogger<MediaSourceTrackDemuxer> { @@ -133,17 +133,17 @@ class MediaSourceTrackDemuxer const media::TimeUnit& aTimeThreadshold); already_AddRefed<MediaRawData> GetSample(MediaResult& aError); // Return the timestamp of the next keyframe after mLastSampleIndex. media::TimeUnit GetNextRandomAccessPoint(); RefPtr<MediaSourceDemuxer> mParent; TrackInfo::TrackType mType; // Monitor protecting members below accessed from multiple threads. - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; media::TimeUnit mNextRandomAccessPoint; // Would be accessed in MFR's demuxer proxy task queue and TaskQueue, and // only be set on the TaskQueue. It can be accessed while on TaskQueue without // the need for the lock. RefPtr<TrackBuffersManager> mManager; // Only accessed on TaskQueue Maybe<RefPtr<MediaRawData>> mNextSample;
--- a/dom/media/mediasource/TrackBuffersManager.h +++ b/dom/media/mediasource/TrackBuffersManager.h @@ -509,17 +509,17 @@ class TrackBuffersManager final enum class EvictionState { NO_EVICTION_NEEDED, EVICTION_NEEDED, EVICTION_COMPLETED, }; Atomic<EvictionState> mEvictionState; // Monitor to protect following objects accessed across multiple threads. - mutable Mutex mMutex; + mutable Mutex mMutex MOZ_UNANNOTATED; // mTaskQueue is only ever written after construction on the task queue. // As such, it can be accessed while on task queue without the need for the // mutex. RefPtr<TaskQueue> mTaskQueue; // Stable audio and video track time ranges. media::TimeIntervals mVideoBufferedRanges; media::TimeIntervals mAudioBufferedRanges; // MediaInfo of the first init segment read.
--- a/dom/media/ogg/OggCodecStore.h +++ b/dom/media/ogg/OggCodecStore.h @@ -24,14 +24,14 @@ class OggCodecStore { OggCodecState* Get(uint32_t serial); bool IsKnownStream(uint32_t aSerial); private: // Maps Ogg serialnos to OggStreams. nsClassHashtable<nsUint32HashKey, OggCodecState> mCodecStates; // Protects the |mCodecStates| and the |mKnownStreams| members. - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; }; } // namespace mozilla #endif
--- a/dom/media/platforms/AllocationPolicy.h +++ b/dom/media/platforms/AllocationPolicy.h @@ -52,17 +52,17 @@ class AllocPolicy { */ class GlobalAllocPolicy { public: // Get the singleton for the given track type. Thread-safe. static NotNull<AllocPolicy*> Instance(TrackInfo::TrackType aTrack); private: // Protect access to Instance(). - static StaticMutex sMutex; + static StaticMutex sMutex MOZ_UNANNOTATED; }; /** This the actual base implementation underneath all AllocPolicy objects and * control how many decoders can be created concurrently. * Alloc() must be called to get a token object as a permission to perform an * action. The token should stay alive until Shutdown() is called on the * decoder. The destructor of the token will restore the decoder count so it is * available for next calls of Alloc(). @@ -81,17 +81,17 @@ class AllocPolicyImpl : public AllocPoli class AutoDeallocToken; using PromisePrivate = Promise::Private; // Called by the destructor of TokenImpl to restore the decoder limit. void Dealloc(); // Decrement the decoder limit and resolve a promise if available. void ResolvePromise(ReentrantMonitorAutoEnter& aProofOfLock); const int mMaxDecoderLimit; - ReentrantMonitor mMonitor; + ReentrantMonitor mMonitor MOZ_UNANNOTATED; // The number of decoders available for creation. int mDecoderLimit; // Requests to acquire tokens. std::queue<RefPtr<PromisePrivate>> mPromises; }; /** * This class allows to track and serialise a single decoder allocation at a
--- a/dom/media/platforms/PDMFactory.cpp +++ b/dom/media/platforms/PDMFactory.cpp @@ -143,17 +143,17 @@ class PDMInitializer final { FFVPXRuntimeLinker::Init(); #endif #ifdef MOZ_FFMPEG FFmpegRuntimeLinker::Init(); #endif } static bool sHasInitializedPDMs; - static StaticMutex sMonitor; + static StaticMutex sMonitor MOZ_UNANNOTATED; }; bool PDMInitializer::sHasInitializedPDMs = false; StaticMutex PDMInitializer::sMonitor; /* static */ void PDMInitializer::InitPDMs() { StaticMutexAutoLock mon(sMonitor);
--- a/dom/media/platforms/SimpleMap.h +++ b/dom/media/platforms/SimpleMap.h @@ -41,15 +41,15 @@ class SimpleMap { } // Remove all elements of the map. void Clear() { MutexAutoLock lock(mMutex); mMap.Clear(); } private: - Mutex mMutex; // To protect mMap. + Mutex mMutex MOZ_UNANNOTATED; // To protect mMap. AutoTArray<Element, 16> mMap; }; } // namespace mozilla #endif // mozilla_SimpleMap_h
--- a/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.h +++ b/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.h @@ -46,17 +46,17 @@ class SamplesWaitingForKey { void Flush(); void BreakCycles(); protected: ~SamplesWaitingForKey(); private: - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; RefPtr<CDMProxy> mProxy; struct SampleEntry { RefPtr<MediaRawData> mSample; MozPromiseHolder<WaitForKeyPromise> mPromise; }; nsTArray<SampleEntry> mSamples; const TrackInfo::TrackType mType; const std::function<MediaEventProducer<TrackInfo::TrackType>*()>
--- a/dom/media/platforms/apple/AppleVTDecoder.h +++ b/dom/media/platforms/apple/AppleVTDecoder.h @@ -107,17 +107,17 @@ class AppleVTDecoder : public MediaDataD const RefPtr<layers::ImageContainer> mImageContainer; const RefPtr<layers::KnowsCompositor> mKnowsCompositor; const bool mUseSoftwareImages; // Set on reader/decode thread calling Flush() to indicate that output is // not required and so input samples on mTaskQueue need not be processed. Atomic<bool> mIsFlushing; // Protects mReorderQueue and mPromise. - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; ReorderQueue mReorderQueue; MozMonitoredPromiseHolder<DecodePromise> mPromise; // Decoded frame will be dropped if its pts is smaller than this // value. It shold be initialized before Input() or after Flush(). So it is // safe to access it in OutputFrame without protecting. Maybe<media::TimeUnit> mSeekTargetThreshold;
--- a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.h +++ b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.h @@ -60,18 +60,19 @@ class FFmpegDataDecoder<LIBAV_VER> // mCodecContext is accessed on taskqueue only, no locking needed AVCodecContext* mCodecContext; AVCodecParserContext* mCodecParser; AVFrame* mFrame; RefPtr<MediaByteBuffer> mExtraData; AVCodecID mCodecID; // set in constructor protected: - static StaticMutex sMutex; // used to provide critical-section locking - // for calls into ffmpeg + static StaticMutex sMutex + MOZ_UNANNOTATED; // used to provide critical-section locking + // for calls into ffmpeg const RefPtr<TaskQueue> mTaskQueue; // set in constructor private: RefPtr<DecodePromise> ProcessDecode(MediaRawData* aSample); RefPtr<DecodePromise> ProcessDrain(); virtual MediaResult DoDecode(MediaRawData* aSample, uint8_t* aData, int aSize, bool* aGotFrame, MediaDataDecoder::DecodedData& aOutResults) = 0;
--- a/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h +++ b/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h @@ -126,17 +126,17 @@ class VideoFramePool final { AVFrame* aAVFrame, FFmpegLibWrapper* aLib); void ReleaseUnusedVAAPIFrames(); private: RefPtr<VideoFrameSurface> GetFreeVideoFrameSurface(); private: // Protect mDMABufSurfaces pool access - Mutex mSurfaceLock; + Mutex mSurfaceLock MOZ_UNANNOTATED; nsTArray<RefPtr<VideoFrameSurfaceVAAPI>> mDMABufSurfaces; // We may fail to create texture over DMABuf memory due to driver bugs so // check that before we export first DMABuf video frame. Maybe<bool> mTextureCreationWorks; }; } // namespace mozilla
--- a/dom/media/platforms/wmf/DXVA2Manager.cpp +++ b/dom/media/platforms/wmf/DXVA2Manager.cpp @@ -936,17 +936,17 @@ D3D11DXVA2Manager::CopyToImage(IMFSample [&]() -> void { hr = mTransform->Output(&sample); }); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); } perfRecorder.End(); } if (!mutex && mDevice != DeviceManagerDx::Get()->GetCompositorDevice() && mSyncObject) { - static StaticMutex sMutex; + static StaticMutex sMutex MOZ_UNANNOTATED; // Ensure that we only ever attempt to synchronise via the sync object // serially as when using the same D3D11 device for multiple video decoders // it can lead to deadlocks. StaticMutexAutoLock lock(sMutex); // It appears some race-condition may allow us to arrive here even when // mSyncObject is null. It's better to avoid that crash. client->SyncWithObject(mSyncObject); if (!mSyncObject->Synchronize(true)) {
--- a/dom/media/platforms/wmf/DXVA2Manager.h +++ b/dom/media/platforms/wmf/DXVA2Manager.h @@ -68,17 +68,17 @@ class DXVA2Manager { virtual ~DXVA2Manager(); virtual bool SupportsConfig(IMFMediaType* aType, float aFramerate) = 0; static bool IsNV12Supported(uint32_t aVendorID, uint32_t aDeviceID, const nsAString& aDriverVersionString); protected: - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; DXVA2Manager(); bool IsUnsupportedResolution(const uint32_t& aWidth, const uint32_t& aHeight, const float& aFramerate) const; bool mIsAMDPreUVD4 = false; };
--- a/dom/media/platforms/wmf/WMFDecoderModule.cpp +++ b/dom/media/platforms/wmf/WMFDecoderModule.cpp @@ -237,17 +237,17 @@ already_AddRefed<MediaDataDecoder> WMFDe manager->GetDescriptionName().get()); RefPtr<MediaDataDecoder> decoder = new WMFMediaDataDecoder(manager.release()); return decoder.forget(); } template <const GUID& aGuid> static bool CanCreateWMFDecoder() { - static StaticMutex sMutex; + static StaticMutex sMutex MOZ_UNANNOTATED; StaticMutexAutoLock lock(sMutex); static Maybe<bool> result; if (result.isNothing()) { result.emplace(CanCreateMFTDecoder(aGuid)); } return result.value(); }
--- a/dom/media/systemservices/CamerasChild.h +++ b/dom/media/systemservices/CamerasChild.h @@ -226,33 +226,33 @@ class CamerasChild final : public PCamer void AddCallback(const CaptureEngine aCapEngine, const int capture_id, FrameRelay* render); void RemoveCallback(const CaptureEngine aCapEngine, const int capture_id); void ShutdownParent(); void ShutdownChild(); nsTArray<CapturerElement> mCallbacks; // Protects the callback arrays - Mutex mCallbackMutex; + Mutex mCallbackMutex MOZ_UNANNOTATED; bool mIPCIsAlive; // Hold to prevent multiple outstanding requests. We don't use // request IDs so we only support one at a time. Don't want try // to use the webrtc.org API from multiple threads simultanously. // The monitor below isn't sufficient for this, as it will drop // the lock when Wait-ing for a response, allowing us to send a new // request. The Notify on receiving the response will then unblock // both waiters and one will be guaranteed to get the wrong result. // Take this one before taking mReplyMonitor. - Mutex mRequestMutex; + Mutex mRequestMutex MOZ_UNANNOTATED; // Hold to wait for an async response to our calls *and* until the // user of LockAndDispatch<> has read the data out. This is done by // keeping the LockAndDispatch object alive. - Monitor mReplyMonitor; + Monitor mReplyMonitor MOZ_UNANNOTATED; // Async response valid? bool mReceivedReply; // Async responses data contents; bool mReplySuccess; const int mZero; int mReplyInteger; webrtc::VideoCaptureCapability* mReplyCapability = nullptr; nsCString mReplyDeviceName;
--- a/dom/media/systemservices/MediaSystemResourceManager.cpp +++ b/dom/media/systemservices/MediaSystemResourceManager.cpp @@ -54,17 +54,17 @@ void MediaSystemResourceManager::Init() timesCreated++; MOZ_ASSERT(timesCreated == 1); #endif sSingleton = new MediaSystemResourceManager(); } return; } - ReentrantMonitor barrier("MediaSystemResourceManager::Init"); + ReentrantMonitor barrier MOZ_UNANNOTATED("MediaSystemResourceManager::Init"); ReentrantMonitorAutoEnter mainThreadAutoMon(barrier); bool done = false; RefPtr<Runnable> runnable = NS_NewRunnableFunction("MediaSystemResourceManager::Init", [&]() { if (!sSingleton) { sSingleton = new MediaSystemResourceManager(); } @@ -186,17 +186,18 @@ void MediaSystemResourceManager::Acquire aClient->mId)); } bool MediaSystemResourceManager::AcquireSyncNoWait( MediaSystemResourceClient* aClient) { MOZ_ASSERT(aClient); MOZ_ASSERT(!InImageBridgeChildThread()); - ReentrantMonitor barrier("MediaSystemResourceManager::AcquireSyncNoWait"); + ReentrantMonitor barrier MOZ_UNANNOTATED( + "MediaSystemResourceManager::AcquireSyncNoWait"); ReentrantMonitorAutoEnter autoMon(barrier); bool done = false; { ReentrantMonitorAutoEnter mon(mReentrantMonitor); MediaSystemResourceClient* client = mResourceClients.Get(aClient->mId); MOZ_ASSERT(client); MOZ_ASSERT(client == aClient);
--- a/dom/media/systemservices/MediaSystemResourceManager.h +++ b/dom/media/systemservices/MediaSystemResourceManager.h @@ -60,17 +60,17 @@ class MediaSystemResourceManager { bool IsIpcClosed(); void DoAcquire(uint32_t aId); void DoRelease(uint32_t aId); void HandleAcquireResult(uint32_t aId, bool aSuccess); - ReentrantMonitor mReentrantMonitor; + ReentrantMonitor mReentrantMonitor MOZ_UNANNOTATED; bool mShutDown; media::MediaSystemResourceManagerChild* mChild; nsTHashMap<nsUint32HashKey, MediaSystemResourceClient*> mResourceClients; static StaticRefPtr<MediaSystemResourceManager> sSingleton;
--- a/dom/media/systemservices/MediaUtils.h +++ b/dom/media/systemservices/MediaUtils.h @@ -220,17 +220,17 @@ class ShutdownBlockingTicket { template <typename ResolveValueType, typename RejectValueType, typename ResolveFunction, typename RejectFunction> void Await(already_AddRefed<nsIEventTarget> aPool, RefPtr<MozPromise<ResolveValueType, RejectValueType, true>> aPromise, ResolveFunction&& aResolveFunction, RejectFunction&& aRejectFunction) { RefPtr<TaskQueue> taskQueue = new TaskQueue(std::move(aPool), "MozPromiseAwait"); - Monitor mon(__func__); + Monitor mon MOZ_UNANNOTATED(__func__); bool done = false; aPromise->Then( taskQueue, __func__, [&](ResolveValueType&& aResolveValue) { MonitorAutoLock lock(mon); aResolveFunction(std::forward<ResolveValueType>(aResolveValue)); done = true; @@ -251,17 +251,17 @@ void Await(already_AddRefed<nsIEventTarg template <typename ResolveValueType, typename RejectValueType, bool Excl> typename MozPromise<ResolveValueType, RejectValueType, Excl>::ResolveOrRejectValue Await(already_AddRefed<nsIEventTarget> aPool, RefPtr<MozPromise<ResolveValueType, RejectValueType, Excl>> aPromise) { RefPtr<TaskQueue> taskQueue = new TaskQueue(std::move(aPool), "MozPromiseAwait"); - Monitor mon(__func__); + Monitor mon MOZ_UNANNOTATED(__func__); bool done = false; typename MozPromise<ResolveValueType, RejectValueType, Excl>::ResolveOrRejectValue val; aPromise->Then( taskQueue, __func__, [&](ResolveValueType aResolveValue) { val.SetResolve(std::move(aResolveValue)); @@ -395,17 +395,17 @@ class AsyncBlockers { return; } if (!mBlockers.empty()) { return; } mPromise->Resolve(true, __func__); mResolved = true; } - Mutex mLock; // protects mBlockers and mResolved. + Mutex mLock MOZ_UNANNOTATED; // protects mBlockers and mResolved. std::map<void*, bool> mBlockers; bool mResolved = false; const RefPtr<GenericPromise::Private> mPromise; }; } // namespace mozilla #endif // mozilla_MediaUtils_h
--- a/dom/media/systemservices/OSXRunLoopSingleton.cpp +++ b/dom/media/systemservices/OSXRunLoopSingleton.cpp @@ -7,17 +7,17 @@ #include <mozilla/StaticMutex.h> #include <AudioUnit/AudioUnit.h> #include <CoreAudio/AudioHardware.h> #include <CoreAudio/HostTime.h> #include <CoreFoundation/CoreFoundation.h> static bool gRunLoopSet = false; -static mozilla::StaticMutex gMutex; +static mozilla::StaticMutex gMutex MOZ_UNANNOTATED; void mozilla_set_coreaudio_notification_runloop_if_needed() { mozilla::StaticMutexAutoLock lock(gMutex); if (gRunLoopSet) { return; } /* This is needed so that AudioUnit listeners get called on this thread, and
--- a/dom/media/systemservices/OpenSLESProvider.h +++ b/dom/media/systemservices/OpenSLESProvider.h @@ -45,17 +45,17 @@ class OpenSLESProvider { SLresult GetEngine(SLObjectItf* aObjectm, SLuint32 aOptionCount, const SLEngineOption* aOptions); SLresult ConstructEngine(SLObjectItf* aObjectm, SLuint32 aOptionCount, const SLEngineOption* aOptions); SLresult RealizeEngine(SLObjectItf aObjectm); void DestroyEngine(SLObjectItf* aObjectm); // Protect all our internal variables - mozilla::Mutex mLock; + mozilla::Mutex mLock MOZ_UNANNOTATED; SLObjectItf mSLEngine; int mSLEngineUsers; bool mIsRealized; void* mOpenSLESLib; }; } // namespace mozilla #endif // cplusplus
--- a/dom/media/systemservices/ShmemPool.h +++ b/dom/media/systemservices/ShmemPool.h @@ -164,17 +164,17 @@ class ShmemPool final { return (aPolicy == AllocationPolicy::Default && aInstance->AllocShmem(aSize, ipc::SharedMemory::TYPE_BASIC, &aRes.mShmem)) || (aPolicy == AllocationPolicy::Unsafe && aInstance->AllocUnsafeShmem(aSize, ipc::SharedMemory::TYPE_BASIC, &aRes.mShmem)); } const PoolType mPoolType; - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; size_t mPoolFree; bool mErrorLogged; #ifdef DEBUG size_t mMaxPoolUse; #endif nsTArray<ShmemBuffer> mShmemPool; };
--- a/dom/media/systemservices/video_engine/tab_capturer.h +++ b/dom/media/systemservices/video_engine/tab_capturer.h @@ -56,17 +56,17 @@ class TabCapturer { NS_IMETHOD Run() override; const RefPtr<TabCapturer> mVideoSource; }; private: // Used to protect mCallback, since TabCapturer's lifetime might be // longer than mCallback's on stop/shutdown, and we may be waiting on a // tab to finish capturing on MainThread. - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; webrtc::DesktopCapturer::Callback* mCallback = nullptr; uint64_t mBrowserId = 0; bool mCapturing = false; RTC_DISALLOW_COPY_AND_ASSIGN(TabCapturer); };
--- a/dom/media/webaudio/AudioBuffer.cpp +++ b/dom/media/webaudio/AudioBuffer.cpp @@ -67,17 +67,17 @@ class AudioBufferMemoryTracker : public static AudioBufferMemoryTracker* GetInstance(); /* Those methods must be called with the lock held. */ void RegisterAudioBufferInternal(const AudioBuffer* aAudioBuffer); /* Returns the number of buffers still present in the hash table. */ uint32_t UnregisterAudioBufferInternal(const AudioBuffer* aAudioBuffer); void Init(); /* This protects all members of this class. */ - static StaticMutex sMutex; + static StaticMutex sMutex MOZ_UNANNOTATED; static StaticRefPtr<AudioBufferMemoryTracker> sSingleton; nsTHashSet<const AudioBuffer*> mBuffers; }; StaticRefPtr<AudioBufferMemoryTracker> AudioBufferMemoryTracker::sSingleton; StaticMutex AudioBufferMemoryTracker::sMutex; NS_IMPL_ISUPPORTS(AudioBufferMemoryTracker, nsIMemoryReporter);
--- a/dom/media/webaudio/ScriptProcessorNode.cpp +++ b/dom/media/webaudio/ScriptProcessorNode.cpp @@ -75,17 +75,17 @@ class SharedBuffers final { } private: typedef std::deque<AudioChunk> BufferList; // Synchronizes access to mBufferList. Note that it's the responsibility // of the callers to perform the required locking, and we assert that every // time we access mBufferList. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // The list representing the queue. BufferList mBufferList; }; public: explicit SharedBuffers(float aSampleRate) : mOutputQueue("SharedBuffers::outputQueue"), mDelaySoFar(TRACK_TIME_MAX),
--- a/dom/media/webaudio/blink/HRTFDatabaseLoader.h +++ b/dom/media/webaudio/blink/HRTFDatabaseLoader.h @@ -138,17 +138,17 @@ class HRTFDatabaseLoader { // Keeps track of loaders on a per-sample-rate basis. static nsTHashtable<LoaderByRateEntry>* s_loaderMap; // singleton mozilla::Atomic<int> m_refCnt; nsAutoRef<HRTFDatabase> m_hrtfDatabase; // Holding a m_threadLock is required when accessing m_databaseLoaderThread. - mozilla::Mutex m_threadLock; + mozilla::Mutex m_threadLock MOZ_UNANNOTATED; PRThread* m_databaseLoaderThread; float m_databaseSampleRate; mozilla::Atomic<bool> m_databaseLoaded; }; } // namespace WebCore
--- a/dom/media/webaudio/blink/ReverbConvolver.h +++ b/dom/media/webaudio/blink/ReverbConvolver.h @@ -78,17 +78,17 @@ class ReverbConvolver { ReverbAccumulationBuffer m_accumulationBuffer; // One or more background threads read from this input buffer which is fed // from the realtime thread. ReverbInputBuffer m_inputBuffer; // Background thread and synchronization base::Thread m_backgroundThread; - mozilla::Monitor m_backgroundThreadMonitor; + mozilla::Monitor m_backgroundThreadMonitor MOZ_UNANNOTATED; bool m_useBackgroundThreads; std::atomic<bool> m_wantsToExit; std::atomic<bool> m_moreInputBuffered; }; } // namespace WebCore #endif // ReverbConvolver_h
--- a/dom/media/webm/WebMBufferedParser.h +++ b/dom/media/webm/WebMBufferedParser.h @@ -293,17 +293,17 @@ class WebMBufferedState final { // Returns keyframe for time bool GetNextKeyframeTime(uint64_t aTime, uint64_t* aKeyframeTime); private: // Private destructor, to discourage deletion outside of Release(): MOZ_COUNTED_DTOR(WebMBufferedState) // Synchronizes access to the mTimeMapping array and mLastBlockOffset. - ReentrantMonitor mReentrantMonitor; + ReentrantMonitor mReentrantMonitor MOZ_UNANNOTATED; // Sorted (by offset) map of data offsets to timecodes. Populated // on the main thread as data is received and parsed by WebMBufferedParsers. nsTArray<WebMTimeDataOffset> mTimeMapping; // The last complete block parsed. -1 if not set. int64_t mLastBlockOffset; // Sorted (by offset) live parser instances. Main thread only.
--- a/dom/media/webrtc/CubebDeviceEnumerator.cpp +++ b/dom/media/webrtc/CubebDeviceEnumerator.cpp @@ -18,17 +18,17 @@ namespace mozilla { using namespace CubebUtils; using AudioDeviceSet = CubebDeviceEnumerator::AudioDeviceSet; /* static */ static StaticRefPtr<CubebDeviceEnumerator> sInstance; -static StaticMutex sInstanceMutex; +static StaticMutex sInstanceMutex MOZ_UNANNOTATED; /* static */ CubebDeviceEnumerator* CubebDeviceEnumerator::GetInstance() { StaticMutexAutoLock lock(sInstanceMutex); if (!sInstance) { sInstance = new CubebDeviceEnumerator(); static bool clearOnShutdownSetup = []() -> bool { auto setClearOnShutdown = []() -> void {
--- a/dom/media/webrtc/CubebDeviceEnumerator.h +++ b/dom/media/webrtc/CubebDeviceEnumerator.h @@ -64,17 +64,17 @@ class CubebDeviceEnumerator final { // simply calls `AudioDeviceListChanged` below. static void InputAudioDeviceListChanged_s(cubeb* aContext, void* aUser); static void OutputAudioDeviceListChanged_s(cubeb* aContext, void* aUser); // Invalidates the cached audio input device list, can be called on any // thread. void AudioDeviceListChanged(Side aSide); RefPtr<const AudioDeviceSet> EnumerateAudioDevices(Side aSide); // Synchronize access to mInputDevices and mOutputDevices; - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; RefPtr<const AudioDeviceSet> mInputDevices; RefPtr<const AudioDeviceSet> mOutputDevices; // If mManual*Invalidation is true, then it is necessary to query the device // list each time instead of relying on automatic invalidation of the cache by // cubeb itself. Set in the constructor and then can be access on any thread. bool mManualInputInvalidation; bool mManualOutputInvalidation; MediaEventProducer<void> mOnInputDeviceListChange;
--- a/dom/media/webrtc/MediaEngineRemoteVideoSource.h +++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.h @@ -147,17 +147,17 @@ class MediaEngineRemoteVideoSource : pub */ webrtc::CaptureCapability& GetCapability(size_t aIndex) const; int mCaptureId = -1; const camera::CaptureEngine mCapEngine; // source of media (cam, screen etc) // mMutex protects certain members on 3 threads: // MediaManager, Cameras IPC and MediaTrackGraph. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // Current state of this source. // Set under mMutex on the owning thread. Accessed under one of the two. MediaEngineSourceState mState = kReleased; // The source track that we feed video data to. // Set under mMutex on the owning thread. Accessed under one of the two. RefPtr<SourceMediaTrack> mTrack;
--- a/dom/media/webrtc/libwebrtcglue/AudioConduit.h +++ b/dom/media/webrtc/libwebrtcglue/AudioConduit.h @@ -241,17 +241,17 @@ class WebrtcAudioConduit : public AudioS Atomic<bool> mSendStreamRunning; // If true => mRecvStream started and not stopped // Written only on the Call thread. Atomic<bool> mRecvStreamRunning; // Accessed only on the Call thread. bool mDtmfEnabled; - mutable RWLock mLock; + mutable RWLock mLock MOZ_UNANNOTATED; // Call worker thread. All access to mCall->Call() happens here. const RefPtr<AbstractThread> mCallThread; // Socket transport service thread. Any thread. const nsCOMPtr<nsISerialEventTarget> mStsThread; struct Control {
--- a/dom/media/webrtc/libwebrtcglue/VideoConduit.h +++ b/dom/media/webrtc/libwebrtcglue/VideoConduit.h @@ -266,17 +266,17 @@ class WebrtcVideoConduit MediaEventSource<void>& RtcpByeEvent() override { return mRtcpByeEvent; } MediaEventSource<void>& RtcpTimeoutEvent() override { return mRtcpTimeoutEvent; } bool RequiresNewSendStream(const VideoCodecConfig& newConfig) const; - mutable mozilla::ReentrantMonitor mRendererMonitor; + mutable mozilla::ReentrantMonitor mRendererMonitor MOZ_UNANNOTATED; // Accessed on any thread under mRendererMonitor. RefPtr<mozilla::VideoRenderer> mRenderer; // Accessed on any thread under mRendererMonitor. unsigned short mReceivingWidth = 0; // Accessed on any thread under mRendererMonitor. @@ -323,17 +323,17 @@ class WebrtcVideoConduit Control() = delete; explicit Control(const RefPtr<AbstractThread>& aCallThread); } mControl; // WatchManager allowing Mirrors and other watch targets to trigger functions // that will update the webrtc.org configuration. WatchManager<WebrtcVideoConduit> mWatchManager; - mutable Mutex mMutex; + mutable Mutex mMutex MOZ_UNANNOTATED; // Decoder factory used by mRecvStream when it needs new decoders. This is // not shared broader like some state in the WebrtcCallWrapper because it // handles CodecPluginID plumbing tied to this VideoConduit. const UniquePtr<WebrtcVideoDecoderFactory> mDecoderFactory; // Encoder factory used by mSendStream when it needs new encoders. This is // not shared broader like some state in the WebrtcCallWrapper because it
--- a/dom/media/webrtc/libwebrtcglue/WebrtcGmpVideoCodec.h +++ b/dom/media/webrtc/libwebrtcglue/WebrtcGmpVideoCodec.h @@ -274,17 +274,17 @@ class WebrtcGmpVideoEncoder : public GMP GMPVideoEncoderProxy* mGMP; // Used to handle a race where Release() is called while init is in progress bool mInitting; GMPVideoHost* mHost; GMPVideoCodec mCodecParams; uint32_t mMaxPayloadSize; webrtc::CodecSpecificInfo mCodecSpecificInfo; // Protects mCallback - Mutex mCallbackMutex; + Mutex mCallbackMutex MOZ_UNANNOTATED; webrtc::EncodedImageCallback* mCallback; Maybe<uint64_t> mCachedPluginId; const std::string mPCHandle; struct InputImageData { int64_t timestamp_us; }; // Map rtp time -> input image data @@ -425,17 +425,17 @@ class WebrtcGmpVideoDecoder : public GMP nsCOMPtr<nsIThread> mGMPThread; GMPVideoDecoderProxy* mGMP; // Addref is held for us // Used to handle a race where Release() is called while init is in progress bool mInitting; // Frames queued for decode while mInitting is true nsTArray<UniquePtr<GMPDecodeData>> mQueuedFrames; GMPVideoHost* mHost; // Protects mCallback - Mutex mCallbackMutex; + Mutex mCallbackMutex MOZ_UNANNOTATED; webrtc::DecodedImageCallback* mCallback; Maybe<uint64_t> mCachedPluginId; Atomic<GMPErr, ReleaseAcquire> mDecoderStatus; const std::string mPCHandle; MediaEventProducer<uint64_t> mInitPluginEvent; MediaEventProducer<uint64_t> mReleasePluginEvent; };
--- a/dom/media/webrtc/libwebrtcglue/WebrtcMediaDataEncoderCodec.h +++ b/dom/media/webrtc/libwebrtcglue/WebrtcMediaDataEncoderCodec.h @@ -52,17 +52,17 @@ class WebrtcMediaDataEncoder : public Re already_AddRefed<MediaDataEncoder> CreateEncoder( const webrtc::VideoCodec* aCodecSettings); bool InitEncoder(); const RefPtr<TaskQueue> mTaskQueue; const RefPtr<PEMFactory> mFactory; RefPtr<MediaDataEncoder> mEncoder; - Mutex mCallbackMutex; // Protects mCallback and mError. + Mutex mCallbackMutex MOZ_UNANNOTATED; // Protects mCallback and mError. webrtc::EncodedImageCallback* mCallback = nullptr; MediaResult mError = NS_OK; VideoInfo mInfo; webrtc::SdpVideoFormat::Parameters mFormatParams; webrtc::CodecSpecificInfo mCodecSpecific; webrtc::BitrateAdjuster mBitrateAdjuster; uint32_t mMaxFrameRate;
--- a/dom/media/webrtc/transport/nr_socket_prsock.h +++ b/dom/media/webrtc/transport/nr_socket_prsock.h @@ -278,17 +278,17 @@ class NrUdpSocketIpc : public NrSocketIp void sendto_i(const net::NetAddr& addr, UniquePtr<MediaPacket> buf); void close_i(); #if defined(MOZILLA_INTERNAL_API) && !defined(MOZILLA_XPCOMRT_API) void destroy_i(); #endif // STS thread executor void recv_callback_s(RefPtr<nr_udp_message> msg); - ReentrantMonitor monitor_; // protects err_and state_ + ReentrantMonitor monitor_ MOZ_UNANNOTATED; // protects err_and state_ bool err_; NrSocketIpcState state_; std::queue<RefPtr<nr_udp_message>> received_msgs_; // only accessed from the io_thread RefPtr<dom::UDPSocketChild> socket_child_; };
--- a/dom/media/webrtc/transportbridge/MediaPipeline.cpp +++ b/dom/media/webrtc/transportbridge/MediaPipeline.cpp @@ -1541,17 +1541,17 @@ class MediaPipelineReceiveVideo::Pipelin VideoSegment segment; auto size = image->GetSize(); segment.AppendFrame(image.forget(), size, principal); mSource->AppendData(&segment); } private: RefPtr<layers::ImageContainer> mImageContainer; - Mutex mMutex; // Protects the below members. + Mutex mMutex MOZ_UNANNOTATED; // Protects the below members. PrincipalHandle mPrincipalHandle; // Set to true on the sts thread if privacy is requested when ALPN was // negotiated. Set to false again when mPrincipalHandle is private. bool mForceDropFrames = false; }; class MediaPipelineReceiveVideo::PipelineRenderer : public mozilla::VideoRenderer {
--- a/dom/midi/MIDIMessageQueue.h +++ b/dom/midi/MIDIMessageQueue.h @@ -44,15 +44,15 @@ class MIDIMessageQueue { // when ports are closed, as we must send all messages with timestamps in the // past. void ClearAfterNow(); private: // Array of messages to be sent. nsTArray<MIDIMessage> mMessageQueue; // Mutex for coordinating cross thread array access. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; }; } // namespace dom } // namespace mozilla #endif // mozilla_dom_MIDIMessageQueue_h
--- a/dom/midi/MIDIPlatformService.h +++ b/dom/midi/MIDIPlatformService.h @@ -144,14 +144,14 @@ class MIDIPlatformService { // // TODO Split this into input and output ports. Will make life easier. nsTArray<RefPtr<MIDIPortParent>> mPorts; // Per-port message queue hashtable. Handles scheduling messages for sending. nsClassHashtable<nsStringHashKey, MIDIMessageQueue> mMessageQueues; // Mutex for managing access to message queue objects. - Mutex mMessageQueueMutex; + Mutex mMessageQueueMutex MOZ_UNANNOTATED; }; } // namespace mozilla::dom #endif // mozilla_dom_MIDIPlatformService_h
--- a/dom/midi/midirMIDIPlatformService.h +++ b/dom/midi/midirMIDIPlatformService.h @@ -42,15 +42,15 @@ class midirMIDIPlatformService : public uint64_t aMicros); // Wrapper around the midir Rust implementation. MidirWrapper* mImplementation; // midir has its own internal threads and we can't execute jobs directly on // them, instead we forward them to the background thread the service was // created in. - static StaticMutex gBackgroundThreadMutex; + static StaticMutex gBackgroundThreadMutex MOZ_UNANNOTATED; static nsCOMPtr<nsIThread> gBackgroundThread; }; } // namespace mozilla::dom #endif // mozilla_dom_midirMIDIPlatformService_h
--- a/dom/performance/PerformanceService.cpp +++ b/dom/performance/PerformanceService.cpp @@ -9,17 +9,17 @@ #include "mozilla/ClearOnShutdown.h" #include "mozilla/StaticMutex.h" #include "mozilla/StaticPtr.h" #include "prtime.h" namespace mozilla::dom { static StaticRefPtr<PerformanceService> gPerformanceService; -static StaticMutex gPerformanceServiceMutex; +static StaticMutex gPerformanceServiceMutex MOZ_UNANNOTATED; /* static */ PerformanceService* PerformanceService::GetOrCreate() { StaticMutexAutoLock al(gPerformanceServiceMutex); if (!gPerformanceService) { gPerformanceService = new PerformanceService(); ClearOnShutdown(&gPerformanceService);
--- a/dom/performance/PerformanceStorageWorker.h +++ b/dom/performance/PerformanceStorageWorker.h @@ -32,17 +32,17 @@ class PerformanceStorageWorker final : p void AddEntry(const nsString& aEntryName, const nsString& aInitiatorType, UniquePtr<PerformanceTimingData>&& aData) override; void AddEntryOnWorker(UniquePtr<PerformanceProxyData>&& aData); private: PerformanceStorageWorker(); ~PerformanceStorageWorker(); - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // Protected by mutex. // Created and released on worker-thread. Used also on main-thread. RefPtr<WeakWorkerRef> mWorkerRef; }; } // namespace dom } // namespace mozilla
--- a/dom/promise/PromiseWorkerProxy.h +++ b/dom/promise/PromiseWorkerProxy.h @@ -202,14 +202,14 @@ class PromiseWorkerProxy : public Promis // Modified on the worker thread. // It is ok to *read* this without a lock on the worker. // Main thread must always acquire a lock. bool mCleanedUp; // To specify if the cleanUp() has been done. const PromiseWorkerProxyStructuredCloneCallbacks* mCallbacks; // Ensure the worker and the main thread won't race to access |mCleanedUp|. - Mutex mCleanUpLock; + Mutex mCleanUpLock MOZ_UNANNOTATED; }; } // namespace dom } // namespace mozilla #endif // mozilla_dom_PromiseWorkerProxy_h
--- a/dom/quota/QuotaManager.h +++ b/dom/quota/QuotaManager.h @@ -592,17 +592,17 @@ class QuotaManager final : public Backgr EnumeratedArray<Client::Type, Client::TYPE_MAX, nsCString> mShutdownSteps; LazyInitializedOnce<const TimeStamp> mShutdownStartedAt; Atomic<bool> mShutdownStarted; // Accesses to mQuotaManagerShutdownSteps must be protected by mQuotaMutex. nsCString mQuotaManagerShutdownSteps; - mutable mozilla::Mutex mQuotaMutex; + mutable mozilla::Mutex mQuotaMutex MOZ_UNANNOTATED; nsClassHashtable<nsCStringHashKey, GroupInfoPair> mGroupInfoPairs; // Maintains a list of directory locks that are queued. nsTArray<RefPtr<DirectoryLockImpl>> mPendingDirectoryLocks; // Maintains a list of directory locks that are acquired or queued. It can be // accessed on the owning (PBackground) thread only.
--- a/dom/serviceworkers/ServiceWorkerRegistrar.h +++ b/dom/serviceworkers/ServiceWorkerRegistrar.h @@ -92,17 +92,17 @@ class ServiceWorkerRegistrar : public ns uint32_t GetNextGeneration(); void MaybeResetGeneration(); nsCOMPtr<nsIAsyncShutdownClient> GetShutdownPhase() const; bool IsSupportedVersion(const nsACString& aVersion) const; protected: - mozilla::Monitor mMonitor; + mozilla::Monitor mMonitor MOZ_UNANNOTATED; // protected by mMonitor. nsCOMPtr<nsIFile> mProfileDir; nsTArray<ServiceWorkerRegistrationData> mData; bool mDataLoaded; // PBackground thread only uint32_t mDataGeneration;
--- a/dom/storage/LocalStorageCache.h +++ b/dom/storage/LocalStorageCache.h @@ -239,17 +239,17 @@ class LocalStorageCache : public LocalSt // The eTLD+1 scope used to count quota usage. It is in the reversed format // and contains the origin attributes suffix. nsCString mQuotaOriginScope; // Non-private Browsing, Private Browsing and Session Only sets. Data mData[kDataSetCount]; // This monitor is used to wait for full load of data. - mozilla::Monitor mMonitor; + mozilla::Monitor mMonitor MOZ_UNANNOTATED; // Flag that is initially false. When the cache is about to work with // the database (i.e. it is persistent) this flags is set to true after // all keys and coresponding values are loaded from the database. // This flag never goes from true back to false. Since this flag is // critical for mData hashtable synchronization, it's made atomic. Atomic<bool, ReleaseAcquire> mLoaded;
--- a/dom/storage/StorageDBThread.cpp +++ b/dom/storage/StorageDBThread.cpp @@ -66,17 +66,17 @@ bool sStorageThreadDown[kPrivateBrowsing #if 0 StorageDBBridge::StorageDBBridge() { } #endif class StorageDBThread::InitHelper final : public Runnable { nsCOMPtr<nsIEventTarget> mOwningThread; - mozilla::Mutex mMutex; + mozilla::Mutex mMutex MOZ_UNANNOTATED; mozilla::CondVar mCondVar; nsString mProfilePath; nsresult mMainThreadResultCode; bool mWaiting; public: InitHelper() : Runnable("dom::StorageDBThread::InitHelper"),
--- a/dom/storage/StorageDBThread.h +++ b/dom/storage/StorageDBThread.h @@ -281,17 +281,17 @@ class StorageDBThread final { mHasPendingEvents = false; } Monitor& GetMonitor() { return mMonitor; } private: virtual ~ThreadObserver() = default; bool mHasPendingEvents; // The monitor we drive the thread with - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; }; class InitHelper; class NoteBackgroundThreadRunnable; class ShutdownRunnable : public Runnable { // Expected to be only 0 or 1.
--- a/dom/storage/StorageIPC.cpp +++ b/dom/storage/StorageIPC.cpp @@ -844,17 +844,17 @@ class SyncLoadCacheHelper : public Local // Called on the main thread, exits after LoadDone() call MonitorAutoLock monitor(mMonitor); while (!mLoaded) { monitor.Wait(); } } private: - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; nsCString mSuffix, mOrigin; nsTArray<nsString>* mKeys; nsTArray<nsString>* mValues; nsresult* mRv; bool mLoaded; uint32_t mLoadedCount; };
--- a/dom/webauthn/U2FHIDTokenManager.cpp +++ b/dom/webauthn/U2FHIDTokenManager.cpp @@ -8,17 +8,17 @@ #include "mozilla/dom/U2FHIDTokenManager.h" #include "mozilla/dom/WebAuthnUtil.h" #include "mozilla/ipc/BackgroundParent.h" #include "mozilla/StaticMutex.h" namespace mozilla { namespace dom { -static StaticMutex gInstanceMutex; +static StaticMutex gInstanceMutex MOZ_UNANNOTATED; static U2FHIDTokenManager* gInstance; static nsIThread* gPBackgroundThread; static void u2f_register_callback(uint64_t aTransactionId, rust_u2f_result* aResult) { UniquePtr<U2FResult> rv = MakeUnique<U2FResult>(aTransactionId, aResult); StaticMutexAutoLock lock(gInstanceMutex);
--- a/dom/webauthn/U2FTokenManager.cpp +++ b/dom/webauthn/U2FTokenManager.cpp @@ -136,17 +136,17 @@ class U2FPrefManager final : public nsIO mSoftTokenCounter = Preferences::GetUint(PREF_U2F_NSSTOKEN_COUNTER); mUsbTokenEnabled = Preferences::GetBool(PREF_WEBAUTHN_USBTOKEN_ENABLED); mAndroidFido2Enabled = Preferences::GetBool(PREF_WEBAUTHN_ANDROID_FIDO2_ENABLED); mAllowDirectAttestation = Preferences::GetBool(PREF_WEBAUTHN_ALLOW_DIRECT_ATTESTATION); } - Mutex mPrefMutex; + Mutex mPrefMutex MOZ_UNANNOTATED; bool mSoftTokenEnabled; int mSoftTokenCounter; bool mUsbTokenEnabled; bool mAndroidFido2Enabled; bool mAllowDirectAttestation; }; NS_IMPL_ISUPPORTS(U2FPrefManager, nsIObserver);
--- a/dom/webbrowserpersist/nsWebBrowserPersist.cpp +++ b/dom/webbrowserpersist/nsWebBrowserPersist.cpp @@ -116,17 +116,17 @@ struct nsWebBrowserPersist::URIData { // from OnStartRequest (if mCalcFileExt), both guaranteed to happen before // OnDataAvailable is fired. // The main thread gets OnStartRequest, OnStopRequest, and progress sink events, // and accesses the other members. struct nsWebBrowserPersist::OutputData { nsCOMPtr<nsIURI> mFile; nsCOMPtr<nsIURI> mOriginalLocation; nsCOMPtr<nsIOutputStream> mStream; - Mutex mStreamMutex; + Mutex mStreamMutex MOZ_UNANNOTATED; int64_t mSelfProgress; int64_t mSelfProgressMax; bool mCalcFileExt; OutputData(nsIURI* aFile, nsIURI* aOriginalLocation, bool aCalcFileExt) : mFile(aFile), mOriginalLocation(aOriginalLocation), mStreamMutex("nsWebBrowserPersist::OutputData::mStreamMutex"),
--- a/dom/webbrowserpersist/nsWebBrowserPersist.h +++ b/dom/webbrowserpersist/nsWebBrowserPersist.h @@ -150,17 +150,17 @@ class nsWebBrowserPersist final : public nsCOMPtr<nsIWebProgressListener> mProgressListener; /** * Progress listener for 64-bit values; this is the same object as * mProgressListener, but is a member to avoid having to qi it for each * progress notification. */ nsCOMPtr<nsIWebProgressListener2> mProgressListener2; nsCOMPtr<nsIProgressEventSink> mEventSink; - mozilla::Mutex mOutputMapMutex; + mozilla::Mutex mOutputMapMutex MOZ_UNANNOTATED; nsClassHashtable<nsISupportsHashKey, OutputData> mOutputMap; nsClassHashtable<nsISupportsHashKey, UploadData> mUploadList; nsCOMPtr<nsISerialEventTarget> mBackgroundQueue; nsTArray<RefPtr<ClosePromise>> mFileClosePromises; nsClassHashtable<nsCStringHashKey, URIData> mURIMap; nsCOMPtr<nsIWebBrowserPersistURIMap> mFlatURIMap; nsTArray<mozilla::UniquePtr<WalkData>> mWalkStack; nsTArray<DocData*> mDocList;
--- a/dom/webgpu/ipc/WebGPUParent.cpp +++ b/dom/webgpu/ipc/WebGPUParent.cpp @@ -58,17 +58,17 @@ class PresentationData { RefPtr<layers::MemoryTextureHost> mTextureHost; uint32_t mSourcePitch = 0; uint32_t mTargetPitch = 0; uint32_t mRowCount = 0; int32_t mNextFrameID = 1; std::vector<RawId> mUnassignedBufferIds; std::vector<RawId> mAvailableBufferIds; std::vector<RawId> mQueuedBufferIds; - Mutex mBuffersLock; + Mutex mBuffersLock MOZ_UNANNOTATED; PresentationData(RawId aDeviceId, RawId aQueueId, already_AddRefed<layers::WebRenderImageHost> aImageHost, already_AddRefed<layers::MemoryTextureHost> aTextureHost, uint32_t aSourcePitch, uint32_t aTargetPitch, uint32_t aRows, const nsTArray<RawId>& aBufferIds) : mDeviceId(aDeviceId), mQueueId(aQueueId),
--- a/dom/websocket/WebSocket.cpp +++ b/dom/websocket/WebSocket.cpp @@ -243,17 +243,17 @@ class WebSocketImpl final : public nsIIn RefPtr<ThreadSafeWorkerRef> mWorkerRef; nsWeakPtr mWeakLoadGroup; bool mIsMainThread; // This mutex protects mWorkerShuttingDown. - mozilla::Mutex mMutex; + mozilla::Mutex mMutex MOZ_UNANNOTATED; bool mWorkerShuttingDown; RefPtr<WebSocketEventService> mService; nsCOMPtr<nsIPrincipal> mLoadingPrincipal; // For dispatching runnables to main thread. nsCOMPtr<nsIEventTarget> mMainThreadEventTarget;
--- a/dom/websocket/WebSocket.h +++ b/dom/websocket/WebSocket.h @@ -173,17 +173,17 @@ class WebSocket final : public DOMEventT nsString mEffectiveURL; // after redirects nsCString mEstablishedExtensions; nsCString mEstablishedProtocol; dom::BinaryType mBinaryType; // This mutex protects mReadyState that is the only variable that is used in // different threads. - mozilla::Mutex mMutex; + mozilla::Mutex mMutex MOZ_UNANNOTATED; // This value should not be used directly but use ReadyState() instead. uint16_t mReadyState; }; } // namespace dom } // namespace mozilla
--- a/dom/workers/Queue.h +++ b/dom/workers/Queue.h @@ -49,17 +49,17 @@ struct StorageWithTArray { } static void Clear(StorageType& aStorage) { aStorage.Clear(); } static void Compact(StorageType& aStorage) { aStorage.Compact(); } }; class LockingWithMutex { - mozilla::Mutex mMutex; + mozilla::Mutex mMutex MOZ_UNANNOTATED; protected: LockingWithMutex() : mMutex("LockingWithMutex::mMutex") {} void Lock() { mMutex.Lock(); } void Unlock() { mMutex.Unlock(); }
--- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -1581,17 +1581,17 @@ class CrashIfHangingRunnable : public Wo const nsCString& MsgData() const { return mMsg; } private: bool PreDispatch(WorkerPrivate* aWorkerPrivate) override { return true; } void PostDispatch(WorkerPrivate* aWorkerPrivate, bool aDispatchResult) override {} - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; nsCString mMsg; FlippedOnce<false> mHasMsg; }; struct ActiveWorkerStats { template <uint32_t ActiveWorkerStats::*Category> void Update(const nsTArray<WorkerPrivate*>& aWorkers) { for (const auto worker : aWorkers) {
--- a/dom/workers/RuntimeService.h +++ b/dom/workers/RuntimeService.h @@ -55,17 +55,17 @@ class RuntimeService final : public nsIO } }; struct IdleThreadInfo { SafeRefPtr<WorkerThread> mThread; mozilla::TimeStamp mExpirationTime; }; - mozilla::Mutex mMutex; + mozilla::Mutex mMutex MOZ_UNANNOTATED; // Protected by mMutex. nsClassHashtable<nsCStringHashKey, WorkerDomainInfo> mDomainMap; // Protected by mMutex. nsTArray<IdleThreadInfo> mIdleThreadArray; // *Not* protected by mMutex.
--- a/dom/workers/WorkerCSPEventListener.h +++ b/dom/workers/WorkerCSPEventListener.h @@ -25,17 +25,17 @@ class WorkerCSPEventListener final : pub static already_AddRefed<WorkerCSPEventListener> Create( WorkerPrivate* aWorkerPrivate); private: WorkerCSPEventListener(); ~WorkerCSPEventListener() = default; - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // Protected by mutex. RefPtr<WeakWorkerRef> mWorkerRef; }; } // namespace dom } // namespace mozilla
--- a/dom/workers/WorkerDebuggerManager.h +++ b/dom/workers/WorkerDebuggerManager.h @@ -29,17 +29,17 @@ namespace mozilla { namespace dom { class WorkerDebugger; class WorkerPrivate; class WorkerDebuggerManager final : public nsIObserver, public nsIWorkerDebuggerManager { - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // Protected by mMutex. nsTArray<nsCOMPtr<nsIWorkerDebuggerManagerListener>> mListeners; // Only touched on the main thread. nsTArray<RefPtr<WorkerDebugger>> mDebuggers; public:
--- a/dom/workers/WorkerDocumentListener.h +++ b/dom/workers/WorkerDocumentListener.h @@ -26,15 +26,15 @@ class WorkerDocumentListener final { void SetListening(uint64_t aWindowID, bool aListen); void Destroy(); static RefPtr<WorkerDocumentListener> Create(WorkerPrivate* aWorkerPrivate); private: ~WorkerDocumentListener(); - Mutex mMutex; // protects mWorkerRef + Mutex mMutex MOZ_UNANNOTATED; // protects mWorkerRef RefPtr<ThreadSafeWorkerRef> mWorkerRef; }; } // namespace mozilla::dom #endif /* mozilla_dom_WorkerDocumentListener_h__ */
--- a/dom/workers/WorkerEventTarget.h +++ b/dom/workers/WorkerEventTarget.h @@ -23,17 +23,17 @@ class WorkerEventTarget final : public n // often necessary for code that wants normal dispatch order, but // also needs to execute while the worker is shutting down (possibly // with a holder in place.) // // * ControlOnly targets will simply dispatch a control runnable. enum class Behavior : uint8_t { Hybrid, ControlOnly }; private: - mozilla::Mutex mMutex; + mozilla::Mutex mMutex MOZ_UNANNOTATED; CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate; const Behavior mBehavior; ~WorkerEventTarget() = default; public: WorkerEventTarget(WorkerPrivate* aWorkerPrivate, Behavior aBehavior);
--- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -930,17 +930,17 @@ class CancelingRunnable final : public R nsString ComputeWorkerPrivateId() { nsID uuid = nsID::GenerateUUID(); return NSID_TrimBracketsUTF16(uuid); } class WorkerPrivate::EventTarget final : public nsISerialEventTarget { // This mutex protects mWorkerPrivate and must be acquired *before* the // WorkerPrivate's mutex whenever they must both be held. - mozilla::Mutex mMutex; + mozilla::Mutex mMutex MOZ_UNANNOTATED; WorkerPrivate* mWorkerPrivate; nsIEventTarget* mWeakNestedEventTarget; nsCOMPtr<nsIEventTarget> mNestedEventTarget; public: explicit EventTarget(WorkerPrivate* aWorkerPrivate) : mMutex("WorkerPrivate::EventTarget::mMutex"), mWorkerPrivate(aWorkerPrivate),
--- a/dom/workers/WorkerThread.h +++ b/dom/workers/WorkerThread.h @@ -43,17 +43,17 @@ class WorkerThreadFriendKey { WorkerThreadFriendKey(); ~WorkerThreadFriendKey(); }; class WorkerThread final : public nsThread { class Observer; - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; CondVar mWorkerPrivateCondVar; // Protected by nsThread::mLock. WorkerPrivate* mWorkerPrivate; // Only touched on the target thread. RefPtr<Observer> mObserver;
--- a/dom/xhr/XMLHttpRequestMainThread.h +++ b/dom/xhr/XMLHttpRequestMainThread.h @@ -116,17 +116,17 @@ class ArrayBufferBuilder { ArrayBufferBuilder& operator=(const ArrayBufferBuilder&) = delete; ArrayBufferBuilder& operator=(const ArrayBufferBuilder&&) = delete; bool SetCapacityInternal(uint32_t aNewCap, const MutexAutoLock& aProofOfLock); static bool AreOverlappingRegions(const uint8_t* aStart1, uint32_t aLength1, const uint8_t* aStart2, uint32_t aLength2); - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // All of these are protected by mMutex. uint8_t* mDataPtr; uint32_t mCapacity; uint32_t mLength; void* mMapPtr; // This is used in assertions only.
--- a/dom/xhr/XMLHttpRequestString.cpp +++ b/dom/xhr/XMLHttpRequestString.cpp @@ -77,17 +77,17 @@ class XMLHttpRequestStringBuffer final { aSnapshot.Set(this, mData.Length()); } private: ~XMLHttpRequestStringBuffer() = default; nsString& UnsafeData() { return mData; } - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // The following member variable is protected by mutex. nsString mData; }; // --------------------------------------------------------------------------- // XMLHttpRequestString
--- a/extensions/permissions/PermissionManager.h +++ b/extensions/permissions/PermissionManager.h @@ -360,17 +360,17 @@ class PermissionManager final : public n * ignoring permission isolation prefs. * @param aOriginAttributes object to strip. */ static void MaybeStripOriginAttributes(bool aForceStrip, OriginAttributes& aOriginAttributes); private: ~PermissionManager(); - static StaticMutex sCreationMutex; + static StaticMutex sCreationMutex MOZ_UNANNOTATED; /** * Get all permissions for a given principal, which should not be isolated * by user context or private browsing. The principal has its origin * attributes stripped before perm db lookup. This is currently only affects * the "cookie" permission. * @param aPrincipal Used for creating the permission key. * @param aSiteScopePermissions Used to specify whether to get strip perms for @@ -529,17 +529,17 @@ class PermissionManager final : public n nsRefPtrHashtable<nsCStringHashKey, GenericNonExclusivePromise::Private> mPermissionKeyPromiseMap; nsCOMPtr<nsIFile> mPermissionsFile; // This monitor is used to ensure the database reading before any other // operation. The reading of the database happens OMT. See |State| to know the // steps of the database reading. - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; enum State { // Initial state. The database has not been read yet. // |TryInitDB| is called at startup time to read the database OMT. // During the reading, |mReadEntries| will be populated with all the // existing permissions. eInitializing,
--- a/extensions/spellcheck/src/mozPersonalDictionary.h +++ b/extensions/spellcheck/src/mozPersonalDictionary.h @@ -46,18 +46,18 @@ class mozPersonalDictionary final : publ /* true if the dictionary has been loaded from disk */ bool mIsLoaded; /* true if a dictionary save is pending */ bool mSavePending; nsCOMPtr<nsIFile> mFile; - mozilla::Monitor mMonitor; - mozilla::Monitor mMonitorSave; + mozilla::Monitor mMonitor MOZ_UNANNOTATED; + mozilla::Monitor mMonitorSave MOZ_UNANNOTATED; nsTHashSet<nsString> mDictionaryTable; nsTHashSet<nsString> mIgnoreTable; private: /* wait for the asynchronous load of the dictionary to be completed */ void WaitForLoad(); /* enter the monitor before starting a synchronous load off the main-thread */
--- a/gfx/2d/2D.h +++ b/gfx/2d/2D.h @@ -993,17 +993,17 @@ class SharedFTFace : public external::At if (aOwner) { mLastLockOwner.compareExchange(aOwner, nullptr); } } private: FT_Face mFace; SharedFTFaceData* mData; - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; // Remember the last owner of the lock, even after unlocking, to allow users // to avoid reinitializing state on the FT face if the last owner hasn't // changed by the next time it is locked with the same owner. Atomic<void*> mLastLockOwner; }; #endif class UnscaledFont : public SupportsThreadSafeWeakPtr<UnscaledFont> { @@ -2008,17 +2008,17 @@ class GFX2D_API Factory { FT_Library aFTLibrary, const uint8_t* aData, size_t aDataSize, int aFaceIndex, SharedFTFaceData* aSharedData = nullptr); static void ReleaseFTFace(FT_Face aFace); static FT_Error LoadFTGlyph(FT_Face aFace, uint32_t aGlyphIndex, int32_t aFlags); private: static FT_Library mFTLibrary; - static StaticMutex mFTLock; + static StaticMutex mFTLock MOZ_UNANNOTATED; public: #endif #ifdef WIN32 static already_AddRefed<DrawTarget> CreateDrawTargetForD3D11Texture( ID3D11Texture2D* aTexture, SurfaceFormat aFormat); @@ -2077,20 +2077,20 @@ class GFX2D_API Factory { // DestTextureT can be TextureData or DataSourceSurface. template <typename DestTextureT> static bool ConvertSourceAndRetryReadback(DestTextureT* aDestCpuTexture, ID3D11Texture2D* aSrcTexture); protected: // This guards access to the singleton devices above, as well as the // singleton devices in DrawTargetD2D1. - static StaticMutex mDeviceLock; + static StaticMutex mDeviceLock MOZ_UNANNOTATED; // This synchronizes access between different D2D drawtargets and their // implied dependency graph. - static StaticMutex mDTDependencyLock; + static StaticMutex mDTDependencyLock MOZ_UNANNOTATED; friend class DrawTargetD2D1; #endif // WIN32 }; class MOZ_RAII AutoSerializeWithMoz2D final { public: explicit AutoSerializeWithMoz2D(BackendType aBackendType);
--- a/gfx/2d/DrawTargetSkia.h +++ b/gfx/2d/DrawTargetSkia.h @@ -186,17 +186,17 @@ class DrawTargetSkia : public DrawTarget }; std::vector<PushedLayer> mPushedLayers; IntSize mSize; RefPtr<SkSurface> mSurface; SkCanvas* mCanvas = nullptr; RefPtr<DataSourceSurface> mBackingSurface; RefPtr<SourceSurfaceSkia> mSnapshot; - Mutex mSnapshotLock; + Mutex mSnapshotLock MOZ_UNANNOTATED; #ifdef MOZ_WIDGET_COCOA friend class BorrowedCGContext; CGContextRef BorrowCGContext(const DrawOptions& aOptions); void ReturnCGContext(CGContextRef); bool FillGlyphsWithCG(ScaledFont* aFont, const GlyphBuffer& aBuffer, const Pattern& aPattern,
--- a/gfx/2d/NativeFontResourceDWrite.cpp +++ b/gfx/2d/NativeFontResourceDWrite.cpp @@ -12,17 +12,17 @@ #include "Logging.h" #include "mozilla/RefPtr.h" #include "mozilla/StaticMutex.h" #include "nsTArray.h" namespace mozilla { namespace gfx { -static StaticMutex sFontFileStreamsMutex; +static StaticMutex sFontFileStreamsMutex MOZ_UNANNOTATED; static uint64_t sNextFontFileKey = 0; static std::unordered_map<uint64_t, IDWriteFontFileStream*> sFontFileStreams; class DWriteFontFileLoader : public IDWriteFontFileLoader { public: DWriteFontFileLoader() {} // IUnknown interface
--- a/gfx/2d/SourceSurfaceSkia.h +++ b/gfx/2d/SourceSurfaceSkia.h @@ -62,16 +62,16 @@ class SourceSurfaceSkia : public DataSou sk_sp<SkImage> mImage; // This keeps a surface alive if needed because its DrawTarget has gone away. sk_sp<SkSurface> mSurface; SurfaceFormat mFormat; IntSize mSize; int32_t mStride; Atomic<DrawTargetSkia*> mDrawTarget; - Mutex mChangeMutex; + Mutex mChangeMutex MOZ_UNANNOTATED; bool mIsMapped; }; } // namespace gfx } // namespace mozilla #endif /* MOZILLA_GFX_SOURCESURFACESKIA_H_ */
--- a/gfx/gl/AndroidSurfaceTexture.cpp +++ b/gfx/gl/AndroidSurfaceTexture.cpp @@ -112,17 +112,17 @@ class AndroidSharedBlitGL final { if (!gl->IsCurrent()) { return true; } const auto& egl = *(gl->mEgl); return egl.fMakeCurrent(EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); } - static StaticMutex sMutex; + static StaticMutex sMutex MOZ_UNANNOTATED; static StaticRefPtr<GLContextEGL> sContext; static size_t sInstanceCount; EGLSurface mTargetSurface; }; StaticMutex AndroidSharedBlitGL::sMutex; StaticRefPtr<GLContextEGL> AndroidSharedBlitGL::sContext;
--- a/gfx/gl/GLContextProviderEGL.cpp +++ b/gfx/gl/GLContextProviderEGL.cpp @@ -1206,17 +1206,17 @@ already_AddRefed<GLContext> GLContextPro // fail on many Tegra drivers (bug 759225) and 2) some mobile devices have a // very strict limit on global number of GL contexts (bug 754257) and 3) each // EGL context eats 750k on B2G (bug 813783) /*static*/ GLContext* GLContextProviderEGL::GetGlobalContext() { return nullptr; } // - -static StaticMutex sMutex; +static StaticMutex sMutex MOZ_UNANNOTATED; static StaticRefPtr<GLLibraryEGL> gDefaultEglLibrary; RefPtr<GLLibraryEGL> DefaultEglLibrary(nsACString* const out_failureId) { StaticMutexAutoLock lock(sMutex); if (!gDefaultEglLibrary) { gDefaultEglLibrary = GLLibraryEGL::Create(out_failureId); if (!gDefaultEglLibrary) { NS_WARNING("GLLibraryEGL::Create failed");
--- a/gfx/gl/SharedSurface.h +++ b/gfx/gl/SharedSurface.h @@ -145,17 +145,17 @@ class SharedSurface { // - class SurfaceFactory { public: const PartialSharedSurfaceDesc mDesc; protected: - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; public: static UniquePtr<SurfaceFactory> Create(GLContext*, layers::TextureType); protected: explicit SurfaceFactory(const PartialSharedSurfaceDesc&); public:
--- a/gfx/gl/SharedSurfaceEGL.h +++ b/gfx/gl/SharedSurfaceEGL.h @@ -20,17 +20,17 @@ namespace mozilla { namespace gl { class GLLibraryEGL; // - // EGLImage class SharedSurface_EGLImage final : public SharedSurface { - mutable Mutex mMutex; + mutable Mutex mMutex MOZ_UNANNOTATED; EGLSync mSync = 0; public: const EGLImage mImage; static UniquePtr<SharedSurface_EGLImage> Create(const SharedSurfaceDesc&); protected:
--- a/gfx/layers/AndroidHardwareBuffer.h +++ b/gfx/layers/AndroidHardwareBuffer.h @@ -218,17 +218,17 @@ class AndroidHardwareBufferManager { bool aUsesImageBridge); void NotifyNotUsed(ipc::FileDescriptor&& aFenceFd, uint64_t aBufferId, uint64_t aTransactionId, bool aUsesImageBridge); Monitor& GetMonitor() { return mMonitor; } private: - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; std::unordered_map<uint64_t, ThreadSafeWeakPtr<AndroidHardwareBuffer>> mBuffers; /** * Hold AndroidHardwareBuffers that are used by host side via * CompositorBridgeChild and ImageBridgeChild until end of their usages * on host side. */
--- a/gfx/layers/CompositorAnimationStorage.h +++ b/gfx/layers/CompositorAnimationStorage.h @@ -182,17 +182,17 @@ class CompositorAnimationStorage final { */ void SetAnimatedValue(uint64_t aId, AnimatedValue* aPreviousValue, nscolor aColor); private: AnimatedValueTable mAnimatedValues; AnimationsTable mAnimations; std::unordered_set<uint64_t> mNewAnimations; - mutable Mutex mLock; + mutable Mutex mLock MOZ_UNANNOTATED; // CompositorBridgeParent owns this CompositorAnimationStorage instance. CompositorBridgeParent* MOZ_NON_OWNING_REF mCompositorBridge; }; } // namespace layers } // namespace mozilla #endif // mozilla_layers_CompositorAnimationStorage_h
--- a/gfx/layers/DMABUFSurfaceImage.cpp +++ b/gfx/layers/DMABUFSurfaceImage.cpp @@ -33,17 +33,17 @@ DMABUFSurfaceImage::DMABUFSurfaceImage(D } DMABUFSurfaceImage::~DMABUFSurfaceImage() { // Unref as we're done with this surface. mSurface->GlobalRefRelease(); } StaticRefPtr<GLContext> sSnapshotContext; -static StaticMutex sSnapshotContextMutex; +static StaticMutex sSnapshotContextMutex MOZ_UNANNOTATED; already_AddRefed<gfx::SourceSurface> DMABUFSurfaceImage::GetAsSourceSurface() { if (!sSnapshotContext) { nsCString discardFailureId; sSnapshotContext = GLContextProvider::CreateHeadless({}, &discardFailureId); if (!sSnapshotContext) { gfxCriticalError() << "Failed to create snapshot GLContext."; return nullptr;
--- a/gfx/layers/ImageContainer.h +++ b/gfx/layers/ImageContainer.h @@ -192,17 +192,17 @@ class BufferRecycleBin final { private: typedef mozilla::Mutex Mutex; // Private destructor, to discourage deletion outside of Release(): ~BufferRecycleBin() = default; // This protects mRecycledBuffers, mRecycledBufferSize, mRecycledTextures // and mRecycledTextureSizes - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; // We should probably do something to prune this list on a timer so we don't // eat excess memory while video is paused... nsTArray<mozilla::UniquePtr<uint8_t[]>> mRecycledBuffers; // This is only valid if mRecycledBuffers is non-empty uint32_t mRecycledBufferSize; }; @@ -246,17 +246,17 @@ class ImageContainerListener final { void ClearImageContainer(); void DropImageClient(); private: typedef mozilla::Mutex Mutex; ~ImageContainerListener(); - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; ImageContainer* mImageContainer; }; /** * A class that manages Images for an ImageLayer. The only reason * we need a separate class here is that ImageLayers aren't threadsafe * (because layers can only be used on the main thread) and we want to * be able to set the current Image from any thread, to facilitate @@ -538,17 +538,17 @@ class ImageContainer final : public Supp // NOTE: If we have remote data mRemoteDataMutex should be locked when // calling this function! void EnsureActiveImage(); void EnsureImageClient(); // RecursiveMutex to protect thread safe access to the "current // image", and any other state which is shared between threads. - RecursiveMutex mRecursiveMutex; + RecursiveMutex mRecursiveMutex MOZ_UNANNOTATED; RefPtr<TextureClientRecycleAllocator> mRecycleAllocator; #ifdef XP_WIN RefPtr<D3D11YCbCrRecycleAllocator> mD3D11YCbCrRecycleAllocator; #endif #ifdef XP_MACOSX RefPtr<MacIOSurfaceRecycleAllocator> mMacIOSurfaceRecycleAllocator;
--- a/gfx/layers/NativeLayerCA.h +++ b/gfx/layers/NativeLayerCA.h @@ -141,17 +141,17 @@ class NativeLayerRootCA : public NativeL bool mMutatedMouseMovedRecently = false; }; template <typename F> void ForAllRepresentations(F aFn); void UpdateMouseMovedRecently(const MutexAutoLock& aProofOfLock); - Mutex mMutex; // protects all other fields + Mutex mMutex MOZ_UNANNOTATED; // protects all other fields Representation mOnscreenRepresentation; Representation mOffscreenRepresentation; NativeLayerRootSnapshotterCA* mWeakSnapshotter = nullptr; nsTArray<RefPtr<NativeLayerCA>> mSublayers; // in z-order float mBackingScale = 1.0f; bool mMutated = false; // While mOffMainThreadCommitsSuspended is true, no commits @@ -376,17 +376,17 @@ class NativeLayerCA : public NativeLayer bool mMutatedSpecializeVideo : 1; }; Representation& GetRepresentation(WhichRepresentation aRepresentation); template <typename F> void ForAllRepresentations(F aFn); // Controls access to all fields of this class. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // Each IOSurface is initially created inside NextSurface. // The surface stays alive until the recycling mechanism in NextSurface // determines it is no longer needed (because the swap chain has grown too // long) or until DiscardBackbuffers() is called or the layer is destroyed. // During the surface's lifetime, it will continuously move through the fields // mInProgressSurface, mFrontSurface, and back to front through the mSurfaces // queue:
--- a/gfx/layers/NativeLayerWayland.h +++ b/gfx/layers/NativeLayerWayland.h @@ -68,17 +68,17 @@ class NativeLayerRootWayland final : pub void RequestFrameCallback(CallbackFunc aCallbackFunc, void* aCallbackData); private: explicit NativeLayerRootWayland(MozContainer* aContainer); ~NativeLayerRootWayland(); bool CommitToScreen(const MutexAutoLock& aProofOfLock); - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; MozContainer* mContainer = nullptr; wl_surface* mWlSurface = nullptr; RefPtr<widget::WaylandBufferSHM> mShmBuffer; nsTArray<RefPtr<NativeLayerWayland>> mSublayers; nsTArray<RefPtr<NativeLayerWayland>> mOldSublayers; nsTArray<RefPtr<NativeLayerWayland>> mSublayersOnMainThread; @@ -142,17 +142,17 @@ class NativeLayerWayland final : public NativeLayerWayland(const gfx::IntSize& aSize, bool aIsOpaque, SurfacePoolHandleWayland* aSurfacePoolHandle); explicit NativeLayerWayland(bool aIsOpaque); ~NativeLayerWayland() override; void HandlePartialUpdate(const MutexAutoLock& aProofOfLock); void FrameCallbackHandler(wl_callback* aCallback, uint32_t aTime); - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; const RefPtr<SurfacePoolHandleWayland> mSurfacePoolHandle; const gfx::IntSize mSize; const bool mIsOpaque = false; gfx::IntPoint mPosition; gfx::Matrix4x4 mTransform; gfx::IntRect mDisplayRect; gfx::IntRegion mDirtyRegion;
--- a/gfx/layers/ProfilerScreenshots.h +++ b/gfx/layers/ProfilerScreenshots.h @@ -96,17 +96,17 @@ class ProfilerScreenshots final { * any thread. */ void ReturnSurface(gfx::DataSourceSurface* aSurface); // An array of surfaces ready to be recycled. Can be accessed from multiple // threads, protected by mMutex. nsTArray<RefPtr<gfx::DataSourceSurface>> mAvailableSurfaces; // Protects mAvailableSurfaces. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // The total number of surfaces created. If encoding is fast enough to happen // entirely in the time between two calls to SubmitScreenshot, this should // never exceed 1. uint32_t mLiveSurfaceCount; // Window identifier used to submit screenshots, created in the constructor. uint32_t mWindowIdentifier;
--- a/gfx/layers/SourceSurfaceSharedData.h +++ b/gfx/layers/SourceSurfaceSharedData.h @@ -321,17 +321,17 @@ class SourceSurfaceSharedData : public D } /** * Attempt to close the handle. Only if the buffer has been both finalized * and we have completed sharing will it be released. */ void CloseHandleInternal(); - mutable Mutex mMutex; + mutable Mutex mMutex MOZ_UNANNOTATED; int32_t mStride; int32_t mHandleCount; Maybe<IntRect> mDirtyRect; IntSize mSize; RefPtr<SharedMemoryBasic> mBuf; RefPtr<SharedMemoryBasic> mOldBuf; SurfaceFormat mFormat; bool mClosed : 1;
--- a/gfx/layers/SurfacePoolWayland.h +++ b/gfx/layers/SurfacePoolWayland.h @@ -58,17 +58,17 @@ class SurfacePoolWayland final : public RefPtr<gl::DepthAndStencilBuffer> GetDepthBufferForSharing( const MutexAutoLock& aProofOfLock, gl::GLContext* aGL, const gfx::IntSize& aSize); UniquePtr<gl::MozFramebuffer> CreateFramebufferForTexture( const MutexAutoLock& aProofOfLock, gl::GLContext* aGL, const gfx::IntSize& aSize, GLuint aTexture, bool aNeedsDepthBuffer); - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // Stores the entries for surfaces that are in use by NativeLayerWayland, i.e. // an entry is inside mInUseEntries between calls to ObtainSurfaceFromPool() // and ReturnSurfaceToPool(). std::unordered_map<widget::WaylandBuffer*, SurfacePoolEntry> mInUseEntries; // Stores entries which are no longer in use by NativeLayerWayland but are // still in use by the window server, i.e. for which
--- a/gfx/layers/apz/public/APZSampler.h +++ b/gfx/layers/apz/public/APZSampler.h @@ -107,29 +107,29 @@ class APZSampler { bool mIsUsingWebRender; // Used to manage the mapping from a WR window id to APZSampler. These are // only used if WebRender is enabled. Both sWindowIdMap and mWindowId should // only be used while holding the sWindowIdLock. Note that we use a // StaticAutoPtr wrapper on sWindowIdMap to avoid a static initializer for the // unordered_map. This also avoids the initializer/memory allocation in cases // where we're not using WebRender. - static StaticMutex sWindowIdLock; + static StaticMutex sWindowIdLock MOZ_UNANNOTATED; static StaticAutoPtr<std::unordered_map<uint64_t, RefPtr<APZSampler>>> sWindowIdMap; Maybe<wr::WrWindowId> mWindowId; // Lock used to protected mSamplerThreadId - mutable Mutex mThreadIdLock; + mutable Mutex mThreadIdLock MOZ_UNANNOTATED; // If WebRender is enabled, this holds the thread id of the render backend // thread (which is the sampler thread) for the compositor associated with // this APZSampler instance. Maybe<PlatformThreadId> mSamplerThreadId; - Mutex mSampleTimeLock; + Mutex mSampleTimeLock MOZ_UNANNOTATED; // Can only be accessed or modified while holding mSampleTimeLock. SampleTime mSampleTime; }; } // namespace layers } // namespace mozilla #endif // mozilla_layers_APZSampler_h
--- a/gfx/layers/apz/public/APZUpdater.h +++ b/gfx/layers/apz/public/APZUpdater.h @@ -188,39 +188,39 @@ class APZUpdater { std::unordered_map<LayersId, EpochState, LayersId::HashFn> mEpochData; // Used to manage the mapping from a WR window id to APZUpdater. These are // only used if WebRender is enabled. Both sWindowIdMap and mWindowId should // only be used while holding the sWindowIdLock. Note that we use a // StaticAutoPtr wrapper on sWindowIdMap to avoid a static initializer for the // unordered_map. This also avoids the initializer/memory allocation in cases // where we're not using WebRender. - static StaticMutex sWindowIdLock; + static StaticMutex sWindowIdLock MOZ_UNANNOTATED; static StaticAutoPtr<std::unordered_map<uint64_t, APZUpdater*>> sWindowIdMap; Maybe<wr::WrWindowId> mWindowId; // Lock used to protected mUpdaterThreadId; - mutable Mutex mThreadIdLock; + mutable Mutex mThreadIdLock MOZ_UNANNOTATED; // If WebRender and async scene building are enabled, this holds the thread id // of the scene builder thread (which is the updater thread) for the // compositor associated with this APZUpdater instance. It may be populated // even if async scene building is not enabled, but in that case we don't // care about the contents. Maybe<PlatformThreadId> mUpdaterThreadId; // Helper struct that pairs each queued runnable with the layers id that it is // associated with. This allows us to easily implement the conceptual // separation of mUpdaterQueue into independent queues per layers id. struct QueuedTask { LayersId mLayersId; RefPtr<Runnable> mRunnable; }; // Lock used to protect mUpdaterQueue - Mutex mQueueLock; + Mutex mQueueLock MOZ_UNANNOTATED; // Holds a queue of tasks to be run on the updater thread, when the updater // thread is a WebRender thread, since it won't have a message loop we can // dispatch to. Note that although this is a single queue it is conceptually // separated into multiple ones, one per layers id. Tasks for a given layers // id will always run in FIFO order, but there is no guaranteed ordering for // tasks with different layers ids. std::deque<QueuedTask> mUpdaterQueue; };
--- a/gfx/layers/apz/src/APZCTreeManager.h +++ b/gfx/layers/apz/src/APZCTreeManager.h @@ -769,17 +769,17 @@ class APZCTreeManager : public IAPZCTree /* Whenever walking or mutating the tree rooted at mRootNode, mTreeLock must * be held. This lock does not need to be held while manipulating a single * APZC instance in isolation (that is, if its tree pointers are not being * accessed or mutated). The lock also needs to be held when accessing the * mRootNode instance variable, as that is considered part of the APZC tree * management state. * IMPORTANT: See the note about lock ordering at the top of this file. */ - mutable mozilla::RecursiveMutex mTreeLock; + mutable mozilla::RecursiveMutex mTreeLock MOZ_UNANNOTATED; RefPtr<HitTestingTreeNode> mRootNode; /* * A set of LayersIds for which APZCTM should only send empty * MatrixMessages via NotifyLayerTransform(). * This is used in cases where a tab has been transferred to a non-APZ * compositor (and thus will not receive MatrixMessages reflecting its new * transforms) and we need to make sure it doesn't get stuck with transforms @@ -791,17 +791,17 @@ class APZCTreeManager : public IAPZCTree /* If the current hit-testing tree contains an async zoom container * node, this is set to the layers id of subtree that has the node. */ Maybe<LayersId> mAsyncZoomContainerSubtree; /** A lock that protects mApzcMap, mScrollThumbInfo, mRootScrollbarInfo, * mFixedPositionInfo, and mStickyPositionInfo. */ - mutable mozilla::Mutex mMapLock; + mutable mozilla::Mutex mMapLock MOZ_UNANNOTATED; /** * Helper structure to store a bunch of things in mApzcMap so that they can * be used from the sampler thread. */ struct ApzcMapData { // A pointer to the APZC itself RefPtr<AsyncPanZoomController> apzc; @@ -998,29 +998,29 @@ class APZCTreeManager : public IAPZCTree class CheckerboardFlushObserver; friend class CheckerboardFlushObserver; RefPtr<CheckerboardFlushObserver> mFlushObserver; // Map from layers id to APZTestData. Accesses and mutations must be // protected by the mTestDataLock. std::unordered_map<LayersId, UniquePtr<APZTestData>, LayersId::HashFn> mTestData; - mutable mozilla::Mutex mTestDataLock; + mutable mozilla::Mutex mTestDataLock MOZ_UNANNOTATED; // This must only be touched on the controller thread. float mDPI; friend class IAPZHitTester; UniquePtr<IAPZHitTester> mHitTester; // NOTE: This ScrollGenerationCounter needs to be per APZCTreeManager since // the generation is bumped up on the sampler theread which is per // APZCTreeManager. ScrollGenerationCounter mScrollGenerationCounter; - mozilla::Mutex mScrollGenerationLock; + mozilla::Mutex mScrollGenerationLock MOZ_UNANNOTATED; #if defined(MOZ_WIDGET_ANDROID) private: // Last Frame metrics sent to java through UIController. GeckoViewMetrics mLastRootMetrics; #endif // defined(MOZ_WIDGET_ANDROID) };
--- a/gfx/layers/apz/src/AsyncPanZoomController.h +++ b/gfx/layers/apz/src/AsyncPanZoomController.h @@ -959,17 +959,17 @@ class AsyncPanZoomController { LayersId mLayersId; RefPtr<CompositorController> mCompositorController; /* Access to the following two fields is protected by the mRefPtrMonitor, since they are accessed on the UI thread but can be cleared on the updater thread. */ RefPtr<GeckoContentController> mGeckoContentController; RefPtr<GestureEventListener> mGestureEventListener; - mutable Monitor mRefPtrMonitor; + mutable Monitor mRefPtrMonitor MOZ_UNANNOTATED; // This is a raw pointer to avoid introducing a reference cycle between // AsyncPanZoomController and APZCTreeManager. Since these objects don't // live on the main thread, we can't use the cycle collector with them. // The APZCTreeManager owns the lifetime of the APZCs, so nulling this // pointer out in Destroy() will prevent accessing deleted memory. Atomic<APZCTreeManager*> mTreeManager; @@ -1008,17 +1008,17 @@ class AsyncPanZoomController { // cases, the monitor should still be held. Let's take mX.CanScroll for // example: // Axis::CanScroll(ParentLayerCoord) calls Axis::CanScroll() which calls // Axis::GetPageLength() which calls Axis::GetFrameMetrics() which calls // AsyncPanZoomController::GetFrameMetrics(), therefore, this monitor should // be held before calling the CanScroll function of |mX| and |mY|. These // coupled relationships bring us the burden of taking care of when the // monitor should be held, so they should be decoupled in the future. - mutable RecursiveMutex mRecursiveMutex; + mutable RecursiveMutex mRecursiveMutex MOZ_UNANNOTATED; private: // Metadata of the container layer corresponding to this APZC. This is // stored here so that it is accessible from the UI/controller thread. // These are the metrics at last content paint, the most recent // values we were notified of in NotifyLayersUpdate(). Since it represents // the Gecko state, it should be used as a basis for untransformation when // sending messages back to Gecko. @@ -1749,17 +1749,17 @@ class AsyncPanZoomController { * recording. */ private: // Helper function to update the in-progress checkerboard event, if any. void UpdateCheckerboardEvent(const MutexAutoLock& aProofOfLock, uint32_t aMagnitude); // Mutex protecting mCheckerboardEvent - Mutex mCheckerboardEventLock; + Mutex mCheckerboardEventLock MOZ_UNANNOTATED; // This is created when this APZC instance is first included as part of a // composite. If a checkerboard event takes place, this is destroyed at the // end of the event, and a new one is created on the next composite. UniquePtr<CheckerboardEvent> mCheckerboardEvent; // This is used to track the total amount of time that we could reasonably // be checkerboarding. Combined with other info, this allows us to // meaningfully say how frequently users actually encounter checkerboarding. PotentialCheckerboardDurationTracker mPotentialCheckerboardTracker;
--- a/gfx/layers/apz/src/CheckerboardEvent.h +++ b/gfx/layers/apz/src/CheckerboardEvent.h @@ -193,17 +193,17 @@ class CheckerboardEvent final { * during any one frame, during this checkerboarding event. */ uint32_t mPeakPixels; /** * Monitor that needs to be acquired before touching mBufferedProperties * or mRendertraceInfo. */ - mutable Monitor mRendertraceLock; + mutable Monitor mRendertraceLock MOZ_UNANNOTATED; /** * A circular buffer to store some properties. This is used before the * checkerboarding actually starts, so that we have some data on what * was happening before the checkerboarding started. */ PropertyBuffer mBufferedProperties[sRendertracePropertyCount]; /** * The rendertrace info buffer that gives us info on what was happening
--- a/gfx/layers/apz/src/FocusState.h +++ b/gfx/layers/apz/src/FocusState.h @@ -133,17 +133,17 @@ class FocusState final { * This can only be called by methods that have already acquired mMutex; they * have to pass their lock as compile-time proof. */ bool IsCurrent(const MutexAutoLock& aLock) const; private: // All methods should hold this lock, since this class is accessed via both // the updater and controller threads. - mutable Mutex mMutex; + mutable Mutex mMutex MOZ_UNANNOTATED; // The set of focus targets received indexed by their layer tree ID std::unordered_map<LayersId, FocusTarget, LayersId::HashFn> mFocusTree; // The focus sequence number of the last potentially focus changing event // processed by APZ. This number starts at one and increases monotonically. // We don't worry about wrap around here because at a pace of 100 // increments/sec, it would take 5.85*10^9 years before we would wrap around.
--- a/gfx/layers/apz/util/APZThreadUtils.cpp +++ b/gfx/layers/apz/util/APZThreadUtils.cpp @@ -14,17 +14,17 @@ #include "nsThreadUtils.h" #include "nsXULAppAPI.h" namespace mozilla { namespace layers { static bool sThreadAssertionsEnabled = true; static StaticRefPtr<nsISerialEventTarget> sControllerThread; -static StaticMutex sControllerThreadMutex; +static StaticMutex sControllerThreadMutex MOZ_UNANNOTATED; /*static*/ void APZThreadUtils::SetThreadAssertionsEnabled(bool aEnabled) { StaticMutexAutoLock lock(sControllerThreadMutex); sThreadAssertionsEnabled = aEnabled; } /*static*/
--- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -467,17 +467,17 @@ void DeallocateTextureClient(TextureDeal return; } } // First make sure that the work is happening on the IPDL thread. if (ipdlThread && !ipdlThread->IsOnCurrentThread()) { if (params.syncDeallocation) { bool done = false; - ReentrantMonitor barrier("DeallocateTextureClient"); + ReentrantMonitor barrier MOZ_UNANNOTATED("DeallocateTextureClient"); ReentrantMonitorAutoEnter autoMon(barrier); ipdlThread->Dispatch(NewRunnableFunction( "DeallocateTextureClientSyncProxyRunnable", DeallocateTextureClientSyncProxy, params, &barrier, &done)); while (!done) { barrier.Wait(); } } else {
--- a/gfx/layers/client/TextureClientRecycleAllocator.h +++ b/gfx/layers/client/TextureClientRecycleAllocator.h @@ -125,16 +125,16 @@ class TextureClientRecycleAllocator : pu static const uint32_t kMaxPooledSized = 2; uint32_t mMaxPooledSize; std::map<TextureClient*, RefPtr<TextureClientHolder> > mInUseClients; // stack is good from Graphics cache usage point of view. std::stack<RefPtr<TextureClientHolder> > mPooledClients; - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; bool mIsDestroyed; }; } // namespace layers } // namespace mozilla #endif /* MOZILLA_GFX_TEXTURECLIENT_RECYCLE_ALLOCATOR_H */
--- a/gfx/layers/d3d11/TextureD3D11.h +++ b/gfx/layers/d3d11/TextureD3D11.h @@ -504,17 +504,17 @@ class SyncObjectD3D11Client : public Syn SyncType GetSyncType() override { return SyncType::D3D11; } void RegisterTexture(ID3D11Texture2D* aTexture); protected: explicit SyncObjectD3D11Client(SyncHandle aSyncHandle); bool Init(ID3D11Device* aDevice, bool aFallible); bool SynchronizeInternal(ID3D11Device* aDevice, bool aFallible); - Mutex mSyncLock; + Mutex mSyncLock MOZ_UNANNOTATED; RefPtr<ID3D11Texture2D> mSyncTexture; std::vector<ID3D11Texture2D*> mSyncedTextures; private: const SyncHandle mSyncHandle; RefPtr<IDXGIKeyedMutex> mKeyedMutex; const RefPtr<ID3D11Device> mDevice; };
--- a/gfx/layers/ipc/CompositableInProcessManager.h +++ b/gfx/layers/ipc/CompositableInProcessManager.h @@ -54,16 +54,16 @@ class CompositableInProcessManager final static uint64_t GetShiftedNamespace() { MOZ_ASSERT(sNamespace != 0); return static_cast<uint64_t>(sNamespace) << 32; } static std::map<std::pair<base::ProcessId, uint64_t>, RefPtr<WebRenderImageHost>> sCompositables; - static StaticMutex sMutex; + static StaticMutex sMutex MOZ_UNANNOTATED; static uint32_t sNamespace; static Atomic<uint32_t> sNextResourceId; static Atomic<uint64_t> sNextHandle; }; } // namespace mozilla::layers
--- a/gfx/layers/ipc/CompositorBridgeParent.h +++ b/gfx/layers/ipc/CompositorBridgeParent.h @@ -691,18 +691,18 @@ class CompositorBridgeParent final : pub bool mHaveCompositionRecorder; bool mIsForcedFirstPaint; bool mUseExternalSurfaceSize; gfx::IntSize mEGLSurfaceSize; CompositorOptions mOptions; - mozilla::Monitor mPauseCompositionMonitor; - mozilla::Monitor mResumeCompositionMonitor; + mozilla::Monitor mPauseCompositionMonitor MOZ_UNANNOTATED; + mozilla::Monitor mResumeCompositionMonitor MOZ_UNANNOTATED; uint64_t mCompositorBridgeID; LayersId mRootLayerTreeID; bool mOverrideComposeReadiness; RefPtr<CancelableRunnable> mForceCompositionTask; RefPtr<APZCTreeManager> mApzcTreeManager;
--- a/gfx/layers/ipc/CompositorManagerParent.h +++ b/gfx/layers/ipc/CompositorManagerParent.h @@ -60,17 +60,17 @@ class CompositorManagerParent final : pu already_AddRefed<PCompositorBridgeParent> AllocPCompositorBridgeParent( const CompositorBridgeOptions& aOpt); static void NotifyWebRenderError(wr::WebRenderError aError); private: static StaticRefPtr<CompositorManagerParent> sInstance; - static StaticMutex sMutex; + static StaticMutex sMutex MOZ_UNANNOTATED; #ifdef COMPOSITOR_MANAGER_PARENT_EXPLICIT_SHUTDOWN static StaticAutoPtr<nsTArray<CompositorManagerParent*>> sActiveActors; static void ShutdownInternal(); #endif CompositorManagerParent(); virtual ~CompositorManagerParent();
--- a/gfx/layers/ipc/CompositorVsyncScheduler.h +++ b/gfx/layers/ipc/CompositorVsyncScheduler.h @@ -145,17 +145,17 @@ class CompositorVsyncScheduler { public: explicit Observer(CompositorVsyncScheduler* aOwner); bool NotifyVsync(const VsyncEvent& aVsync) override; void Destroy(); private: virtual ~Observer(); - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; // Hold raw pointer to avoid mutual reference. CompositorVsyncScheduler* mOwner; }; CompositorVsyncSchedulerOwner* mVsyncSchedulerOwner; SampleTime mLastComposeTime; TimeStamp mLastVsyncTime; TimeStamp mLastVsyncOutputTime; @@ -165,21 +165,21 @@ class CompositorVsyncScheduler { bool mIsObservingVsync; // Accessed on the compositor thread. wr::RenderReasons mRendersDelayedByVsyncReasons; TimeStamp mCompositeRequestedAt; int32_t mVsyncNotificationsSkipped; widget::CompositorWidget* mWidget; RefPtr<CompositorVsyncScheduler::Observer> mVsyncObserver; - mozilla::Monitor mCurrentCompositeTaskMonitor; + mozilla::Monitor mCurrentCompositeTaskMonitor MOZ_UNANNOTATED; RefPtr<CancelableRunnable> mCurrentCompositeTask; // Accessed on multiple threads, guarded by mCurrentCompositeTaskMonitor. wr::RenderReasons mCurrentCompositeTaskReasons; - mozilla::Monitor mCurrentVRTaskMonitor; + mozilla::Monitor mCurrentVRTaskMonitor MOZ_UNANNOTATED; RefPtr<CancelableRunnable> mCurrentVRTask; }; } // namespace layers } // namespace mozilla #endif // mozilla_layers_CompositorVsyncScheduler_h
--- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -173,17 +173,17 @@ void ImageBridgeChild::NotifyNotUsed(uin } void ImageBridgeChild::CancelWaitForNotifyNotUsed(uint64_t aTextureId) { MOZ_ASSERT(InImageBridgeChildThread()); mTexturesWaitingNotifyNotUsed.erase(aTextureId); } // Singleton -static StaticMutex sImageBridgeSingletonLock; +static StaticMutex sImageBridgeSingletonLock MOZ_UNANNOTATED; static StaticRefPtr<ImageBridgeChild> sImageBridgeChildSingleton; static StaticRefPtr<nsIThread> sImageBridgeChildThread; // dispatched function void ImageBridgeChild::ShutdownStep1(SynchronousTask* aTask) { AutoCompleteTask complete(aTask); MOZ_ASSERT(InImageBridgeChildThread(),
--- a/gfx/layers/ipc/ImageBridgeChild.h +++ b/gfx/layers/ipc/ImageBridgeChild.h @@ -349,17 +349,17 @@ class ImageBridgeChild final : public PI * It defer calling of TextureClient recycle callback. */ std::unordered_map<uint64_t, RefPtr<TextureClient>> mTexturesWaitingNotifyNotUsed; /** * Mapping from async compositable IDs to image containers. */ - Mutex mContainerMapLock; + Mutex mContainerMapLock MOZ_UNANNOTATED; std::unordered_map<uint64_t, RefPtr<ImageContainerListener>> mImageContainerListeners; RefPtr<ImageContainerListener> FindListener( const CompositableHandle& aHandle); }; } // namespace layers } // namespace mozilla
--- a/gfx/layers/ipc/LayerTreeOwnerTracker.h +++ b/gfx/layers/ipc/LayerTreeOwnerTracker.h @@ -58,16 +58,16 @@ class LayerTreeOwnerTracker final { void Iterate( const std::function<void(LayersId aLayersId, base::ProcessId aProcessId)>& aCallback); private: LayerTreeOwnerTracker(); - mozilla::Mutex mLayerIdsLock; + mozilla::Mutex mLayerIdsLock MOZ_UNANNOTATED; std::map<LayersId, base::ProcessId> mLayerIds; }; } // namespace layers } // namespace mozilla #endif // mozilla_layers_LayerTreeOwnerTracker_h
--- a/gfx/layers/ipc/SharedSurfacesParent.h +++ b/gfx/layers/ipc/SharedSurfacesParent.h @@ -86,17 +86,17 @@ class SharedSurfacesParent final { static bool AgeOneGenerationLocked( nsTArray<RefPtr<gfx::SourceSurfaceSharedDataWrapper>>& aExpired, const StaticMonitorAutoLock& aAutoLock); static void ExpireMap( nsTArray<RefPtr<gfx::SourceSurfaceSharedDataWrapper>>& aExpired); - static StaticMonitor sMonitor; + static StaticMonitor sMonitor MOZ_UNANNOTATED; static StaticAutoPtr<SharedSurfacesParent> sInstance; nsRefPtrHashtable<nsUint64HashKey, gfx::SourceSurfaceSharedDataWrapper> mSurfaces; class MappingTracker final : public ExpirationTrackerImpl<gfx::SourceSurfaceSharedDataWrapper, 4,
--- a/gfx/layers/ipc/SynchronousTask.h +++ b/gfx/layers/ipc/SynchronousTask.h @@ -28,17 +28,17 @@ class MOZ_STACK_CLASS SynchronousTask { private: void Complete() { mDone = true; mMonitor.NotifyAll(); } private: - ReentrantMonitor mMonitor; + ReentrantMonitor mMonitor MOZ_UNANNOTATED; ReentrantMonitorAutoEnter mAutoEnter; bool mDone; }; class MOZ_STACK_CLASS AutoCompleteTask final { public: explicit AutoCompleteTask(SynchronousTask* aTask) : mTask(aTask), mAutoEnter(aTask->mMonitor) {}
--- a/gfx/layers/wr/AsyncImagePipelineManager.h +++ b/gfx/layers/wr/AsyncImagePipelineManager.h @@ -258,17 +258,17 @@ class AsyncImagePipelineManager final { ipc::FileDescriptor&& aFenceFd); ~WebRenderPipelineInfoHolder(); RefPtr<const wr::WebRenderPipelineInfo> mInfo; ipc::FileDescriptor mFenceFd; }; std::vector<std::pair<wr::RenderedFrameId, WebRenderPipelineInfoHolder>> mRenderSubmittedUpdates; - Mutex mRenderSubmittedUpdatesLock; + Mutex mRenderSubmittedUpdatesLock MOZ_UNANNOTATED; Atomic<uint64_t> mLastCompletedFrameId; std::vector<std::pair<wr::RenderedFrameId, std::vector<UniquePtr<ForwardingTextureHost>>>> mTexturesInUseByGPU; ipc::FileDescriptor mReleaseFenceFd; };
--- a/gfx/layers/wr/OMTASampler.h +++ b/gfx/layers/wr/OMTASampler.h @@ -114,37 +114,37 @@ class OMTASampler final { private: WrAnimations SampleAnimations(const TimeStamp& aPreviousSampleTime, const TimeStamp& aSampleTime); RefPtr<OMTAController> mController; // Can only be accessed or modified while holding mStorageLock. RefPtr<CompositorAnimationStorage> mAnimStorage; - mutable Mutex mStorageLock; + mutable Mutex mStorageLock MOZ_UNANNOTATED; // Used to manage the mapping from a WR window id to OMTASampler. These are // only used if WebRender is enabled. Both sWindowIdMap and mWindowId should // only be used while holding the sWindowIdLock. Note that we use a // StaticAutoPtr wrapper on sWindowIdMap to avoid a static initializer for the // unordered_map. This also avoids the initializer/memory allocation in cases // where we're not using WebRender. - static StaticMutex sWindowIdLock; + static StaticMutex sWindowIdLock MOZ_UNANNOTATED; static StaticAutoPtr<std::unordered_map<uint64_t, RefPtr<OMTASampler>>> sWindowIdMap; Maybe<wr::WrWindowId> mWindowId; // Lock used to protected mSamplerThreadId - mutable Mutex mThreadIdLock; + mutable Mutex mThreadIdLock MOZ_UNANNOTATED; // If WebRender is enabled, this holds the thread id of the render backend // thread (which is the sampler thread) for the compositor associated with // this OMTASampler instance. Maybe<PlatformThreadId> mSamplerThreadId; - Mutex mSampleTimeLock; + Mutex mSampleTimeLock MOZ_UNANNOTATED; // Can only be accessed or modified while holding mSampleTimeLock. TimeStamp mSampleTime; // Same as |mSampleTime|, can only be accessed or modified while holding // mSampleTimeLock. // We basically use this time stamp instead of |mSampleTime| to make // animations more in sync with other animations on the main thread. TimeStamp mPreviousSampleTime; Atomic<bool> mIsInTestMode;
--- a/gfx/src/gfxCrashReporterUtils.cpp +++ b/gfx/src/gfxCrashReporterUtils.cpp @@ -22,17 +22,17 @@ #include "nsIRunnable.h" // for nsIRunnable #include "nsISupports.h" #include "nsTArray.h" // for nsTArray #include "nscore.h" // for NS_IMETHOD, NS_IMETHODIMP, etc namespace mozilla { static nsTArray<nsCString>* gFeaturesAlreadyReported = nullptr; -static StaticMutex gFeaturesAlreadyReportedMutex; +static StaticMutex gFeaturesAlreadyReportedMutex MOZ_UNANNOTATED; class ObserverToDestroyFeaturesAlreadyReported final : public nsIObserver { public: NS_DECL_ISUPPORTS NS_DECL_NSIOBSERVER ObserverToDestroyFeaturesAlreadyReported() = default;
--- a/gfx/tests/gtest/TestVsync.cpp +++ b/gfx/tests/gtest/TestVsync.cpp @@ -62,17 +62,17 @@ class TestVsyncObserver : public VsyncOb } private: ~TestVsyncObserver() = default; bool mDidGetVsyncNotification; private: - Monitor mVsyncMonitor; + Monitor mVsyncMonitor MOZ_UNANNOTATED; }; class VsyncTester : public ::testing::Test { protected: explicit VsyncTester() { gfxPlatform::GetPlatform(); mVsyncSource = gfxPlatform::GetPlatform()->GetHardwareVsync(); MOZ_RELEASE_ASSERT(mVsyncSource, "GFX: Vsync source not found.");
--- a/gfx/thebes/DeviceManagerDx.h +++ b/gfx/thebes/DeviceManagerDx.h @@ -167,17 +167,17 @@ class DeviceManagerDx final { // This is assigned during device creation. Afterwards, it is released if // devices failed, and "forgotten" if devices succeeded (meaning, we leak // the ref and unassign the module). nsModuleHandle mD3D11Module; nsModuleHandle mDcompModule; - mozilla::Mutex mDeviceLock; + mozilla::Mutex mDeviceLock MOZ_UNANNOTATED; nsTArray<D3D_FEATURE_LEVEL> mFeatureLevels; RefPtr<IDXGIAdapter1> mAdapter; RefPtr<ID3D11Device> mCompositorDevice; RefPtr<ID3D11Device> mContentDevice; RefPtr<ID3D11Device> mCanvasDevice; RefPtr<ID3D11Device> mImageDevice; RefPtr<ID3D11Device> mVRDevice; RefPtr<ID3D11Device> mDecoderDevice;
--- a/gfx/thebes/VsyncSource.h +++ b/gfx/thebes/VsyncSource.h @@ -89,17 +89,17 @@ class VsyncSource { static Maybe<TimeDuration> GetFastestVsyncRate(); protected: virtual ~VsyncSource(); private: void UpdateVsyncStatus(); - Mutex mDispatcherLock; + Mutex mDispatcherLock MOZ_UNANNOTATED; bool mRefreshTimerNeedsVsync; nsTArray<RefPtr<CompositorVsyncDispatcher>> mEnabledCompositorVsyncDispatchers; nsTArray<RefPtr<CompositorVsyncDispatcher>> mRegisteredCompositorVsyncDispatchers; RefPtr<RefreshTimerVsyncDispatcher> mRefreshTimerVsyncDispatcher; nsTArray<RefPtr<VsyncObserver>> mGenericObservers; // can only be touched from the main thread
--- a/gfx/thebes/gfxDWriteCommon.cpp +++ b/gfx/thebes/gfxDWriteCommon.cpp @@ -8,17 +8,17 @@ #include <unordered_map> #include "mozilla/Atomics.h" #include "mozilla/StaticMutex.h" #include "mozilla/gfx/Logging.h" class gfxDWriteFontFileStream; -static mozilla::StaticMutex sFontFileStreamsMutex; +static mozilla::StaticMutex sFontFileStreamsMutex MOZ_UNANNOTATED; static uint64_t sNextFontFileKey = 0; static std::unordered_map<uint64_t, gfxDWriteFontFileStream*> sFontFileStreams; IDWriteFontFileLoader* gfxDWriteFontFileLoader::mInstance = nullptr; class gfxDWriteFontFileStream final : public IDWriteFontFileStream { public: /**
--- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -204,17 +204,17 @@ class CrashStatsLogForwarder : public mo // Helper for the Log() void UpdateCrashReport(); private: LoggingRecord mBuffer; CrashReporter::Annotation mCrashCriticalKey; uint32_t mMaxCapacity; int32_t mIndex; - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; }; CrashStatsLogForwarder::CrashStatsLogForwarder(CrashReporter::Annotation aKey) : mBuffer(), mCrashCriticalKey(aKey), mMaxCapacity(0), mIndex(-1), mMutex("CrashStatsLogForwarder") {}
--- a/gfx/thebes/gfxPlatformFontList.h +++ b/gfx/thebes/gfxPlatformFontList.h @@ -862,17 +862,17 @@ class gfxPlatformFontList : public gfxFo const FontEntryTable& aTable, mozilla::MallocSizeOf aMallocSizeOf); // Platform-specific helper for GetDefaultFont(...). virtual FontFamily GetDefaultFontForPlatform(nsPresContext* aPresContext, const gfxFontStyle* aStyle, nsAtom* aLanguage = nullptr) = 0; // Protects mFontFamilies. - mozilla::Mutex mFontFamiliesMutex; + mozilla::Mutex mFontFamiliesMutex MOZ_UNANNOTATED; // canonical family name ==> family entry (unique, one name per family entry) FontFamilyTable mFontFamilies; // other family name ==> family entry (not unique, can have multiple names per // family entry, only names *other* than the canonical names are stored here) FontFamilyTable mOtherFamilyNames;
--- a/gfx/thebes/gfxPlatformGtk.cpp +++ b/gfx/thebes/gfxPlatformGtk.cpp @@ -840,20 +840,20 @@ class GtkVsyncSource final : public Vsyn mGLContext = nullptr; if (mXDisplay) XCloseDisplay(mXDisplay); } // Owned by the vsync thread. RefPtr<gl::GLContextGLX> mGLContext; _XDisplay* mXDisplay; - Monitor mSetupLock; + Monitor mSetupLock MOZ_UNANNOTATED; base::Thread mVsyncThread; RefPtr<Runnable> mVsyncTask; - Monitor mVsyncEnabledLock; + Monitor mVsyncEnabledLock MOZ_UNANNOTATED; bool mVsyncEnabled; }; class XrandrSoftwareVsyncSource final : public SoftwareVsyncSource { public: XrandrSoftwareVsyncSource() { MOZ_ASSERT(NS_IsMainThread());
--- a/gfx/vr/VRManager.h +++ b/gfx/vr/VRManager.h @@ -154,17 +154,17 @@ class VRManager : nsIObserver { bool mEnumerationRequested; bool mEnumerationCompleted; bool mVRDisplaysRequested; bool mVRDisplaysRequestedNonFocus; bool mVRControllersRequested; bool mFrameStarted; uint32_t mTaskInterval; RefPtr<nsITimer> mTaskTimer; - mozilla::Monitor mCurrentSubmitTaskMonitor; + mozilla::Monitor mCurrentSubmitTaskMonitor MOZ_UNANNOTATED; RefPtr<CancelableRunnable> mCurrentSubmitTask; uint64_t mLastSubmittedFrameId; uint64_t mLastStartedFrame; VRDisplayCapabilityFlags mRuntimeSupportFlags; bool mAppPaused; // Note: mShmem doesn't support RefPtr; thus, do not share this private // pointer so that its lifetime can still be controlled by VRManager
--- a/gfx/vr/VRPuppetCommandBuffer.h +++ b/gfx/vr/VRPuppetCommandBuffer.h @@ -203,17 +203,17 @@ class VRPuppetCommandBuffer { VRPuppetCommandBuffer(); ~VRPuppetCommandBuffer(); void Run(); bool RunCommand(uint64_t aCommand, double aDeltaTime); void WriteData(uint8_t aData); void SimulateHaptics(double aDeltaTime); void CompleteTest(bool aTimedOut); nsTArray<uint64_t> mBuffer; - mozilla::Mutex mMutex; + mozilla::Mutex mMutex MOZ_UNANNOTATED; VRSystemState mPendingState; VRSystemState mCommittedState; double mHapticPulseRemaining[kVRControllerMaxCount][kNumPuppetHaptics]; float mHapticPulseIntensity[kVRControllerMaxCount][kNumPuppetHaptics]; size_t mDataOffset; bool mPresentationRequested; bool mFrameSubmitted;
--- a/gfx/vr/service/OpenVRSession.h +++ b/gfx/vr/service/OpenVRSession.h @@ -97,16 +97,16 @@ class OpenVRSession : public VRSession { mozilla::gfx::VRControllerType& aControllerType); void UpdateHaptics(); void StartHapticThread(); void StopHapticThread(); void StartHapticTimer(); void StopHapticTimer(); RefPtr<nsITimer> mHapticTimer; RefPtr<VRThread> mHapticThread; - mozilla::Mutex mControllerHapticStateMutex; + mozilla::Mutex mControllerHapticStateMutex MOZ_UNANNOTATED; UniquePtr<OpenVRControllerMapper> mControllerMapper; }; } // namespace gfx } // namespace mozilla #endif // GFX_VR_SERVICE_OPENVRSESSION_H
--- a/gfx/webrender_bindings/RenderThread.h +++ b/gfx/webrender_bindings/RenderThread.h @@ -355,17 +355,17 @@ class RenderThread final { DataMutex<std::unordered_map<uint64_t, WindowInfo*>> mWindowInfos; struct ExternalImageIdHashFn { std::size_t operator()(const wr::ExternalImageId& aId) const { return HashGeneric(wr::AsUint64(aId)); } }; - Mutex mRenderTextureMapLock; + Mutex mRenderTextureMapLock MOZ_UNANNOTATED; std::unordered_map<wr::ExternalImageId, RefPtr<RenderTextureHost>, ExternalImageIdHashFn> mRenderTextures; std::unordered_map<wr::ExternalImageId, RefPtr<RenderTextureHost>, ExternalImageIdHashFn> mSyncObjectNeededRenderTextures; std::list<std::pair<RenderTextureOp, RefPtr<RenderTextureHost>>> mRenderTextureOps;
--- a/image/AnimationSurfaceProvider.h +++ b/image/AnimationSurfaceProvider.h @@ -108,23 +108,23 @@ class AnimationSurfaceProvider final : p // @returns Whether or not we should restart decoding. bool CheckForNewFrameAtTerminalState(); /// The image associated with our decoder. RefPtr<RasterImage> mImage; /// A mutex to protect mDecoder. Always taken before mFramesMutex. - mutable Mutex mDecodingMutex; + mutable Mutex mDecodingMutex MOZ_UNANNOTATED; /// The decoder used to decode this animation. RefPtr<Decoder> mDecoder; /// A mutex to protect mFrames. Always taken after mDecodingMutex. - mutable Mutex mFramesMutex; + mutable Mutex mFramesMutex MOZ_UNANNOTATED; /// The frames of this animation, in order. UniquePtr<AnimationFrameBuffer> mFrames; /// Whether the current frame was requested for display since the last time we /// advanced the animation. bool mCompositedFrameRequested;
--- a/image/DecodePool.h +++ b/image/DecodePool.h @@ -93,16 +93,16 @@ class DecodePool final : public nsIObser DecodePool(); virtual ~DecodePool(); static StaticRefPtr<DecodePool> sSingleton; static uint32_t sNumCores; bool mShuttingDown = false; // mMutex protects mIOThread. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; nsCOMPtr<nsIThread> mIOThread; }; } // namespace image } // namespace mozilla #endif // mozilla_image_DecodePool_h
--- a/image/DecodedSurfaceProvider.h +++ b/image/DecodedSurfaceProvider.h @@ -70,17 +70,17 @@ class DecodedSurfaceProvider final : pub void DropImageReference(); void CheckForNewSurface(); void FinishDecoding(); /// The image associated with our decoder. Dropped after decoding. RefPtr<RasterImage> mImage; /// Mutex protecting access to mDecoder. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; /// The decoder that will generate our surface. Dropped after decoding. RefPtr<Decoder> mDecoder; /// Our surface. Initially null until it's generated by the decoder. RefPtr<imgFrame> mSurface; /// A drawable reference to our service; used for locking.
--- a/image/IDecodingTask.h +++ b/image/IDecodingTask.h @@ -81,17 +81,17 @@ class MetadataDecodingTask final : publi // Metadata decodes run at the highest priority because they block layout and // page load. TaskPriority Priority() const override { return TaskPriority::eHigh; } private: virtual ~MetadataDecodingTask() {} /// Mutex protecting access to mDecoder. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; NotNull<RefPtr<Decoder>> mDecoder; }; /** * An IDecodingTask implementation for anonymous decoders - that is, decoders * with no associated Image object. */
--- a/image/ProgressTracker.h +++ b/image/ProgressTracker.h @@ -221,17 +221,17 @@ class ProgressTracker : public mozilla:: static already_AddRefed<RenderBlockingRunnable> Create( already_AddRefed<AsyncNotifyRunnable>&& aEvent); }; // The runnable, if any, that we've scheduled to deliver async notifications. RefPtr<RenderBlockingRunnable> mRunnable; // mMutex protects access to mImage and mEventTarget. - mutable Mutex mMutex; + mutable Mutex mMutex MOZ_UNANNOTATED; // mImage is a weak ref; it should be set to null when the image goes out of // scope. Image* mImage; // mEventTarget is the current, best effort event target to dispatch // notifications to from the decoder threads. It will change as observers are // added and removed (see mObserversWithTargets).
--- a/image/SourceBuffer.h +++ b/image/SourceBuffer.h @@ -470,17 +470,17 @@ class SourceBuffer final { bool IsEmpty(); bool IsLastChunk(uint32_t aChunk); ////////////////////////////////////////////////////////////////////////////// // Member variables. ////////////////////////////////////////////////////////////////////////////// /// All private members are protected by mMutex. - mutable Mutex mMutex; + mutable Mutex mMutex MOZ_UNANNOTATED; /// The data in this SourceBuffer, stored as a series of Chunks. AutoTArray<Chunk, 1> mChunks; /// Consumers which are waiting to be notified when new data is available. nsTArray<RefPtr<IResumable>> mWaitingConsumers; /// If present, marks this SourceBuffer complete with the given final status.
--- a/image/SurfaceCache.cpp +++ b/image/SurfaceCache.cpp @@ -55,17 +55,17 @@ class SurfaceCacheImpl; /////////////////////////////////////////////////////////////////////////////// // Static Data /////////////////////////////////////////////////////////////////////////////// // The single surface cache instance. static StaticRefPtr<SurfaceCacheImpl> sInstance; // The mutex protecting the surface cache. -static StaticMutex sInstanceMutex; +static StaticMutex sInstanceMutex MOZ_UNANNOTATED; /////////////////////////////////////////////////////////////////////////////// // SurfaceCache Implementation /////////////////////////////////////////////////////////////////////////////// /** * Cost models the cost of storing a surface in the cache. Right now, this is * simply an estimate of the size of the surface in bytes, but in the future it
--- a/image/encoders/jpeg/nsJPEGEncoder.h +++ b/image/encoders/jpeg/nsJPEGEncoder.h @@ -63,12 +63,12 @@ class nsJPEGEncoder final : public imgIE nsCOMPtr<nsIInputStreamCallback> mCallback; nsCOMPtr<nsIEventTarget> mCallbackTarget; uint32_t mNotifyThreshold; // nsJPEGEncoder is designed to allow one thread to pump data into it while // another reads from it. We lock to ensure that the buffer remains // append-only while we read from it (that it is not realloced) and to ensure // that only one thread dispatches a callback for each call to AsyncWait. - ReentrantMonitor mReentrantMonitor; + ReentrantMonitor mReentrantMonitor MOZ_UNANNOTATED; }; #endif // mozilla_image_encoders_jpeg_nsJPEGEncoder_h
--- a/image/encoders/png/nsPNGEncoder.h +++ b/image/encoders/png/nsPNGEncoder.h @@ -69,11 +69,11 @@ class nsPNGEncoder final : public imgIEn nsCOMPtr<nsIEventTarget> mCallbackTarget; uint32_t mNotifyThreshold; // nsPNGEncoder is designed to allow one thread to pump data into it while // another reads from it. We lock to ensure that the buffer remains // append-only while we read from it (that it is not realloced) and to // ensure that only one thread dispatches a callback for each call to // AsyncWait. - ReentrantMonitor mReentrantMonitor; + ReentrantMonitor mReentrantMonitor MOZ_UNANNOTATED; }; #endif // mozilla_image_encoders_png_nsPNGEncoder_h
--- a/image/encoders/webp/nsWebPEncoder.h +++ b/image/encoders/webp/nsWebPEncoder.h @@ -53,11 +53,11 @@ class nsWebPEncoder final : public imgIE nsCOMPtr<nsIEventTarget> mCallbackTarget; uint32_t mNotifyThreshold; // nsWebPEncoder is designed to allow one thread to pump data into it while // another reads from it. We lock to ensure that the buffer remains // append-only while we read from it (that it is not realloced) and to // ensure that only one thread dispatches a callback for each call to // AsyncWait. - ReentrantMonitor mReentrantMonitor; + ReentrantMonitor mReentrantMonitor MOZ_UNANNOTATED; }; #endif // mozilla_image_encoders_webp_nsWebPEncoder_h
--- a/image/imgFrame.h +++ b/image/imgFrame.h @@ -214,17 +214,17 @@ class imgFrame { friend class DrawableFrameRef; friend class RawAccessFrameRef; friend class UnlockImageDataRunnable; ////////////////////////////////////////////////////////////////////////////// // Thread-safe mutable data, protected by mMonitor. ////////////////////////////////////////////////////////////////////////////// - mutable Monitor mMonitor; + mutable Monitor mMonitor MOZ_UNANNOTATED; /** * Used for rasterized images, this contains the raw pixel data. */ RefPtr<SourceSurfaceSharedData> mRawSurface; RefPtr<SourceSurfaceSharedData> mBlankRawSurface; /**
--- a/image/imgLoader.h +++ b/image/imgLoader.h @@ -412,17 +412,17 @@ class imgLoader final : public imgILoade // Hash set of every imgRequest for this loader that isn't in mCache or // mChromeCache. The union over all imgLoader's of mCache, mChromeCache, and // mUncachedImages should be every imgRequest that is alive. These are weak // pointers so we rely on the imgRequest destructor to remove itself. imgSet mUncachedImages; // The imgRequest can have refs to them held on non-main thread, so we need // a mutex because we modify the uncached images set from the imgRequest // destructor. - Mutex mUncachedImagesMutex; + Mutex mUncachedImagesMutex MOZ_UNANNOTATED; static double sCacheTimeWeight; static uint32_t sCacheMaxSize; static imgMemoryReporter* sMemReporter; mozilla::UniquePtr<imgCacheExpirationTracker> mCacheTracker; bool mRespectPrivacy; };
--- a/image/imgRequest.h +++ b/image/imgRequest.h @@ -273,17 +273,17 @@ class imgRequest final : public nsIStrea // The categories of prioritization strategy that have been requested. uint32_t mBoostCategoriesRequested = 0; // If we've called OnImageAvailable. bool mImageAvailable; bool mIsDeniedCrossSiteCORSRequest; bool mIsCrossSiteNoCORSRequest; - mutable mozilla::Mutex mMutex; + mutable mozilla::Mutex mMutex MOZ_UNANNOTATED; // Member variables protected by mMutex. Note that *all* flags in our bitfield // are protected by mMutex; if you're adding a new flag that isn'protected, it // must not be a part of this bitfield. RefPtr<ProgressTracker> mProgressTracker; RefPtr<Image> mImage; // The ID of the inner window origin, used for error reporting, profiles. uint64_t mInnerWindowId;
--- a/intl/strres/nsStringBundle.cpp +++ b/intl/strres/nsStringBundle.cpp @@ -133,17 +133,17 @@ class StringBundleProxy : public nsIStri mozilla::MallocSizeOf aMallocSizeOf) const override { return mRefCnt == 1 ? SizeOfIncludingThis(aMallocSizeOf) : 0; } protected: virtual ~StringBundleProxy() = default; private: - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; nsCOMPtr<nsIStringBundle> mTarget; // Atomically reads mTarget and returns a strong reference to it. This // allows for safe multi-threaded use when the proxy may be retargetted by // the main thread during access. nsCOMPtr<nsIStringBundle> Target() { MutexAutoLock automon(mMutex); return mTarget;
--- a/intl/strres/nsStringBundle.h +++ b/intl/strres/nsStringBundle.h @@ -48,17 +48,17 @@ class nsStringBundleBase : public nsIStr virtual nsresult GetStringImpl(const nsACString& aName, nsAString& aResult) = 0; virtual nsresult GetSimpleEnumerationImpl(nsISimpleEnumerator** elements) = 0; void RegisterMemoryReporter(); nsCString mPropertiesURL; - mozilla::Mutex mMutex; + mozilla::Mutex mMutex MOZ_UNANNOTATED; bool mAttemptedLoad; bool mLoaded; size_t SizeOfIncludingThisIfUnshared( mozilla::MallocSizeOf aMallocSizeOf) const override; public: static nsresult FormatString(const char16_t* formatStr,
--- a/ipc/chromium/gtest/ports_unittest.cc +++ b/ipc/chromium/gtest/ports_unittest.cc @@ -301,17 +301,17 @@ class TestNode : public NodeDelegate { Node node_; MessageRouter* router_ = nullptr; base::Thread node_thread_; base::WaitableEvent events_available_event_; base::WaitableEvent idle_event_; // Guards fields below. - mozilla::Mutex lock_{"TestNode"}; + mozilla::Mutex lock_ MOZ_UNANNOTATED{"TestNode"}; bool started_ = false; bool dispatching_ = false; bool should_quit_ = false; bool drop_messages_ = false; bool save_messages_ = false; bool blocked_ = false; bool block_on_event_ = false; Event::Type blocked_event_type_{}; @@ -440,19 +440,19 @@ class PortsTest : public testing::Test, continue; } node->EnqueueEvent(event->Clone()); } } // Acquired before any operation which makes a Node busy, and before testing // if all nodes are idle. - mozilla::Mutex global_lock_{"PortsTest Global Lock"}; + mozilla::Mutex global_lock_ MOZ_UNANNOTATED{"PortsTest Global Lock"}; - mozilla::Mutex lock_{"PortsTest Lock"}; + mozilla::Mutex lock_ MOZ_UNANNOTATED{"PortsTest Lock"}; std::map<NodeName, TestNode*> nodes_; }; } // namespace TEST_F(PortsTest, Basic1) { TestNode node0(0); AddNode(&node0);
--- a/ipc/chromium/src/base/at_exit.h +++ b/ipc/chromium/src/base/at_exit.h @@ -59,17 +59,17 @@ class AtExitManager { private: struct CallbackAndParam { CallbackAndParam(AtExitCallbackType func, void* param) : func_(func), param_(param) {} AtExitCallbackType func_; void* param_; }; - mozilla::Mutex lock_; + mozilla::Mutex lock_ MOZ_UNANNOTATED; std::stack<CallbackAndParam> stack_; AtExitManager* next_manager_; // Stack of managers to allow shadowing. DISALLOW_COPY_AND_ASSIGN(AtExitManager); }; } // namespace base
--- a/ipc/chromium/src/base/message_loop.cc +++ b/ipc/chromium/src/base/message_loop.cc @@ -106,17 +106,17 @@ class MessageLoop::EventTarget : public mozilla::MutexAutoLock lock(mMutex); // The MessageLoop is being destroyed and we are called from its destructor // There's no real need to remove ourselves from the destruction observer // list. But it makes things look tidier. mLoop->RemoveDestructionObserver(this); mLoop = nullptr; } - mozilla::Mutex mMutex; + mozilla::Mutex mMutex MOZ_UNANNOTATED; MessageLoop* mLoop; }; NS_IMPL_ISUPPORTS(MessageLoop::EventTarget, nsIEventTarget, nsISerialEventTarget) NS_IMETHODIMP_(bool) MessageLoop::EventTarget::IsOnCurrentThreadInfallible() {
--- a/ipc/chromium/src/base/message_loop.h +++ b/ipc/chromium/src/base/message_loop.h @@ -418,17 +418,17 @@ class MessageLoop : public base::Message std::string thread_name_; // A null terminated list which creates an incoming_queue of tasks that are // aquired under a mutex for processing on this instance's thread. These tasks // have not yet been sorted out into items for our work_queue_ vs items that // will be handled by the TimerManager. TaskQueue incoming_queue_; // Protect access to incoming_queue_. - mozilla::Mutex incoming_queue_lock_; + mozilla::Mutex incoming_queue_lock_ MOZ_UNANNOTATED; RunState* state_; int run_depth_base_; bool shutting_down_; #if defined(OS_WIN) // Should be set to true before calling Windows APIs like TrackPopupMenu, etc // which enter a modal message loop.
--- a/ipc/chromium/src/base/time_win.cc +++ b/ipc/chromium/src/base/time_win.cc @@ -231,17 +231,17 @@ class NowSingleton { static NowSingleton& instance() { // This setup is a little gross: the `now` instance lives until libxul is // unloaded, but leak checking runs prior to that, and would see a Mutex // instance contained in NowSingleton as still live. Said instance would // be reported as a leak...but it's not, really. To avoid that, we need // to use StaticMutex (which is not leak-checked), but StaticMutex can't // be a member variable. So we have to have this separate variable and // pass it into the NowSingleton constructor. - static mozilla::StaticMutex mutex; + static mozilla::StaticMutex mutex MOZ_UNANNOTATED; static NowSingleton now(mutex); return now; } private: explicit NowSingleton(mozilla::StaticMutex& aMutex) : lock_(aMutex), rollover_(TimeDelta::FromMilliseconds(0)),
--- a/ipc/chromium/src/mojo/core/ports/node.h +++ b/ipc/chromium/src/mojo/core/ports/node.h @@ -282,17 +282,17 @@ class Node { // // This must never be acquired while an individual port's lock is held on the // same thread. Conversely, individual port locks may be acquired while this // one is held. // // Because UserMessage events may execute arbitrary user code during // destruction, it is also important to ensure that such events are never // destroyed while this (or any individual Port) lock is held. - mozilla::Mutex ports_lock_{"Ports Lock"}; + mozilla::Mutex ports_lock_ MOZ_UNANNOTATED{"Ports Lock"}; std::unordered_map<LocalPortName, RefPtr<Port>> ports_; // Maps a peer port name to a list of PortRefs for all local ports which have // the port name key designated as their peer port. The set of local ports // which have the same peer port is expected to always be relatively small and // usually 1. Hence we just use a flat_map of local PortRefs keyed on each // local port's name. //
--- a/ipc/chromium/src/mojo/core/ports/port.h +++ b/ipc/chromium/src/mojo/core/ports/port.h @@ -183,16 +183,16 @@ class Port { void AssertLockAcquired() { lock_.AssertCurrentThreadOwns(); } private: friend class PortLocker; ~Port(); - mozilla::Mutex lock_{"Port State"}; + mozilla::Mutex lock_ MOZ_UNANNOTATED{"Port State"}; }; } // namespace ports } // namespace core } // namespace mojo #endif // MOJO_CORE_PORTS_PORT_H_
--- a/ipc/glue/BrowserProcessSubThread.h +++ b/ipc/glue/BrowserProcessSubThread.h @@ -40,17 +40,17 @@ class BrowserProcessSubThread : public b private: // The identifier of this thread. Only one thread can exist with a given // identifier at a given time. ID mIdentifier; // This lock protects |browser_threads_|. Do not read or modify that array // without holding this lock. Do not block while holding this lock. - static StaticMutex sLock; + static StaticMutex sLock MOZ_UNANNOTATED; // An array of the ChromeThread objects. This array is protected by |lock_|. // The threads are not owned by this array. Typically, the threads are owned // on the UI thread by the g_browser_process object. ChromeThreads remove // themselves from this array upon destruction. static BrowserProcessSubThread* sBrowserThreads[ID_COUNT]; };
--- a/ipc/glue/CrashReporterClient.h +++ b/ipc/glue/CrashReporterClient.h @@ -35,16 +35,16 @@ class CrashReporterClient { static void DestroySingleton(); static RefPtr<CrashReporterClient> GetSingleton(); private: explicit CrashReporterClient(); ~CrashReporterClient(); private: - static StaticMutex sLock; + static StaticMutex sLock MOZ_UNANNOTATED; static StaticRefPtr<CrashReporterClient> sClientSingleton; }; } // namespace ipc } // namespace mozilla #endif // mozilla_ipc_CrashReporterClient_h
--- a/ipc/glue/GeckoChildProcessHost.cpp +++ b/ipc/glue/GeckoChildProcessHost.cpp @@ -876,17 +876,17 @@ void BaseProcessLauncher::GetChildLogNam // Android also needs a single dedicated thread to simplify thread // safety in java. // // Fork server needs a dedicated thread for accessing // |ForkServiceChild|. #if defined(XP_WIN) || defined(MOZ_WIDGET_ANDROID) || \ defined(MOZ_ENABLE_FORKSERVER) -static mozilla::StaticMutex gIPCLaunchThreadMutex; +static mozilla::StaticMutex gIPCLaunchThreadMutex MOZ_UNANNOTATED; static mozilla::StaticRefPtr<nsIThread> gIPCLaunchThread; class IPCLaunchThreadObserver final : public nsIObserver { public: NS_DECL_ISUPPORTS NS_DECL_NSIOBSERVER protected: virtual ~IPCLaunchThreadObserver() = default;
--- a/ipc/glue/GeckoChildProcessHost.h +++ b/ipc/glue/GeckoChildProcessHost.h @@ -184,17 +184,17 @@ class GeckoChildProcessHost : public Chi friend class BaseProcessLauncher; friend class PosixProcessLauncher; friend class WindowsProcessLauncher; protected: ~GeckoChildProcessHost(); GeckoProcessType mProcessType; bool mIsFileContent; - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; FilePath mProcessPath; // GeckoChildProcessHost holds the launch options so they can be set // up on the main thread using main-thread-only APIs like prefs, and // then used for the actual launch on another thread. This pointer // is set to null to free the options after the child is launched. UniquePtr<base::LaunchOptions> mLaunchOptions; ScopedPort mInitialPort; RefPtr<NodeController> mNodeController; @@ -282,17 +282,17 @@ class GeckoChildProcessHost : public Chi // Mac and Windows. Set this up before we're called from a different thread. nsCOMPtr<nsIFile> mProfileDir; mozilla::Atomic<bool> mDestroying; static uint32_t sNextUniqueID; static StaticAutoPtr<LinkedList<GeckoChildProcessHost>> sGeckoChildProcessHosts; - static StaticMutex sMutex; + static StaticMutex sMutex MOZ_UNANNOTATED; }; nsCOMPtr<nsIEventTarget> GetIPCLauncher(); } /* namespace ipc */ } /* namespace mozilla */ #endif /* __IPC_GLUE_GECKOCHILDPROCESSHOST_H__ */
--- a/ipc/glue/IPCStreamDestination.cpp +++ b/ipc/glue/IPCStreamDestination.cpp @@ -180,17 +180,17 @@ class IPCStreamDestination::DelayedStart ~DelayedStartInputStream() = default; IPCStreamDestination* mDestination; nsCOMPtr<nsIAsyncInputStream> mStream; nsCOMPtr<nsIInputStreamCallback> mAsyncWaitCallback; // This protects mDestination: any method can be called by any thread. - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; class HelperRunnable; }; class IPCStreamDestination::DelayedStartInputStream::HelperRunnable final : public Runnable { public: enum Op {
--- a/ipc/glue/MessageChannel.cpp +++ b/ipc/glue/MessageChannel.cpp @@ -341,17 +341,17 @@ class ChannelCountReporter final : publi void Dec() { MOZ_ASSERT(mNow > 0); --mNow; } }; using CountTable = nsTHashMap<nsDepCharHashKey, ChannelCounts>; - static StaticMutex sChannelCountMutex; + static StaticMutex sChannelCountMutex MOZ_UNANNOTATED; static CountTable* sChannelCounts; public: NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData, bool aAnonymize) override {
--- a/ipc/glue/MessagePump.h +++ b/ipc/glue/MessagePump.h @@ -129,17 +129,17 @@ class MessagePumpForNonMainUIThreads fin MutexAutoLock lock(mWaitLock); return mInWait; } private: ~MessagePumpForNonMainUIThreads() {} bool mInWait; - mozilla::Mutex mWaitLock; + mozilla::Mutex mWaitLock MOZ_UNANNOTATED; }; #endif // defined(XP_WIN) #if defined(MOZ_WIDGET_ANDROID) /*` * The MessagePumpForAndroidUI exists to enable IPDL in the Android UI thread. * The Android UI thread event loop is controlled by Android. This prevents * running an existing MessagePump implementation in the Android UI thread. In
--- a/ipc/ipdl/test/cxx/TestCrashCleanup.cpp +++ b/ipc/ipdl/test/cxx/TestCrashCleanup.cpp @@ -32,17 +32,17 @@ void DeleteSubprocess(Mutex* mutex, Cond } void DeleteTheWorld() { delete static_cast<TestCrashCleanupParent*>(gParentActor); gParentActor = nullptr; // needs to be synchronous to avoid affecting event ordering on // the main thread - Mutex mutex("TestCrashCleanup.DeleteTheWorld.mutex"); + Mutex mutex MOZ_UNANNOTATED("TestCrashCleanup.DeleteTheWorld.mutex"); CondVar cvar(mutex, "TestCrashCleanup.DeleteTheWorld.cvar"); MutexAutoLock lock(mutex); XRE_GetIOMessageLoop()->PostTask( NewRunnableFunction("DeleteSubprocess", DeleteSubprocess, &mutex, &cvar)); cvar.Wait();
--- a/ipc/ipdl/test/cxx/TestInterruptErrorCleanup.cpp +++ b/ipc/ipdl/test/cxx/TestInterruptErrorCleanup.cpp @@ -32,17 +32,17 @@ void DeleteSubprocess(Mutex* mutex, Cond } void DeleteTheWorld() { delete static_cast<TestInterruptErrorCleanupParent*>(gParentActor); gParentActor = nullptr; // needs to be synchronous to avoid affecting event ordering on // the main thread - Mutex mutex("TestInterruptErrorCleanup.DeleteTheWorld.mutex"); + Mutex mutex MOZ_UNANNOTATED("TestInterruptErrorCleanup.DeleteTheWorld.mutex"); CondVar cvar(mutex, "TestInterruptErrorCleanup.DeleteTheWorld.cvar"); MutexAutoLock lock(mutex); XRE_GetIOMessageLoop()->PostTask( NewRunnableFunction("DeleteSubprocess", DeleteSubprocess, &mutex, &cvar)); cvar.Wait();
--- a/ipc/mscom/Interceptor.cpp +++ b/ipc/mscom/Interceptor.cpp @@ -59,17 +59,17 @@ class LiveSet final { } void Remove(IUnknown* aKey) { mMutex.AssertCurrentThreadOwns(); mLiveSet.Remove(aKey); } private: - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; nsRefPtrHashtable<nsPtrHashKey<IUnknown>, IWeakReference> mLiveSet; }; /** * We don't use the normal XPCOM BaseAutoLock because we need the ability * to explicitly Unlock. */ class MOZ_RAII LiveSetAutoLock final {
--- a/ipc/mscom/Interceptor.h +++ b/ipc/mscom/Interceptor.h @@ -162,20 +162,22 @@ class Interceptor final : public WeakRef REFIID MarshalAs(REFIID aIid) const; HRESULT PublishTarget(detail::LiveSetAutoLock& aLiveSetLock, RefPtr<IUnknown> aInterceptor, REFIID aTargetIid, STAUniquePtr<IUnknown> aTarget); private: InterceptorTargetPtr<IUnknown> mTarget; RefPtr<IInterceptorSink> mEventSink; - mozilla::Mutex mInterceptorMapMutex; // Guards mInterceptorMap + mozilla::Mutex mInterceptorMapMutex + MOZ_UNANNOTATED; // Guards mInterceptorMap // Using a nsTArray since the # of interfaces is not going to be very high nsTArray<MapEntry> mInterceptorMap; - mozilla::Mutex mStdMarshalMutex; // Guards mStdMarshalUnk and mStdMarshal + mozilla::Mutex mStdMarshalMutex + MOZ_UNANNOTATED; // Guards mStdMarshalUnk and mStdMarshal RefPtr<IUnknown> mStdMarshalUnk; IMarshal* mStdMarshal; // WEAK static MOZ_THREAD_LOCAL(bool) tlsCreatingStdMarshal; }; template <typename InterfaceT> inline HRESULT CreateInterceptor(STAUniquePtr<InterfaceT> aTargetInterface, IInterceptorSink* aEventSink,
--- a/ipc/mscom/InterceptorLog.cpp +++ b/ipc/mscom/InterceptorLog.cpp @@ -87,17 +87,17 @@ class Logger final { bool VariantToString(const VARIANT& aVariant, nsACString& aOut, LONG aIndex = 0); bool TryParamAsGuid(REFIID aIid, ICallFrame* aCallFrame, const CALLFRAMEPARAMINFO& aParamInfo, nsACString& aLine); static double GetElapsedTime(); nsCOMPtr<nsIFile> mLogFileName; nsCOMPtr<nsIOutputStream> mLogFile; // Only accessed by mThread - Mutex mMutex; // Guards mThread and mEntries + Mutex mMutex MOZ_UNANNOTATED; // Guards mThread and mEntries nsCOMPtr<nsIThread> mThread; nsTArray<nsCString> mEntries; }; Logger::Logger(const nsACString& aLeafBaseName) : mMutex("mozilla::com::InterceptorLog::Logger") { MOZ_ASSERT(NS_IsMainThread()); nsCOMPtr<nsIFile> logFileName;
--- a/js/src/ds/MemoryProtectionExceptionHandler.cpp +++ b/js/src/ds/MemoryProtectionExceptionHandler.cpp @@ -62,17 +62,17 @@ class ProtectedRegionTree { } if (A.first > B.last) { return 1; } return 0; } }; - Mutex lock; + Mutex lock MOZ_UNANNOTATED; LifoAlloc alloc; SplayTree<Region, Region> tree; public: ProtectedRegionTree() : lock(mutexid::ProtectedRegionTree), // Here "false" is used to not use the memory protection mechanism of // LifoAlloc in order to prevent dead-locks.
--- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -1241,17 +1241,17 @@ class GCRuntime { /* Count of the number of zones that are currently in page load. */ MainThreadData<size_t> inPageLoadCount; MainThreadData<bool> lowMemoryState; /* Synchronize GC heap access among GC helper threads and the main thread. */ friend class js::AutoLockGC; friend class js::AutoLockGCBgAlloc; - js::Mutex lock; + js::Mutex lock MOZ_UNANNOTATED; friend class BackgroundSweepTask; friend class BackgroundFreeTask; BackgroundAllocTask allocTask; BackgroundUnmarkTask unmarkTask; BackgroundMarkTask markTask; BackgroundSweepTask sweepTask;
--- a/js/src/gc/Scheduling.h +++ b/js/src/gc/Scheduling.h @@ -940,17 +940,17 @@ class MemoryTracker { using NonGCMap = Map<void>; static bool isGCMemoryUse(MemoryUse use); static bool isNonGCMemoryUse(MemoryUse use); static bool allowMultipleAssociations(MemoryUse use); size_t getAndRemoveEntry(const Key<Cell>& key, LockGuard<Mutex>& lock); - Mutex mutex; + Mutex mutex MOZ_UNANNOTATED; // Map containing the allocated size associated with (cell, use) pairs. GCMap gcMap; // Map containing the allocated size associated (non-cell pointer, use) pairs. NonGCMap nonGCMap; };
--- a/js/src/gc/StoreBuffer.h +++ b/js/src/gc/StoreBuffer.h @@ -436,17 +436,17 @@ class StoreBuffer { return; } mozilla::ReentrancyGuard g(*this); if (edge.maybeInRememberedSet(nursery_)) { buffer.put(edge); } } - Mutex lock_; + Mutex lock_ MOZ_UNANNOTATED; MonoTypeBuffer<ValueEdge> bufferVal; MonoTypeBuffer<StringPtrEdge> bufStrCell; MonoTypeBuffer<BigIntPtrEdge> bufBigIntCell; MonoTypeBuffer<ObjectPtrEdge> bufObjCell; MonoTypeBuffer<SlotsEdge> bufferSlot; WholeCellBuffer bufferWholeCell; GenericBuffer bufferGeneric;
--- a/js/src/jit/CacheIRSpewer.h +++ b/js/src/jit/CacheIRSpewer.h @@ -19,17 +19,17 @@ # include "threading/LockGuard.h" # include "vm/JSONPrinter.h" # include "vm/MutexIDs.h" namespace js { namespace jit { class CacheIRSpewer { - Mutex outputLock_; + Mutex outputLock_ MOZ_UNANNOTATED; Fprinter output_; mozilla::Maybe<JSONPrinter> json_; static CacheIRSpewer cacheIRspewer; // Counter to record how many times Guard class is called. This is used to // determine when to flush outputs based on the given interval value. // For example, if |spewInterval_ = 2|, outputs will be flushed on // guardCount_ values 0,2,4,6,...
--- a/js/src/jit/JitSpewer.cpp +++ b/js/src/jit/JitSpewer.cpp @@ -28,17 +28,17 @@ # endif # endif using namespace js; using namespace js::jit; class IonSpewer { private: - Mutex outputLock_; + Mutex outputLock_ MOZ_UNANNOTATED; Fprinter jsonOutput_; bool firstFunction_; bool asyncLogging_; bool inited_; void release(); public:
--- a/js/src/jit/ProcessExecutableMemory.cpp +++ b/js/src/jit/ProcessExecutableMemory.cpp @@ -516,17 +516,17 @@ class ProcessExecutableMemory { MaxCodeBytesPerProcess / ExecutableCodePageSize; // Start of the MaxCodeBytesPerProcess memory block or nullptr if // uninitialized. Note that this is NOT guaranteed to be aligned to // ExecutableCodePageSize. uint8_t* base_; // The fields below should only be accessed while we hold the lock. - Mutex lock_; + Mutex lock_ MOZ_UNANNOTATED; // pagesAllocated_ is an Atomic so that bytesAllocated does not have to // take the lock. mozilla::Atomic<size_t, mozilla::ReleaseAcquire> pagesAllocated_; // Page where we should try to allocate next. size_t cursor_;
--- a/js/src/jit/arm/Simulator-arm.h +++ b/js/src/jit/arm/Simulator-arm.h @@ -594,17 +594,17 @@ class SimulatorProcess { ~SimulatorProcess(); private: static SimulatorProcess* singleton_; // This lock creates a critical section around 'redirection_' and // 'icache_', which are referenced both by the execution engine // and by the off-thread compiler (see Redirection::Get in the cpp file). - Mutex cacheLock_; + Mutex cacheLock_ MOZ_UNANNOTATED; Redirection* redirection_; ICacheMap icache_; public: static ICacheMap& icache() { // Technically we need the lock to access the innards of the // icache, not to take its address, but the latter condition
--- a/js/src/jit/arm64/vixl/Simulator-vixl.h +++ b/js/src/jit/arm64/vixl/Simulator-vixl.h @@ -2503,17 +2503,17 @@ class SimulatorProcess static SimulatorProcess* singleton_; SimulatorProcess() : lock_(mutexid::Arm64SimulatorLock) , redirection_(nullptr) {} // Synchronizes access between main thread and compilation threads. - js::Mutex lock_; + js::Mutex lock_ MOZ_UNANNOTATED; vixl::Redirection* redirection_; #ifdef JS_CACHE_SIMULATOR_ARM64 // For each simulator, record what other thread registered as instruction // being invalidated. struct ICacheFlush { void* start; size_t length;
--- a/js/src/jit/mips32/Simulator-mips32.h +++ b/js/src/jit/mips32/Simulator-mips32.h @@ -488,17 +488,17 @@ class SimulatorProcess { ~SimulatorProcess(); private: static SimulatorProcess* singleton_; // This lock creates a critical section around 'redirection_' and // 'icache_', which are referenced both by the execution engine // and by the off-thread compiler (see Redirection::Get in the cpp file). - Mutex cacheLock_; + Mutex cacheLock_ MOZ_UNANNOTATED; Redirection* redirection_; ICacheMap icache_; public: static ICacheMap& icache() { // Technically we need the lock to access the innards of the // icache, not to take its address, but the latter condition
--- a/js/src/jit/mips64/Simulator-mips64.h +++ b/js/src/jit/mips64/Simulator-mips64.h @@ -498,17 +498,17 @@ class SimulatorProcess { ~SimulatorProcess(); private: static SimulatorProcess* singleton_; // This lock creates a critical section around 'redirection_' and // 'icache_', which are referenced both by the execution engine // and by the off-thread compiler (see Redirection::Get in the cpp file). - Mutex cacheLock_; + Mutex cacheLock_ MOZ_UNANNOTATED; Redirection* redirection_; ICacheMap icache_; public: static ICacheMap& icache() { // Technically we need the lock to access the innards of the // icache, not to take its address, but the latter condition
--- a/js/src/jsapi-tests/testCompileNonSyntactic.cpp +++ b/js/src/jsapi-tests/testCompileNonSyntactic.cpp @@ -37,17 +37,17 @@ struct OffThreadTask { alm.notify(); } static void OffThreadCallback(OffThreadToken* token, void* context) { auto self = static_cast<OffThreadTask*>(context); self->markDone(token); } - js::Monitor monitor; + js::Monitor monitor MOZ_UNANNOTATED; OffThreadToken* token; }; BEGIN_TEST(testCompileScript) { CHECK(testCompile(true)); CHECK(testCompile(false)); return true;
--- a/js/src/jsapi-tests/testScriptSourceCompression.cpp +++ b/js/src/jsapi-tests/testScriptSourceCompression.cpp @@ -501,17 +501,17 @@ END_TEST(testScriptSourceCompression_aut BEGIN_TEST(testScriptSourceCompression_offThread) { constexpr size_t len = MinimumCompressibleLength + 55; auto chars = MakeSourceAllWhitespace<char16_t>(cx, len); CHECK(chars); JS::SourceText<char16_t> source; CHECK(source.init(cx, std::move(chars), len)); - js::Monitor monitor(js::mutexid::ShellOffThreadState); + js::Monitor monitor MOZ_UNANNOTATED(js::mutexid::ShellOffThreadState); JS::CompileOptions options(cx); JS::OffThreadToken* token; // Force off-thread even though if this is a small file. options.forceAsync = true; CHECK(token = JS::CompileToStencilOffThread(cx, options, source, callback, &monitor));
--- a/js/src/jsapi-tests/testStencil.cpp +++ b/js/src/jsapi-tests/testStencil.cpp @@ -331,17 +331,17 @@ END_TEST(testStencil_TranscodeBorrowing) BEGIN_TEST(testStencil_OffThread) { const char* chars = "function f() { return 42; }" "f();"; JS::SourceText<mozilla::Utf8Unit> srcBuf; CHECK(srcBuf.init(cx, chars, strlen(chars), JS::SourceOwnership::Borrowed)); - js::Monitor monitor(js::mutexid::ShellOffThreadState); + js::Monitor monitor MOZ_UNANNOTATED(js::mutexid::ShellOffThreadState); JS::CompileOptions options(cx); JS::OffThreadToken* token; // Force off-thread even though if this is a small file. options.forceAsync = true; CHECK(token = JS::CompileToStencilOffThread(cx, options, srcBuf, callback, &monitor)); @@ -378,17 +378,17 @@ END_TEST(testStencil_OffThread) BEGIN_TEST(testStencil_OffThreadWithInstantiationStorage) { const char* chars = "function f() { return 42; }" "f();"; JS::SourceText<mozilla::Utf8Unit> srcBuf; CHECK(srcBuf.init(cx, chars, strlen(chars), JS::SourceOwnership::Borrowed)); - js::Monitor monitor(js::mutexid::ShellOffThreadState); + js::Monitor monitor MOZ_UNANNOTATED(js::mutexid::ShellOffThreadState); JS::CompileOptions options(cx); JS::OffThreadToken* token; // Force off-thread even though if this is a small file. options.forceAsync = true; options.allocateInstantiationStorage = true; @@ -430,17 +430,17 @@ END_TEST(testStencil_OffThreadWithInstan BEGIN_TEST(testStencil_OffThreadModule) { const char* chars = "export function f() { return 42; }" "globalThis.x = f();"; JS::SourceText<mozilla::Utf8Unit> srcBuf; CHECK(srcBuf.init(cx, chars, strlen(chars), JS::SourceOwnership::Borrowed)); - js::Monitor monitor(js::mutexid::ShellOffThreadState); + js::Monitor monitor MOZ_UNANNOTATED(js::mutexid::ShellOffThreadState); JS::CompileOptions options(cx); JS::OffThreadToken* token; // Force off-thread even though if this is a small file. options.forceAsync = true; CHECK(token = JS::CompileModuleToStencilOffThread(cx, options, srcBuf, callback, &monitor)); @@ -482,17 +482,17 @@ END_TEST(testStencil_OffThreadModule) BEGIN_TEST(testStencil_OffThreadModuleWithInstantiationStorage) { const char* chars = "export function f() { return 42; }" "globalThis.x = f();"; JS::SourceText<mozilla::Utf8Unit> srcBuf; CHECK(srcBuf.init(cx, chars, strlen(chars), JS::SourceOwnership::Borrowed)); - js::Monitor monitor(js::mutexid::ShellOffThreadState); + js::Monitor monitor MOZ_UNANNOTATED(js::mutexid::ShellOffThreadState); JS::CompileOptions options(cx); JS::OffThreadToken* token; // Force off-thread even though if this is a small file. options.forceAsync = true; options.allocateInstantiationStorage = true; @@ -566,17 +566,17 @@ BEGIN_TEST(testStencil_OffThreadDecode) CHECK(script); CHECK(JS_ExecuteScript(cx, script, &rval)); CHECK(rval.isNumber() && rval.toNumber() == 42); } JS::OffThreadToken* token; { JS::DecodeOptions decodeOptions; - js::Monitor monitor(js::mutexid::ShellOffThreadState); + js::Monitor monitor MOZ_UNANNOTATED(js::mutexid::ShellOffThreadState); JS::TranscodeRange range(buffer.begin(), buffer.length()); // Force off-thread even though if this is a small file. decodeOptions.forceAsync = true; CHECK(token = JS::DecodeStencilOffThread(cx, decodeOptions, range, callback, &monitor)); @@ -645,17 +645,17 @@ BEGIN_TEST(testStencil_OffThreadDecodeWi CHECK(script); CHECK(JS_ExecuteScript(cx, script, &rval)); CHECK(rval.isNumber() && rval.toNumber() == 42); } JS::OffThreadToken* token; { JS::DecodeOptions decodeOptions; - js::Monitor monitor(js::mutexid::ShellOffThreadState); + js::Monitor monitor MOZ_UNANNOTATED(js::mutexid::ShellOffThreadState); JS::TranscodeRange range(buffer.begin(), buffer.length()); // Force off-thread even though if this is a small file. decodeOptions.forceAsync = true; decodeOptions.allocateInstantiationStorage = true; CHECK(token = JS::DecodeStencilOffThread(cx, decodeOptions, range, callback, @@ -729,17 +729,17 @@ BEGIN_TEST(testStencil_OffThreadDecodeBo CHECK(script); CHECK(JS_ExecuteScript(cx, script, &rval)); CHECK(rval.isNumber() && rval.toNumber() == 42); } JS::OffThreadToken* token; { JS::DecodeOptions decodeOptions; - js::Monitor monitor(js::mutexid::ShellOffThreadState); + js::Monitor monitor MOZ_UNANNOTATED(js::mutexid::ShellOffThreadState); JS::TranscodeRange range(buffer.begin(), buffer.length()); // Force off-thread even though if this is a small file. decodeOptions.forceAsync = true; decodeOptions.borrowBuffer = true; CHECK(token = JS::DecodeStencilOffThread(cx, decodeOptions, range, callback, @@ -819,17 +819,17 @@ BEGIN_TEST(testStencil_OffThreadDecodePi CHECK(buffer.length() < PinnedBufferMax); memcpy(pinnedBuffer, buffer.begin(), buffer.length()); pinnedBufferSize = buffer.length(); JS::OffThreadToken* token; { JS::DecodeOptions decodeOptions; - js::Monitor monitor(js::mutexid::ShellOffThreadState); + js::Monitor monitor MOZ_UNANNOTATED(js::mutexid::ShellOffThreadState); JS::TranscodeRange range(pinnedBuffer, pinnedBufferSize); // Force off-thread even though if this is a small file. decodeOptions.forceAsync = true; decodeOptions.borrowBuffer = true; decodeOptions.usePinnedBytecode = true;
--- a/js/src/jsapi-tests/testThreadingConditionVariable.cpp +++ b/js/src/jsapi-tests/testThreadingConditionVariable.cpp @@ -6,17 +6,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "jsapi-tests/tests.h" #include "threading/ConditionVariable.h" #include "threading/Thread.h" #include "vm/MutexIDs.h" struct TestState { - js::Mutex mutex; + js::Mutex mutex MOZ_UNANNOTATED; js::ConditionVariable condition; bool flag; js::Thread testThread; explicit TestState(bool createThread = true) : mutex(js::mutexid::TestMutex), flag(false) { if (createThread) { MOZ_RELEASE_ASSERT(testThread.init(setFlag, this));
--- a/js/src/jsapi-tests/testThreadingMutex.cpp +++ b/js/src/jsapi-tests/testThreadingMutex.cpp @@ -5,29 +5,29 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "jsapi-tests/tests.h" #include "threading/LockGuard.h" #include "vm/MutexIDs.h" BEGIN_TEST(testThreadingMutex) { - js::Mutex mutex(js::mutexid::TestMutex); + js::Mutex mutex MOZ_UNANNOTATED(js::mutexid::TestMutex); mutex.lock(); mutex.unlock(); return true; } END_TEST(testThreadingMutex) BEGIN_TEST(testThreadingLockGuard) { - js::Mutex mutex(js::mutexid::TestMutex); + js::Mutex mutex MOZ_UNANNOTATED(js::mutexid::TestMutex); js::LockGuard<js::Mutex> guard(mutex); return true; } END_TEST(testThreadingLockGuard) BEGIN_TEST(testThreadingUnlockGuard) { - js::Mutex mutex(js::mutexid::TestMutex); + js::Mutex mutex MOZ_UNANNOTATED(js::mutexid::TestMutex); js::LockGuard<js::Mutex> guard(mutex); js::UnlockGuard<js::Mutex> unguard(guard); return true; } END_TEST(testThreadingUnlockGuard)
--- a/js/src/shell/jsshell.h +++ b/js/src/shell/jsshell.h @@ -224,17 +224,17 @@ struct ShellContext { #ifdef SINGLESTEP_PROFILING Vector<StackChars, 0, SystemAllocPolicy> stacks; #endif /* * Watchdog thread state. */ - js::Mutex watchdogLock; + js::Mutex watchdogLock MOZ_UNANNOTATED; js::ConditionVariable watchdogWakeup; mozilla::Maybe<js::Thread> watchdogThread; mozilla::Maybe<mozilla::TimeStamp> watchdogTimeout; js::ConditionVariable sleepWakeup; int exitCode; bool quitting; @@ -247,17 +247,17 @@ struct ShellContext { UniquePtr<ProfilingStack> geckoProfilingStack; UniquePtr<ModuleLoader> moduleLoader; UniquePtr<MarkBitObservers> markObservers; // Off-thread parse state. - js::Monitor offThreadMonitor; + js::Monitor offThreadMonitor MOZ_UNANNOTATED; Vector<OffThreadJob*, 0, SystemAllocPolicy> offThreadJobs; // Queued finalization registry cleanup jobs. using FunctionVector = GCVector<JSFunction*, 0, SystemAllocPolicy>; JS::PersistentRooted<FunctionVector> finalizationRegistryCleanupCallbacks; }; extern ShellContext* GetShellContext(JSContext* cx);
--- a/js/src/threading/ExclusiveData.h +++ b/js/src/threading/ExclusiveData.h @@ -79,17 +79,17 @@ namespace js { * `ExclusiveData<T>::Guard` somewhere such that the reference outlives the * guard's lifetime and therefore becomes invalid. To help avoid this last * foot-gun, prefer using the guard directly! Do not store raw references * to the protected value in other structures! */ template <typename T> class ExclusiveData { protected: - mutable Mutex lock_; + mutable Mutex lock_ MOZ_UNANNOTATED; mutable T value_; ExclusiveData(const ExclusiveData&) = delete; ExclusiveData& operator=(const ExclusiveData&) = delete; void acquire() const { lock_.lock(); } void release() const { lock_.unlock(); } @@ -275,17 +275,17 @@ class ExclusiveWaitableData : public Exc * allow other readers to read concurrently but block writers; the yielded value * is const. Writers call writeLock() to obtain a ditto writer lock, which * yields exclusive access to non-const data. * * See ExclusiveData and its implementation for more documentation. */ template <typename T> class RWExclusiveData { - mutable Mutex lock_; + mutable Mutex lock_ MOZ_UNANNOTATED; mutable ConditionVariable cond_; mutable T value_; mutable int readers_; // We maintain a count of active readers. Writers may enter the critical // section only when the reader count is zero, so the reader that decrements // the count to zero must wake up any waiting writers. //
--- a/js/src/threading/Thread.h +++ b/js/src/threading/Thread.h @@ -183,17 +183,17 @@ class ThreadTrampoline { // lvalue reference to the stack location. Thus, the value may not exist if // the parent thread leaves the frame before the read happens in the new // thread. To avoid this dangerous and highly non-obvious footgun, the // standard requires a "decay" copy of the arguments at the cost of making it // impossible to pass references between threads. mozilla::Tuple<std::decay_t<Args>...> args; // Protect the thread id during creation. - Mutex createMutex; + Mutex createMutex MOZ_UNANNOTATED; // Thread can access createMutex. friend class js::Thread; public: // Note that this template instatiation duplicates and is identical to the // class template instantiation. It is required for perfect forwarding of // rvalue references, which is only enabled for calls to a function template,
--- a/js/src/vm/HelperThreads.h +++ b/js/src/vm/HelperThreads.h @@ -55,17 +55,17 @@ struct CompileTaskState; struct Tier2GeneratorTask; using UniqueTier2GeneratorTask = UniquePtr<Tier2GeneratorTask>; } // namespace wasm /* * Lock protecting all mutable shared state accessed by helper threads, and used * by all condition variables. */ -extern Mutex gHelperThreadLock; +extern Mutex gHelperThreadLock MOZ_UNANNOTATED; class MOZ_RAII AutoLockHelperThreadState : public LockGuard<Mutex> { using Base = LockGuard<Mutex>; public: explicit AutoLockHelperThreadState() : Base(gHelperThreadLock) {} };
--- a/js/src/vm/Monitor.h +++ b/js/src/vm/Monitor.h @@ -20,17 +20,17 @@ namespace js { // acquire the lock or signal the condition variable using the // |AutoLockMonitor| type. class Monitor { protected: friend class AutoLockMonitor; friend class AutoUnlockMonitor; - Mutex lock_; + Mutex lock_ MOZ_UNANNOTATED; ConditionVariable condVar_; public: explicit Monitor(const MutexId& id) : lock_(id) {} }; class AutoLockMonitor : public LockGuard<Mutex> { private:
--- a/js/src/vm/Runtime.h +++ b/js/src/vm/Runtime.h @@ -559,17 +559,17 @@ struct JSRuntime { private: /* * Lock used to protect the script data table, which can be used by * off-thread parsing. * * Locking this only occurs if there is actually a thread other than the * main thread which could access this. */ - js::Mutex scriptDataLock; + js::Mutex scriptDataLock MOZ_UNANNOTATED; #ifdef DEBUG bool activeThreadHasScriptDataAccess; #endif // Number of off-thread ParseTasks that are using this runtime. This is only // updated on main-thread. If this is non-zero we must use `scriptDataLock` to // protect access to the bytecode table; mozilla::Atomic<size_t, mozilla::SequentiallyConsistent> numParseTasks;
--- a/js/src/vm/SharedArrayObject.h +++ b/js/src/vm/SharedArrayObject.h @@ -45,17 +45,17 @@ class FutexWaiter; * in ArrayBufferObject.cpp. * * length_ only grows when the lock is held. */ class SharedArrayRawBuffer { private: mozilla::Atomic<uint32_t, mozilla::ReleaseAcquire> refcount_; mozilla::Atomic<size_t, mozilla::SequentiallyConsistent> length_; - Mutex growLock_; + Mutex growLock_ MOZ_UNANNOTATED; // The index type of this buffer if it is a wasm buffer. wasm::IndexType wasmIndexType_; // The maximum size of this buffer in wasm pages. If this buffer was not // prepared for wasm, then this is zero. wasm::Pages wasmClampedMaxPages_; wasm::Pages wasmSourceMaxPages_; size_t mappedSize_; // Does not include the page for the header bool preparedForWasm_;
--- a/js/src/vm/TraceLogging.h +++ b/js/src/vm/TraceLogging.h @@ -441,17 +441,17 @@ class TraceLoggerThreadState { mozilla::TimeDuration delta = time - startTime; return delta.ToMicroseconds(); } JS::UniqueChars getFullScriptName(uint32_t textId); // Mutex to guard the data structures used to hold the payload data: // textIdPayloads, payloadDictionary & dictionaryData. - Mutex lock; + Mutex lock MOZ_UNANNOTATED; TraceLoggerThreadState() : lock(js::mutexid::TraceLoggerThreadState) {} bool init(); ~TraceLoggerThreadState(); void enableDefaultLogging(); void enableIonLogging();
--- a/js/src/vm/TraceLoggingGraph.h +++ b/js/src/vm/TraceLoggingGraph.h @@ -77,17 +77,17 @@ class TraceLoggerGraphState { // File pointer to the "tl-data.json" file. (Explained above). FILE* out; #ifdef DEBUG bool initialized; #endif public: - js::Mutex lock; + js::Mutex lock MOZ_UNANNOTATED; public: TraceLoggerGraphState() : numLoggers(0), pid_(0), out(nullptr) #ifdef DEBUG ,
--- a/js/src/wasm/WasmProcess.cpp +++ b/js/src/wasm/WasmProcess.cpp @@ -59,17 +59,17 @@ Atomic<bool> wasm::CodeExists(false); // observers (i.e. calls to lookup()) of the atomic data. static Atomic<size_t> sNumActiveLookups(0); class ProcessCodeSegmentMap { // Since writes (insertions or removals) can happen on any background // thread at the same time, we need a lock here. - Mutex mutatorsMutex_; + Mutex mutatorsMutex_ MOZ_UNANNOTATED; CodeSegmentVector segments1_; CodeSegmentVector segments2_; // Except during swapAndWait(), there are no lookup() observers of the // vector pointed to by mutableCodeSegments_ CodeSegmentVector* mutableCodeSegments_;
--- a/js/xpconnect/loader/ScriptPreloader.h +++ b/js/xpconnect/loader/ScriptPreloader.h @@ -525,15 +525,15 @@ class ScriptPreloader : public nsIObserv nsCOMPtr<nsITimer> mSaveTimer; // The mmapped cache data from this session's cache file. // The instance is held by either `gCacheData` or `gChildCacheData` static // fields, and its lifetime is guaranteed to be longer than ScriptPreloader // instance. AutoMemMap* mCacheData; - Monitor mMonitor; - Monitor mSaveMonitor; + Monitor mMonitor MOZ_UNANNOTATED; + Monitor mSaveMonitor MOZ_UNANNOTATED; }; } // namespace mozilla #endif // ScriptPreloader_h
--- a/js/xpconnect/loader/URLPreloader.h +++ b/js/xpconnect/loader/URLPreloader.h @@ -303,14 +303,14 @@ class URLPreloader final : public nsIMem // violate data access invariants. It's wrapped in a mutex because // the reader thread needs to be able to null this out to terminate itself. DataMutex<RefPtr<nsIThread>> mReaderThread{"ReaderThread"}; // A map of URL entries which have were either read this session, or read // from the last session's cache file. HashType mCachedURLs; - Monitor mMonitor{"[URLPreloader::mMutex]"}; + Monitor mMonitor MOZ_UNANNOTATED{"[URLPreloader::mMutex]"}; }; } // namespace mozilla #endif // URLPreloader_h
--- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -989,17 +989,17 @@ void XPCJSRuntime::OnLargeAllocationFail if (os) { os->NotifyObservers(nullptr, "memory-pressure", u"heap-minimize"); } CycleCollectedJSRuntime::SetLargeAllocationFailure(OOMState::Reported); } class LargeAllocationFailureRunnable final : public Runnable { - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; CondVar mCondVar; bool mWaiting; virtual ~LargeAllocationFailureRunnable() { MOZ_ASSERT(!mWaiting); } protected: NS_IMETHOD Run() override { MOZ_ASSERT(NS_IsMainThread());
--- a/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp +++ b/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp @@ -101,17 +101,17 @@ class FakeAudioTrack : public ProcessedM return GenericPromise::CreateAndResolve(true, __func__); } void ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags) override {} uint32_t NumberOfChannels() const override { return NUM_CHANNELS; } private: - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; MediaTrackListener* mListener = nullptr; nsCOMPtr<nsITimer> mTimer; int mCount = 0; static const int AUDIO_BUFFER_SIZE = 1600; static const int NUM_CHANNELS = 2; static void FakeAudioTrackGenerateData(nsITimer* timer, void* closure) { auto t = static_cast<FakeAudioTrack*>(closure);
--- a/memory/build/Mutex.h +++ b/memory/build/Mutex.h @@ -116,10 +116,9 @@ struct MOZ_RAII AutoLock { ~AutoLock() { mMutex.Unlock(); } private: T& mMutex; }; using MutexAutoLock = AutoLock<Mutex>; - #endif
--- a/memory/build/mozjemalloc.cpp +++ b/memory/build/mozjemalloc.cpp @@ -626,17 +626,17 @@ static void* base_alloc(size_t aSize); // theoretical problem with using `malloc_initialized` non-atomically, but // practically, this is only true if `malloc_init` is never called before // threads are created. static bool malloc_initialized; #else static Atomic<bool, SequentiallyConsistent> malloc_initialized; #endif -static StaticMutex gInitLock = {STATIC_MUTEX_INIT}; +static StaticMutex gInitLock MOZ_UNANNOTATED = {STATIC_MUTEX_INIT}; // *************************************************************************** // Statistics data structures. struct arena_stats_t { // Number of bytes currently mapped. size_t mapped; @@ -798,17 +798,17 @@ class AddressRadixTree { #endif static const size_t kBitsPerLevel = LOG2(kNodeSize) - LOG2(sizeof(void*)); static const size_t kBitsAtLevel1 = (Bits % kBitsPerLevel) ? Bits % kBitsPerLevel : kBitsPerLevel; static const size_t kHeight = (Bits + kBitsPerLevel - 1) / kBitsPerLevel; static_assert(kBitsAtLevel1 + (kHeight - 1) * kBitsPerLevel == Bits, "AddressRadixTree parameters don't work out"); - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; void** mRoot; public: bool Init(); inline void* Get(void* aAddr); // Returns whether the value was properly set. @@ -974,17 +974,17 @@ struct arena_t { RedBlackTreeNode<arena_t> mLink; // Arena id, that we keep away from the beginning of the struct so that // free list pointers in TypedBaseAlloc<arena_t> don't overflow in it, // and it keeps the value it had after the destructor. arena_id_t mId; // All operations on this arena require that lock be locked. - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; arena_stats_t mStats; private: // Tree of dirty-page-containing chunks this arena manages. RedBlackTree<arena_chunk_t, ArenaDirtyChunkTrait> mChunksDirty; #ifdef MALLOC_DOUBLE_PURGE @@ -1199,17 +1199,17 @@ class ArenaCollection { private: Tree* mNextTree; }; Iterator iter() { return Iterator(&mArenas, &mPrivateArenas); } inline arena_t* GetDefault() { return mDefaultArena; } - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; private: inline arena_t* GetByIdInternal(arena_id_t aArenaId, bool aIsPrivate); arena_t* mDefaultArena; arena_id_t mLastPublicArenaId; Tree mArenas; Tree mPrivateArenas; @@ -1217,27 +1217,27 @@ class ArenaCollection { static ArenaCollection gArenas; // ****** // Chunks. static AddressRadixTree<(sizeof(void*) << 3) - LOG2(kChunkSize)> gChunkRTree; // Protects chunk-related data structures. -static Mutex chunks_mtx; +static Mutex chunks_mtx MOZ_UNANNOTATED; // Trees of chunks that were previously allocated (trees differ only in node // ordering). These are used when allocating chunks, in an attempt to re-use // address space. Depending on function, different tree orderings are needed, // which is why there are two trees with the same contents. static RedBlackTree<extent_node_t, ExtentTreeSzTrait> gChunksBySize; static RedBlackTree<extent_node_t, ExtentTreeTrait> gChunksByAddress; // Protects huge allocation-related data structures. -static Mutex huge_mtx; +static Mutex huge_mtx MOZ_UNANNOTATED; // Tree of chunks that are stand-alone huge allocations. static RedBlackTree<extent_node_t, ExtentTreeTrait> huge; // Huge allocation statistics. static size_t huge_allocated; static size_t huge_mapped; @@ -1247,17 +1247,17 @@ static size_t huge_mapped; // Current pages that are being used for internal memory allocations. These // pages are carved up in cacheline-size quanta, so that there is no chance of // false cache line sharing. static void* base_pages; static void* base_next_addr; static void* base_next_decommitted; static void* base_past_addr; // Addr immediately past base_pages. -static Mutex base_mtx; +static Mutex base_mtx MOZ_UNANNOTATED; static size_t base_mapped; static size_t base_committed; // ****** // Arenas. // The arena associated with the current thread (per // jemalloc_thread_local_arena) On OSX, __thread/thread_local circles back
--- a/memory/replace/logalloc/LogAlloc.cpp +++ b/memory/replace/logalloc/LogAlloc.cpp @@ -20,17 +20,17 @@ #include "replace_malloc.h" #include "FdPrintf.h" #include "Mutex.h" static malloc_table_t sFuncs; static intptr_t sFd = 0; static bool sStdoutOrStderr = false; -static Mutex sMutex; +static Mutex sMutex MOZ_UNANNOTATED; #ifndef _WIN32 static void prefork() { sMutex.Lock(); } static void postfork() { sMutex.Unlock(); } #endif static size_t GetPid() { return size_t(getpid()); }
--- a/memory/replace/phc/PHC.cpp +++ b/memory/replace/phc/PHC.cpp @@ -671,17 +671,17 @@ class GMut { // - NeverAllocated: must be 0. // - InUse: must be kMaxTime. // - Freed: must be > 0 and < kMaxTime. Time mReuseTime; }; public: // The mutex that protects the other members. - static Mutex sMutex; + static Mutex sMutex MOZ_UNANNOTATED; GMut() : mRNG(RandomSeed<0>(), RandomSeed<1>()), mAllocPages(), mNumPageAllocs(0), mPageAllocHits(0), mPageAllocMisses(0) { sMutex.Init();
--- a/memory/volatile/VolatileBuffer.h +++ b/memory/volatile/VolatileBuffer.h @@ -66,17 +66,17 @@ class VolatileBuffer { private: ~VolatileBuffer(); /** * Protects mLockCount, mFirstLock, and changes to the volatility of our * buffer. Other member variables are read-only except in Init() and the * destructor. */ - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; void* mBuf; size_t mSize; int mLockCount; #if defined(ANDROID) int mFd; #elif defined(XP_DARWIN) bool mHeap;
--- a/mfbt/Attributes.h +++ b/mfbt/Attributes.h @@ -678,16 +678,23 @@ * marked as MOZ_MAY_CALL_AFTER_MUST_RETURN may be made after the * MOZ_MUST_RETURN_FROM_CALLER_IF_THIS_IS_ARG call. * MOZ_MAY_CALL_AFTER_MUST_RETURN: Applies to function or method declarations. * Calls to these methods may be made in functions after calls a * MOZ_MUST_RETURN_FROM_CALLER_IF_THIS_IS_ARG method. * MOZ_LIFETIME_BOUND: Applies to method declarations. * The result of calling these functions on temporaries may not be returned as * a reference or bound to a reference variable. + * MOZ_UNANNOTATED/MOZ_ANNOTATED: Applies to Mutexes/Monitors and variations on + * them. MOZ_UNANNOTATED indicates that the Mutex/Monitor/etc hasn't been + * examined and annotated using macros from mfbt/ThreadSafety -- + * GUARDED_BY()/REQUIRES()/etc. MOZ_ANNOTATED is used in rare cases to indicate + * that is has been looked at, but it did not need any + * GUARDED_BY()/REQUIRES()/etc (and thus static analysis knows it can ignore + * this Mutex/Monitor/etc) */ // gcc emits a nuisance warning -Wignored-attributes because attributes do not // affect mangled names, and therefore template arguments do not propagate // their attributes. It is rare that this would affect anything in practice, // and most compilers are silent about it. Similarly, -Wattributes complains // about attributes being ignored during template instantiation. // @@ -763,16 +770,18 @@ # define MOZ_REQUIRED_BASE_METHOD \ __attribute__((annotate("moz_required_base_method"))) # define MOZ_MUST_RETURN_FROM_CALLER_IF_THIS_IS_ARG \ __attribute__((annotate("moz_must_return_from_caller_if_this_is_arg"))) # define MOZ_MAY_CALL_AFTER_MUST_RETURN \ __attribute__((annotate("moz_may_call_after_must_return"))) # define MOZ_LIFETIME_BOUND __attribute__((annotate("moz_lifetime_bound"))) # define MOZ_KNOWN_LIVE __attribute__((annotate("moz_known_live"))) +# define MOZ_UNANNOTATED __attribute__((annotate("moz_unannotated"))) +# define MOZ_ANNOTATED __attribute__((annotate("moz_annotated"))) /* * It turns out that clang doesn't like void func() __attribute__ {} without a * warning, so use pragmas to disable the warning. */ # ifdef __clang__ # define MOZ_HEAP_ALLOCATOR \ _Pragma("clang diagnostic push") \ @@ -816,16 +825,18 @@ # define MOZ_IS_CLASS_INIT /* nothing */ # define MOZ_NON_PARAM /* nothing */ # define MOZ_NON_AUTOABLE /* nothing */ # define MOZ_REQUIRED_BASE_METHOD /* nothing */ # define MOZ_MUST_RETURN_FROM_CALLER_IF_THIS_IS_ARG /* nothing */ # define MOZ_MAY_CALL_AFTER_MUST_RETURN /* nothing */ # define MOZ_LIFETIME_BOUND /* nothing */ # define MOZ_KNOWN_LIVE /* nothing */ +# define MOZ_UNANNOTATED /* nothing */ +# define MOZ_ANNOTATED /* nothing */ # endif /* defined(MOZ_CLANG_PLUGIN) || defined(XGILL_PLUGIN) */ # define MOZ_RAII MOZ_NON_TEMPORARY_CLASS MOZ_STACK_CLASS // gcc has different rules governing attribute placement. Since none of these // attributes are actually used by the gcc-based static analysis, just // eliminate them rather than updating all of the code.
--- a/modules/libjar/nsJAR.h +++ b/modules/libjar/nsJAR.h @@ -159,17 +159,17 @@ class nsZipReaderCache : public nsIZipRe nsresult ReleaseZip(nsJAR* reader); typedef nsRefPtrHashtable<nsCStringHashKey, nsJAR> ZipsHashtable; protected: virtual ~nsZipReaderCache(); - mozilla::Mutex mLock; + mozilla::Mutex mLock MOZ_UNANNOTATED; uint32_t mCacheSize; ZipsHashtable mZips; #ifdef ZIP_CACHE_HIT_RATE uint32_t mZipCacheLookups; uint32_t mZipCacheHits; uint32_t mZipCacheFlushes; uint32_t mZipSyncMisses;
--- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -136,17 +136,17 @@ class ZipArchiveLogger { MOZ_ASSERT(mRefCnt > 0); if ((0 == --mRefCnt) && mFd) { PR_Close(mFd); mFd = nullptr; } } private: - static StaticMutex sLock; + static StaticMutex sLock MOZ_UNANNOTATED; int mRefCnt; PRFileDesc* mFd; }; StaticMutex ZipArchiveLogger::sLock; static ZipArchiveLogger zipLog; //***********************************************************
--- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp @@ -3006,17 +3006,17 @@ class PreferencesWriter final { // This is the number of writes via PWRunnables which have been dispatched // but not yet completed. This is intended to be used by Flush to ensure // that there are no outstanding writes left incomplete, and thus our prefs // on disk are in sync with what we have in memory. static Atomic<int> sPendingWriteCount; // See PWRunnable::Run for details on why we need this lock. - static StaticMutex sWritingToFile; + static StaticMutex sWritingToFile MOZ_UNANNOTATED; }; Atomic<PrefSaveData*> PreferencesWriter::sPendingWriteData(nullptr); Atomic<int> PreferencesWriter::sPendingWriteCount(0); StaticMutex PreferencesWriter::sWritingToFile; class PWRunnable : public Runnable { public: @@ -5355,17 +5355,17 @@ static void InitAlwaysPref(const nsCStri // Only called in the parent process. Set/reset the pref value and the // `always` mirror to the default value. // `once` mirrors will be initialized lazily in InitOncePrefs(). InitPref(aName, aDefaultValue); *aCache = aDefaultValue; } static Atomic<bool> sOncePrefRead(false); -static StaticMutex sOncePrefMutex; +static StaticMutex sOncePrefMutex MOZ_UNANNOTATED; namespace StaticPrefs { void MaybeInitOncePrefs() { if (MOZ_LIKELY(sOncePrefRead)) { // `once`-mirrored prefs have already been initialized to their default // value. return;
--- a/mozglue/misc/AutoProfilerLabel.cpp +++ b/mozglue/misc/AutoProfilerLabel.cpp @@ -39,17 +39,17 @@ class MOZ_RAII AutoProfilerLabelData { class Mutex : private mozilla::detail::MutexImpl { public: Mutex() : mozilla::detail::MutexImpl() {} void Lock() { mozilla::detail::MutexImpl::lock(); } void Unlock() { mozilla::detail::MutexImpl::unlock(); } }; // Mutex protecting access to the following static members. - static Mutex sAPLMutex; + static Mutex sAPLMutex MOZ_UNANNOTATED; static ProfilerLabelEnter sEnter; static ProfilerLabelExit sExit; // Current "generation" of RegisterProfilerLabelEnterExit calls. static uint32_t sGeneration; };
--- a/mozglue/misc/PlatformMutex.h +++ b/mozglue/misc/PlatformMutex.h @@ -58,10 +58,9 @@ class MutexImpl { #endif friend class mozilla::detail::ConditionVariableImpl; }; } // namespace detail } // namespace mozilla - #endif // mozilla_PlatformMutex_h
--- a/netwerk/base/AutoClose.h +++ b/netwerk/base/AutoClose.h @@ -48,15 +48,15 @@ class AutoClose { ptr->Close(); } } void operator=(const AutoClose<T>&) = delete; AutoClose(const AutoClose<T>&) = delete; nsCOMPtr<T> mPtr; - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; }; } // namespace net } // namespace mozilla #endif // mozilla_net_AutoClose_h
--- a/netwerk/base/BackgroundFileSaver.h +++ b/netwerk/base/BackgroundFileSaver.h @@ -112,17 +112,17 @@ class BackgroundFileSaver : public nsIBa ////////////////////////////////////////////////////////////////////////////// //// Shared state between control and worker threads /** * Protects the shared state between control and worker threads. This mutex * is always locked for a very short time, never during input/output. */ - mozilla::Mutex mLock{"BackgroundFileSaver.mLock"}; + mozilla::Mutex mLock MOZ_UNANNOTATED{"BackgroundFileSaver.mLock"}; /** * True if the worker thread is already waiting to process a change in state. */ bool mWorkerThreadAttentionRequested{false}; /** * True if the operation should finish as soon as possibile.
--- a/netwerk/base/Dashboard.h +++ b/netwerk/base/Dashboard.h @@ -56,17 +56,17 @@ class Dashboard final : public nsIDashbo struct WebSocketData { WebSocketData() : lock("Dashboard.webSocketData") {} uint32_t IndexOf(const nsCString& hostname, uint32_t mSerial) { LogData temp(hostname, mSerial, false); return data.IndexOf(temp); } nsTArray<LogData> data; - mozilla::Mutex lock; + mozilla::Mutex lock MOZ_UNANNOTATED; }; bool mEnableLogging; WebSocketData mWs; private: virtual ~Dashboard() = default;
--- a/netwerk/base/IOActivityMonitor.h +++ b/netwerk/base/IOActivityMonitor.h @@ -64,15 +64,15 @@ class IOActivityMonitor final : public n bool IncrementActivity(const nsACString& location, uint32_t aRx, uint32_t aTx); nsresult WriteInternal(const nsACString& location, uint32_t aAmount); nsresult ReadInternal(const nsACString& location, uint32_t aAmount); void RequestActivitiesInternal(dom::Promise* aPromise); Activities mActivities; // protects mActivities accesses - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; }; } // namespace net } // namespace mozilla #endif /* IOActivityMonitor_h___ */
--- a/netwerk/base/NetworkConnectivityService.h +++ b/netwerk/base/NetworkConnectivityService.h @@ -60,15 +60,15 @@ class NetworkConnectivityService : publi nsCOMPtr<nsICancelable> mNAT64Request; nsCOMPtr<nsIChannel> mIPv4Channel; nsCOMPtr<nsIChannel> mIPv6Channel; bool mCheckedNetworkId = false; bool mHasNetworkId = false; - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; }; } // namespace net } // namespace mozilla #endif // NetworkConnectivityService_h_
--- a/netwerk/base/PartiallySeekableInputStream.h +++ b/netwerk/base/PartiallySeekableInputStream.h @@ -77,15 +77,15 @@ class PartiallySeekableInputStream final nsCOMPtr<nsIInputStreamLengthCallback> mAsyncInputStreamLengthCallback; nsTArray<char> mCachedBuffer; uint64_t mBufferSize; uint64_t mPos; bool mClosed; - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; }; } // namespace net } // namespace mozilla #endif // PartiallySeekableInputStream_h
--- a/netwerk/base/ProxyAutoConfig.cpp +++ b/netwerk/base/ProxyAutoConfig.cpp @@ -127,17 +127,17 @@ class PACResolver final : public nsIDNSL return NS_OK; } nsresult mStatus; nsCOMPtr<nsICancelable> mRequest; nsCOMPtr<nsIDNSRecord> mResponse; nsCOMPtr<nsITimer> mTimer; nsCOMPtr<nsIEventTarget> mMainThreadEventTarget; - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; private: ~PACResolver() = default; }; NS_IMPL_ISUPPORTS(PACResolver, nsIDNSListener, nsITimerCallback, nsINamed) static void PACLogToConsole(nsString& aMessage) { if (XRE_IsSocketProcess()) {
--- a/netwerk/base/RedirectChannelRegistrar.h +++ b/netwerk/base/RedirectChannelRegistrar.h @@ -34,17 +34,17 @@ class RedirectChannelRegistrar final : p protected: using ChannelHashtable = nsInterfaceHashtable<nsUint64HashKey, nsIChannel>; using ParentChannelHashtable = nsInterfaceHashtable<nsUint64HashKey, nsIParentChannel>; ChannelHashtable mRealChannels; ParentChannelHashtable mParentChannels; - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; static StaticRefPtr<RedirectChannelRegistrar> gSingleton; }; } // namespace net } // namespace mozilla #endif
--- a/netwerk/base/SSLTokensCache.h +++ b/netwerk/base/SSLTokensCache.h @@ -58,17 +58,17 @@ class SSLTokensCache : public nsIMemoryR nsresult RemoveLocked(const nsACString& aKey); void EvictIfNecessary(); void LogStats(); size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const; static mozilla::StaticRefPtr<SSLTokensCache> gInstance; - static StaticMutex sLock; + static StaticMutex sLock MOZ_UNANNOTATED; uint32_t mCacheSize{0}; // Actual cache size in bytes class TokenCacheRecord { public: uint32_t Size() const; void Reset();
--- a/netwerk/base/TLSServerSocket.h +++ b/netwerk/base/TLSServerSocket.h @@ -62,16 +62,16 @@ class TLSServerConnectionInfo : public n // case of an error. After this, it's set to nullptr. nsISocketTransport* mTransport{nullptr}; nsCOMPtr<nsIX509Cert> mPeerCert; int16_t mTlsVersionUsed{TLS_VERSION_UNKNOWN}; nsCString mCipherName; uint32_t mKeyLength{0}; uint32_t mMacLength{0}; // lock protects access to mSecurityObserver - mozilla::Mutex mLock{"TLSServerConnectionInfo.mLock"}; + mozilla::Mutex mLock MOZ_UNANNOTATED{"TLSServerConnectionInfo.mLock"}; nsCOMPtr<nsITLSServerSecurityObserver> mSecurityObserver; }; } // namespace net } // namespace mozilla #endif // mozilla_net_TLSServerSocket_h
--- a/netwerk/base/Tickler.h +++ b/netwerk/base/Tickler.h @@ -75,17 +75,17 @@ class Tickler final : public nsSupportsW // Tickle the tickler to (re-)start the activity. // May call from any thread void Tickle(); private: ~Tickler(); friend class TicklerTimer; - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; nsCOMPtr<nsIThread> mThread; nsCOMPtr<nsITimer> mTimer; nsCOMPtr<nsIPrefBranch> mPrefs; bool mActive; bool mCanceled; bool mEnabled; uint32_t mDelay;
--- a/netwerk/base/nsAsyncStreamCopier.h +++ b/netwerk/base/nsAsyncStreamCopier.h @@ -54,17 +54,17 @@ class nsAsyncStreamCopier final : public nsCOMPtr<nsIOutputStream> mSink; nsCOMPtr<nsIRequestObserver> mObserver; nsCOMPtr<nsIEventTarget> mTarget; nsCOMPtr<nsISupports> mCopierCtx; - mozilla::Mutex mLock{"nsAsyncStreamCopier.mLock"}; + mozilla::Mutex mLock MOZ_UNANNOTATED{"nsAsyncStreamCopier.mLock"}; nsAsyncCopyMode mMode{NS_ASYNCCOPY_VIA_READSEGMENTS}; uint32_t mChunkSize; nsresult mStatus{NS_OK}; bool mIsPending{false}; bool mCloseSource{false}; bool mCloseSink{false}; bool mShouldSniffBuffering{false};
--- a/netwerk/base/nsBufferedStreams.h +++ b/netwerk/base/nsBufferedStreams.h @@ -115,17 +115,17 @@ class nsBufferedInputStream final : publ void SerializeInternal(mozilla::ipc::InputStreamParams& aParams, FileDescriptorArray& aFileDescriptors, bool aDelayedStart, uint32_t aMaxSize, uint32_t* aSizeUsed, M* aManager); NS_IMETHOD Fill() override; NS_IMETHOD Flush() override { return NS_OK; } // no-op for input streams - mozilla::Mutex mMutex{"nsBufferedInputStream::mMutex"}; + mozilla::Mutex mMutex MOZ_UNANNOTATED{"nsBufferedInputStream::mMutex"}; // This value is protected by mutex. nsCOMPtr<nsIInputStreamCallback> mAsyncWaitCallback; // This value is protected by mutex. nsCOMPtr<nsIInputStreamLengthCallback> mAsyncInputStreamLengthCallback; bool mIsIPCSerializable{true};
--- a/netwerk/base/nsIOService.h +++ b/netwerk/base/nsIOService.h @@ -227,17 +227,17 @@ class nsIOService final : public nsIIOSe // Cached protocol handlers, only accessed on the main thread nsWeakPtr mWeakHandler[NS_N(gScheme)]; // cached categories nsCategoryCache<nsIChannelEventSink> mChannelEventSinks{ NS_CHANNEL_EVENT_SINK_CATEGORY}; - Mutex mMutex{"nsIOService::mMutex"}; + Mutex mMutex MOZ_UNANNOTATED{"nsIOService::mMutex"}; nsTArray<int32_t> mRestrictedPortList; uint32_t mTotalRequests{0}; uint32_t mCacheWon{0}; uint32_t mNetWon{0}; static uint32_t sSocketProcessCrashedCount; // These timestamps are needed for collecting telemetry on PR_Connect,
--- a/netwerk/base/nsInputStreamPump.h +++ b/netwerk/base/nsInputStreamPump.h @@ -115,14 +115,14 @@ class nsInputStreamPump final : public n bool mWaitingForInputStreamReady{false}; bool mCloseWhenDone{false}; bool mRetargeting{false}; bool mAsyncStreamIsBuffered{false}; // Indicate whether nsInputStreamPump is used completely off main thread. bool mOffMainThread; // If true, OnStateStop() is executed off main thread. Set at creation. // Protects state/member var accesses across multiple threads. - mozilla::RecursiveMutex mMutex{"nsInputStreamPump"}; + mozilla::RecursiveMutex mMutex MOZ_UNANNOTATED{"nsInputStreamPump"}; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsInputStreamPump, NS_INPUT_STREAM_PUMP_IID) #endif // !nsInputStreamChannel_h__
--- a/netwerk/base/nsMIMEInputStream.cpp +++ b/netwerk/base/nsMIMEInputStream.cpp @@ -81,17 +81,17 @@ class nsMIMEInputStream : public nsIMIME bool IsAsyncInputStreamLength() const; bool IsCloneableInputStream() const; nsTArray<HeaderEntry> mHeaders; nsCOMPtr<nsIInputStream> mStream; bool mStartedReading{false}; - mozilla::Mutex mMutex{"nsMIMEInputStream::mMutex"}; + mozilla::Mutex mMutex MOZ_UNANNOTATED{"nsMIMEInputStream::mMutex"}; // This is protected by mutex. nsCOMPtr<nsIInputStreamCallback> mAsyncWaitCallback; // This is protected by mutex. nsCOMPtr<nsIInputStreamLengthCallback> mAsyncInputStreamLengthCallback; };
--- a/netwerk/base/nsNetUtil.cpp +++ b/netwerk/base/nsNetUtil.cpp @@ -1591,17 +1591,17 @@ class BufferWriter final : public nsIInp mBuffer = buffer; mBufferSize = bufferSize.value(); return true; } // All the members of this class are touched on the owning thread only. The // monitor is only used to communicate when there is more data to read. - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; nsCOMPtr<nsIInputStream> mInputStream; nsCOMPtr<nsIAsyncInputStream> mAsyncInputStream; RefPtr<TaskQueue> mTaskQueue; void* mBuffer; int64_t mCount;
--- a/netwerk/base/nsProtocolProxyService.cpp +++ b/netwerk/base/nsProtocolProxyService.cpp @@ -1517,17 +1517,17 @@ class nsAsyncBridgeRequest final : publi void Unlock() { mMutex.Unlock(); } void Wait() { mCondVar.Wait(TimeDuration::FromSeconds(3)); } private: ~nsAsyncBridgeRequest() = default; friend class nsProtocolProxyService; - Mutex mMutex; + Mutex mMutex MOZ_UNANNOTATED; CondVar mCondVar; nsresult mStatus{NS_OK}; nsCString mPACString; nsCString mPACURL; bool mCompleted{false}; }; NS_IMPL_ISUPPORTS0(nsAsyncBridgeRequest)
--- a/netwerk/base/nsServerSocket.h +++ b/netwerk/base/nsServerSocket.h @@ -46,17 +46,17 @@ class nsServerSocket : public nsASocketH private: void OnMsgClose(); void OnMsgAttach(); // try attaching our socket (mFD) to the STS's poll list. nsresult TryAttach(); // lock protects access to mListener; so it is not cleared while being used. - mozilla::Mutex mLock{"nsServerSocket.mLock"}; + mozilla::Mutex mLock MOZ_UNANNOTATED{"nsServerSocket.mLock"}; PRNetAddr mAddr = {.raw = {0, {0}}}; nsCOMPtr<nsIEventTarget> mListenerTarget; bool mAttached{false}; bool mKeepWhenOffline{false}; }; } // namespace net } // namespace mozilla
--- a/netwerk/base/nsSocketTransport2.h +++ b/netwerk/base/nsSocketTransport2.h @@ -362,17 +362,17 @@ class nsSocketTransport final : public n // called when the socket is connected void OnSocketConnected(); //------------------------------------------------------------------------- // socket input/output objects. these may be accessed on any thread with // the exception of some specific methods (XXX). // protects members in this section. - Mutex mLock{"nsSocketTransport.mLock"}; + Mutex mLock MOZ_UNANNOTATED{"nsSocketTransport.mLock"}; LockedPRFileDesc mFD; nsrefcnt mFDref{0}; // mFD is closed when mFDref goes to zero. bool mFDconnected{false}; // mFD is available to consumer when TRUE. // A delete protector reference to gSocketTransportService held for lifetime // of 'this'. Sometimes used interchangably with gSocketTransportService due // to scoping. RefPtr<nsSocketTransportService> mSocketTransportService;
--- a/netwerk/base/nsSocketTransportService2.h +++ b/netwerk/base/nsSocketTransportService2.h @@ -155,17 +155,17 @@ class nsSocketTransportService final : p //------------------------------------------------------------------------- // initialization and shutdown (any thread) //------------------------------------------------------------------------- Atomic<bool> mInitialized{false}; // indicates whether we are currently in the process of shutting down Atomic<bool> mShuttingDown{false}; - Mutex mLock{"nsSocketTransportService::mLock"}; + Mutex mLock MOZ_UNANNOTATED{"nsSocketTransportService::mLock"}; // Variables in the next section protected by mLock // mThread and mDirectTaskDispatcher are only ever modified on the main // thread. Will be set on Init and set to null after shutdown. You must access // mThread and mDirectTaskDispatcher outside the main thread via respectively // GetThreadSafely and GetDirectTaskDispatchedSafely(). nsCOMPtr<nsIThread> mThread; // We store a pointer to mThread as a direct task dispatcher to avoid having
--- a/netwerk/base/nsStandardURL.cpp +++ b/netwerk/base/nsStandardURL.cpp @@ -194,17 +194,17 @@ const nsACString& nsStandardURL::nsSegme return str; } //---------------------------------------------------------------------------- // nsStandardURL <public> //---------------------------------------------------------------------------- #ifdef DEBUG_DUMP_URLS_AT_SHUTDOWN -static StaticMutex gAllURLsMutex; +static StaticMutex gAllURLsMutex MOZ_UNANNOTATED; static LinkedList<nsStandardURL> gAllURLs; #endif nsStandardURL::nsStandardURL(bool aSupportsFileURL, bool aTrackURL) : mURLType(URLTYPE_STANDARD), mSupportsFileURL(aSupportsFileURL), mCheckedIfHostA(false) { LOG(("Creating nsStandardURL @%p\n", this));
--- a/netwerk/base/nsStreamTransportService.cpp +++ b/netwerk/base/nsStreamTransportService.cpp @@ -43,17 +43,17 @@ class nsInputStreamTransport : public ns nsInputStreamTransport(nsIInputStream* source, bool closeWhenDone) : mSource(source), mCloseWhenDone(closeWhenDone) { mAsyncSource = do_QueryInterface(mSource); } private: virtual ~nsInputStreamTransport() = default; - Mutex mMutex{"nsInputStreamTransport::mMutex"}; + Mutex mMutex MOZ_UNANNOTATED{"nsInputStreamTransport::mMutex"}; // This value is protected by mutex. nsCOMPtr<nsIInputStreamCallback> mAsyncWaitCallback; nsCOMPtr<nsIAsyncInputStream> mPipeIn; // while the copy is active, these members may only be accessed from the // nsIInputStream implementation.
--- a/netwerk/base/nsStreamTransportService.h +++ b/netwerk/base/nsStreamTransportService.h @@ -44,15 +44,16 @@ class nsStreamTransportService final : p private: ~nsStreamTransportService(); nsCOMPtr<nsIThreadPool> mPool; DataMutex<nsTArray<RefPtr<DelayedRunnable>>> mScheduledDelayedRunnables; - mozilla::Mutex mShutdownLock{"nsStreamTransportService.mShutdownLock"}; + mozilla::Mutex mShutdownLock MOZ_UNANNOTATED{ + "nsStreamTransportService.mShutdownLock"}; bool mIsShutdown{false}; }; } // namespace net } // namespace mozilla #endif
--- a/netwerk/base/nsTransportUtils.cpp +++ b/netwerk/base/nsTransportUtils.cpp @@ -34,17 +34,17 @@ class nsTransportEventSinkProxy : public // it on the target thread. otherwise, we could get into trouble. NS_ProxyRelease("nsTransportEventSinkProxy::mSink", mTarget, dont_AddRef(mSink)); } public: nsITransportEventSink* mSink; nsCOMPtr<nsIEventTarget> mTarget; - Mutex mLock; + Mutex mLock MOZ_UNANNOTATED; nsTransportStatusEvent* mLastEvent; }; class nsTransportStatusEvent : public Runnable { public: nsTransportStatusEvent(nsTransportEventSinkProxy* proxy, nsITransport* transport, nsresult status, int64_t progress, int64_t progressMax)
--- a/netwerk/base/nsUDPSocket.h +++ b/netwerk/base/nsUDPSocket.h @@ -54,17 +54,17 @@ class nsUDPSocket final : public nsASock nsresult LeaveMulticastInternal(const PRNetAddr& aAddr, const PRNetAddr& aIface); nsresult SetMulticastInterfaceInternal(const PRNetAddr& aIface); void CloseSocket(); // lock protects access to mListener; // so mListener is not cleared while being used/locked. - Mutex mLock{"nsUDPSocket.mLock"}; + Mutex mLock MOZ_UNANNOTATED{"nsUDPSocket.mLock"}; PRFileDesc* mFD{nullptr}; NetAddr mAddr; OriginAttributes mOriginAttributes; nsCOMPtr<nsIUDPSocketListener> mListener; nsCOMPtr<nsIUDPSocketSyncListener> mSyncListener; nsCOMPtr<nsIEventTarget> mListenerTarget; bool mAttached{false}; RefPtr<nsSocketTransportService> mSts;
--- a/netwerk/cache/nsCacheUtils.h +++ b/netwerk/cache/nsCacheUtils.h @@ -31,14 +31,14 @@ class nsShutdownThread : public mozilla: /** * BlockingShutdown ensures that by the time it returns, aThread->Shutdown() * has been called and no pending events have been processed on the current * thread. */ static nsresult BlockingShutdown(nsIThread* aThread); private: - mozilla::Monitor mMonitor; + mozilla::Monitor mMonitor MOZ_UNANNOTATED; bool mShuttingDown; nsCOMPtr<nsIThread> mThread; }; #endif
--- a/netwerk/cache2/CacheEntry.h +++ b/netwerk/cache2/CacheEntry.h @@ -305,17 +305,17 @@ class CacheEntry final : public nsIRunna // When this entry is doomed the first time, this method removes // any force-valid timing info for this entry. void RemoveForcedValidity(); already_AddRefed<CacheEntryHandle> ReopenTruncated( bool aMemoryOnly, nsICacheEntryOpenCallback* aCallback); void TransferCallbacks(CacheEntry& aFromEntry); - mozilla::Mutex mLock{"CacheEntry"}; + mozilla::Mutex mLock MOZ_UNANNOTATED{"CacheEntry"}; // Reflects the number of existing handles for this entry ::mozilla::ThreadSafeAutoRefCnt mHandlesCount; nsTArray<Callback> mCallbacks; nsCOMPtr<nsICacheEntryDoomCallback> mDoomCallback; RefPtr<CacheFile> mFile;
--- a/netwerk/cache2/CacheFileIOManager.cpp +++ b/netwerk/cache2/CacheFileIOManager.cpp @@ -559,17 +559,17 @@ class ShutdownEvent : public Runnable { // try to cancel it. Returns no later than after two seconds. MonitorAutoUnlock unmon(mMonitor); // Prevent delays CacheFileIOManager::gInstance->mIOThread->CancelBlockingIO(); } } } protected: - mozilla::Monitor mMonitor; + mozilla::Monitor mMonitor MOZ_UNANNOTATED; bool mNotified{false}; }; // Class responsible for reporting IO performance stats class IOPerfReportEvent { public: explicit IOPerfReportEvent(CacheFileUtils::CachePerfStats::EDataType aType) : mType(aType), mEventCounter(0) {} @@ -4192,17 +4192,17 @@ class SizeOfHandlesRunnable : public Run } mMonitorNotified = true; mon.Notify(); return NS_OK; } private: - mozilla::Monitor mMonitor; + mozilla::Monitor mMonitor MOZ_UNANNOTATED; bool mMonitorNotified; mozilla::MallocSizeOf mMallocSizeOf; CacheFileHandles const& mHandles; nsTArray<CacheFileHandle*> const& mSpecialHandles; size_t mSize; }; } // namespace
--- a/netwerk/cache2/CacheFileUtils.h +++ b/netwerk/cache2/CacheFileUtils.h @@ -126,17 +126,17 @@ class DetailedCacheHitTelemetry { // All hit rates are accumulated in a single telemetry probe, so to use // a sane number of enumerated values the hit rate is divided into buckets // instead of using a percent value. This constant defines number of buckets // that we divide the hit rates into. I.e. we'll report ranges 0%-5%, 5%-10%, // 10-%15%, ... static const uint32_t kHitRateBuckets = 20; // Protects sRecordCnt, sHitStats and Telemetry::Accumulated() calls. - static StaticMutex sLock; + static StaticMutex sLock MOZ_UNANNOTATED; // Counter of samples that is compared against kTotalSamplesReportLimit. static uint32_t sRecordCnt; // Hit rate statistics for every cache size range. static HitRate sHRStats[kNumOfRanges]; }; @@ -198,17 +198,17 @@ class CachePerfStats { // Contains filtered data (i.e. times when we think the cache and disk was // not busy) for a longer time. MMA mFilteredAvg; // Contains unfiltered average of few recent values. MMA mShortAvg; }; - static StaticMutex sLock; + static StaticMutex sLock MOZ_UNANNOTATED; static PerfData sData[LAST]; static uint32_t sCacheSlowCnt; static uint32_t sCacheNotSlowCnt; }; void FreeBuffer(void* aBuf); @@ -223,16 +223,16 @@ class CacheFileLock final { NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CacheFileLock) CacheFileLock() = default; mozilla::Mutex& Lock() { return mLock; } private: ~CacheFileLock() = default; - mozilla::Mutex mLock{"CacheFile.mLock"}; + mozilla::Mutex mLock MOZ_UNANNOTATED{"CacheFile.mLock"}; }; } // namespace CacheFileUtils } // namespace net } // namespace mozilla #endif
--- a/netwerk/cache2/CacheIOThread.h +++ b/netwerk/cache2/CacheIOThread.h @@ -106,17 +106,17 @@ class CacheIOThread final : public nsITh void LoopOneLevel(uint32_t aLevel); bool EventsPending(uint32_t aLastLevel = LAST_LEVEL); nsresult DispatchInternal(already_AddRefed<nsIRunnable> aRunnable, uint32_t aLevel); bool YieldInternal(); static CacheIOThread* sSelf; - mozilla::Monitor mMonitor{"CacheIOThread"}; + mozilla::Monitor mMonitor MOZ_UNANNOTATED{"CacheIOThread"}; PRThread* mThread{nullptr}; // Only set in Init(), before the thread is started, which reads it but never // writes UniquePtr<detail::BlockingIOWatcher> mBlockingIOWatcher; Atomic<nsIThread*> mXPCOMThread{nullptr}; Atomic<uint32_t, Relaxed> mLowestLevelWaiting{LAST_LEVEL}; uint32_t mCurrentlyExecutingLevel{0};
--- a/netwerk/cache2/CacheIndex.h +++ b/netwerk/cache2/CacheIndex.h @@ -1045,17 +1045,17 @@ class CacheIndex final : public CacheFil // Memory reporting (private part) size_t SizeOfExcludingThisInternal(mozilla::MallocSizeOf mallocSizeOf) const; // Reports telemetry about cache, i.e. size, entry count and content type // stats. void DoTelemetryReport(); static mozilla::StaticRefPtr<CacheIndex> gInstance; - static StaticMutex sLock; + static StaticMutex sLock MOZ_UNANNOTATED; nsCOMPtr<nsIFile> mCacheDirectory; EState mState{INITIAL}; // Timestamp of time when the index was initialized. We use it to delay // initial update or build of index. TimeStamp mStartTime; // Set to true in PreShutdown(), it is checked on variaous places to prevent
--- a/netwerk/cache2/CacheStorageService.h +++ b/netwerk/cache2/CacheStorageService.h @@ -319,17 +319,17 @@ class CacheStorageService final : public CacheEntryHandle** aResult); nsresult ClearOriginInternal( const nsAString& aOrigin, const mozilla::OriginAttributes& aOriginAttributes, bool aAnonymous); static CacheStorageService* sSelf; - mozilla::Mutex mLock{"CacheStorageService.mLock"}; + mozilla::Mutex mLock MOZ_UNANNOTATED{"CacheStorageService.mLock"}; mozilla::Mutex mForcedValidEntriesLock{ "CacheStorageService.mForcedValidEntriesLock"}; Atomic<bool, Relaxed> mShutdown{false}; // Accessible only on the service thread class MemoryPool { public: @@ -408,17 +408,17 @@ class CacheStorageService final : public : Runnable("net::CacheStorageService::IOThreadSuspender"), mMon("IOThreadSuspender") {} void Notify(); private: virtual ~IOThreadSuspender() = default; NS_IMETHOD Run() override; - Monitor mMon; + Monitor mMon MOZ_UNANNOTATED; bool mSignaled{false}; }; RefPtr<IOThreadSuspender> mActiveIOSuspender; }; template <class T> void ProxyRelease(const char* aName, nsCOMPtr<T>& object,
--- a/netwerk/cookie/CookiePersistentStorage.h +++ b/netwerk/cookie/CookiePersistentStorage.h @@ -123,17 +123,17 @@ class CookiePersistentStorage final : pu OriginAttributes originAttributes; UniquePtr<CookieStruct> cookie; }; // thread TimeStamp mEndInitDBConn; nsTArray<CookieDomainTuple> mReadArray; - Monitor mMonitor; + Monitor mMonitor MOZ_UNANNOTATED; Atomic<bool> mInitialized; Atomic<bool> mInitializedDBConn; nsCOMPtr<nsIFile> mCookieFile; nsCOMPtr<mozIStorageConnection> mDBConn; nsCOMPtr<mozIStorageAsyncStatement> mStmtInsert; nsCOMPtr<mozIStorageAsyncStatement> mStmtDelete;
--- a/netwerk/dns/ChildDNSService.h +++ b/netwerk/dns/ChildDNSService.h @@ -53,16 +53,16 @@ class ChildDNSService final : public DNS nsIDNSResolverInfo* aResolver, nsIDNSListener* aListener, nsresult aReason, const OriginAttributes& aOriginAttributes); bool mODoHActivated = false; // We need to remember pending dns requests to be able to cancel them. nsClassHashtable<nsCStringHashKey, nsTArray<RefPtr<DNSRequestSender>>> mPendingRequests; - Mutex mPendingRequestsLock{"DNSPendingRequestsLock"}; + Mutex mPendingRequestsLock MOZ_UNANNOTATED{"DNSPendingRequestsLock"}; RefPtr<TRRServiceParent> mTRRServiceParent; }; } // namespace net } // namespace mozilla #endif // mozilla_net_ChildDNSService_h
--- a/netwerk/dns/GetAddrInfo.h +++ b/netwerk/dns/GetAddrInfo.h @@ -68,17 +68,17 @@ class NativeDNSResolverOverride : public NS_DECL_NSINATIVEDNSRESOLVEROVERRIDE public: NativeDNSResolverOverride() = default; static already_AddRefed<nsINativeDNSResolverOverride> GetSingleton(); private: virtual ~NativeDNSResolverOverride() = default; - mozilla::RWLock mLock{"NativeDNSResolverOverride"}; + mozilla::RWLock mLock MOZ_UNANNOTATED{"NativeDNSResolverOverride"}; nsTHashMap<nsCStringHashKey, nsTArray<NetAddr>> mOverrides; nsTHashMap<nsCStringHashKey, nsCString> mCnames; friend bool FindAddrOverride(const nsACString& aHost, uint16_t aAddressFamily, uint16_t aFlags, AddrInfo** aAddrInfo); };
--- a/netwerk/dns/ODoHService.h +++ b/netwerk/dns/ODoHService.h @@ -53,17 +53,17 @@ class ODoHService : public nsIDNSListene void OnODoHPrefsChange(bool aInit); void BuildODoHRequestURI(); void StartTTLTimer(uint32_t aTTL); void OnODohConfigsURIChanged(); void ODoHConfigUpdateDone(uint32_t aTTL, Span<const uint8_t> aRawConfig); nsresult UpdateODoHConfigFromHTTPSRR(); nsresult UpdateODoHConfigFromURI(); - mozilla::Mutex mLock; + mozilla::Mutex mLock MOZ_UNANNOTATED; Atomic<bool, Relaxed> mQueryODoHConfigInProgress; nsCString mODoHProxyURI; nsCString mODoHTargetHost; nsCString mODoHTargetPath; nsCString mODoHRequestURI; nsCString mODoHConfigsUri; Maybe<nsTArray<ObliviousDoHConfig>> mODoHConfigs; nsTArray<RefPtr<ODoH>> mPendingRequests;
--- a/netwerk/dns/TRRQuery.h +++ b/netwerk/dns/TRRQuery.h @@ -78,17 +78,18 @@ class TRRQuery : public AHostResolver { void MarkSendingTRR(TRR* trr, TrrType rectype, MutexAutoLock&); void PrepareQuery(bool aUseODoH, TrrType aRecType, nsTArray<RefPtr<TRR>>& aRequestsToSend); bool SendQueries(nsTArray<RefPtr<TRR>>& aRequestsToSend); RefPtr<nsHostResolver> mHostResolver; RefPtr<nsHostRecord> mRecord; - Mutex mTrrLock; // lock when accessing the mTrrA[AAA] pointers + Mutex mTrrLock + MOZ_UNANNOTATED; // lock when accessing the mTrrA[AAA] pointers RefPtr<mozilla::net::TRR> mTrrA; RefPtr<mozilla::net::TRR> mTrrAAAA; RefPtr<mozilla::net::TRR> mTrrByType; // |mTRRRequestCounter| indicates the number of TRR requests that were // dispatched sucessfully. Generally, this counter is increased to 2 after // mTrrA and mTrrAAAA are dispatched, and is decreased by 1 when // CompleteLookup is called. Note that nsHostResolver::CompleteLookup is only // called when this counter equals to 0.
--- a/netwerk/dns/TRRService.h +++ b/netwerk/dns/TRRService.h @@ -114,17 +114,17 @@ class TRRService : public TRRServiceBase // or false if mPrivateURI already had that value. bool MaybeSetPrivateURI(const nsACString& aURI) override; void ClearEntireCache(); virtual void ReadEtcHostsFile() override; void AddEtcHosts(const nsTArray<nsCString>&); bool mInitialized{false}; - Mutex mLock{"TRRService"}; + Mutex mLock MOZ_UNANNOTATED{"TRRService"}; nsCString mPrivateCred; // main thread only nsCString mConfirmationNS{"example.com"_ns}; nsCString mBootstrapAddr; Atomic<bool, Relaxed> mCaptiveIsPassed{ false}; // set when captive portal check is passed Atomic<bool, Relaxed> mDisableIPv6; // don't even try
--- a/netwerk/dns/nsDNSService2.h +++ b/netwerk/dns/nsDNSService2.h @@ -101,17 +101,17 @@ class nsDNSService final : public mozill // Locks the mutex and returns an addreffed resolver. May return null. already_AddRefed<nsHostResolver> GetResolverLocked(); RefPtr<nsHostResolver> mResolver; nsCOMPtr<nsIIDNService> mIDN; // mLock protects access to mResolver, mLocalDomains, mIPv4OnlyDomains and // mFailedSVCDomainNames - mozilla::Mutex mLock{"nsDNSServer.mLock"}; + mozilla::Mutex mLock MOZ_UNANNOTATED{"nsDNSServer.mLock"}; // mIPv4OnlyDomains is a comma-separated list of domains for which only // IPv4 DNS lookups are performed. This allows the user to disable IPv6 on // a per-domain basis and work around broken DNS servers. See bug 68796. nsCString mIPv4OnlyDomains; nsCString mForceResolve; bool mDisableIPv6 = false; bool mBlockDotOnion = false;
--- a/netwerk/dns/nsEffectiveTLDService.h +++ b/netwerk/dns/nsEffectiveTLDService.h @@ -51,17 +51,17 @@ class nsEffectiveTLDService final : publ // The DAFSA provides a compact encoding of the rather large eTLD list. mozilla::Maybe<mozilla::Dafsa> mGraph; // Memory map used for a new updated dafsa mozilla::loader::AutoMemMap mDafsaMap; // Lock for mGraph and mDafsaMap - mozilla::RWLock mGraphLock; + mozilla::RWLock mGraphLock MOZ_UNANNOTATED; // Note that the cache entries here can record entries that were cached // successfully or unsuccessfully. mResult must be checked before using an // entry. If it's a success error code, the cache entry is valid and can be // used. struct TLDCacheEntry { nsCString mHost; nsCString mBaseDomain;
--- a/netwerk/dns/nsHostRecord.h +++ b/netwerk/dns/nsHostRecord.h @@ -236,17 +236,17 @@ class AddrHostRecord final : public nsHo /* the lock protects |addr_info| and |addr_info_gencnt| because they * are mutable and accessed by the resolver worker thread and the * nsDNSService2 class. |addr| doesn't change after it has been * assigned a value. only the resolver worker thread modifies * nsHostRecord (and only in nsHostResolver::CompleteLookup); * the other threads just read it. therefore the resolver worker * thread doesn't need to lock when reading |addr_info|. */ - Mutex addr_info_lock{"AddrHostRecord.addr_info_lock"}; + Mutex addr_info_lock MOZ_UNANNOTATED{"AddrHostRecord.addr_info_lock"}; // generation count of |addr_info| int addr_info_gencnt = 0; RefPtr<mozilla::net::AddrInfo> addr_info; mozilla::UniquePtr<mozilla::net::NetAddr> addr; // hold addr_info_lock when calling the blocklist functions bool Blocklisted(const mozilla::net::NetAddr* query); void ResetBlocklist(); @@ -350,17 +350,17 @@ class TypeHostRecord final : public nsHo ~TypeHostRecord(); // Checks if the record is usable (not expired and has a value) bool HasUsableResultInternal(const mozilla::TimeStamp& now, uint16_t queryFlags) const override; bool RefreshForNegativeResponse() const override; mozilla::net::TypeRecordResultType mResults = AsVariant(mozilla::Nothing()); - mozilla::Mutex mResultsLock{"TypeHostRecord.mResultsLock"}; + mozilla::Mutex mResultsLock MOZ_UNANNOTATED{"TypeHostRecord.mResultsLock"}; // When the lookups of this record started (for telemetry). mozilla::TimeStamp mStart; bool mAllRecordsExcluded = false; }; NS_DEFINE_STATIC_IID_ACCESSOR(TypeHostRecord, TYPEHOSTRECORD_IID)