зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
This commit is contained in:
Родитель
48f3643a6a
Коммит
0f4ac7ad97
|
@ -37,7 +37,7 @@ class ObservedDocShell : public MarkersStorage {
|
|||
// Off the main thread only.
|
||||
Mutex mLock;
|
||||
nsTArray<UniquePtr<AbstractTimelineMarker>> mOffTheMainThreadTimelineMarkers
|
||||
GUARDED_BY(mLock);
|
||||
MOZ_GUARDED_BY(mLock);
|
||||
|
||||
public:
|
||||
explicit ObservedDocShell(nsIDocShell* aDocShell);
|
||||
|
|
|
@ -101,11 +101,11 @@ class TimelineConsumers {
|
|||
private:
|
||||
static StaticMutex sMutex;
|
||||
|
||||
static LinkedList<MarkersStorage>& MarkersStores() REQUIRES(sMutex);
|
||||
static LinkedList<MarkersStorage>& MarkersStores() MOZ_REQUIRES(sMutex);
|
||||
|
||||
static uint32_t sActiveConsumers GUARDED_BY(sMutex);
|
||||
static uint32_t sActiveConsumers MOZ_GUARDED_BY(sMutex);
|
||||
static StaticAutoPtr<LinkedList<MarkersStorage>> sMarkersStores
|
||||
GUARDED_BY(sMutex);
|
||||
MOZ_GUARDED_BY(sMutex);
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -426,7 +426,7 @@ void BodyStream::EnqueueChunkWithSizeIntoStream(JSContext* aCx,
|
|||
// thread-safety doesn't handle emplace well
|
||||
NS_IMETHODIMP
|
||||
BodyStream::OnInputStreamReady(nsIAsyncInputStream* aStream)
|
||||
NO_THREAD_SAFETY_ANALYSIS {
|
||||
MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_DIAGNOSTIC_ASSERT(aStream);
|
||||
|
||||
|
|
|
@ -141,17 +141,18 @@ class BodyStream final : public nsIInputStreamCallback,
|
|||
|
||||
void ErrorPropagation(JSContext* aCx,
|
||||
const MutexSingleWriterAutoLock& aProofOfLock,
|
||||
ReadableStream* aStream, nsresult aRv) REQUIRES(mMutex);
|
||||
ReadableStream* aStream, nsresult aRv)
|
||||
MOZ_REQUIRES(mMutex);
|
||||
|
||||
// TODO: convert this to MOZ_CAN_RUN_SCRIPT (bug 1750605)
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY void CloseAndReleaseObjects(
|
||||
JSContext* aCx, const MutexSingleWriterAutoLock& aProofOfLock,
|
||||
ReadableStream* aStream) REQUIRES(mMutex);
|
||||
ReadableStream* aStream) MOZ_REQUIRES(mMutex);
|
||||
|
||||
class WorkerShutdown;
|
||||
|
||||
void ReleaseObjects(const MutexSingleWriterAutoLock& aProofOfLock)
|
||||
REQUIRES(mMutex);
|
||||
MOZ_REQUIRES(mMutex);
|
||||
|
||||
void ReleaseObjects();
|
||||
|
||||
|
@ -186,12 +187,12 @@ class BodyStream final : public nsIInputStreamCallback,
|
|||
MutexSingleWriter mMutex;
|
||||
|
||||
// Protected by mutex.
|
||||
State mState GUARDED_BY(mMutex); // all writes are from the owning thread
|
||||
State mState MOZ_GUARDED_BY(mMutex); // all writes are from the owning thread
|
||||
|
||||
// mGlobal is set on creation, and isn't modified off the owning thread.
|
||||
// It isn't set to nullptr until ReleaseObjects() runs.
|
||||
nsCOMPtr<nsIGlobalObject> mGlobal;
|
||||
RefPtr<BodyStreamHolder> mStreamHolder GUARDED_BY(mMutex);
|
||||
RefPtr<BodyStreamHolder> mStreamHolder MOZ_GUARDED_BY(mMutex);
|
||||
nsCOMPtr<nsIEventTarget> mOwningEventTarget;
|
||||
|
||||
// This is the original inputStream received during the CTOR. It will be
|
||||
|
|
|
@ -272,7 +272,7 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr {
|
|||
~LruPosition() { Reset(); }
|
||||
};
|
||||
|
||||
mutable LruPosition mLruPosition GUARDED_BY(sLruMutex);
|
||||
mutable LruPosition mLruPosition MOZ_GUARDED_BY(sLruMutex);
|
||||
|
||||
void BumpLruLocked(const StaticMutexAutoLock& aProofOfLock);
|
||||
|
||||
|
@ -740,7 +740,7 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr {
|
|||
|
||||
private:
|
||||
static StaticMutex sLruMutex;
|
||||
static std::list<WebGLContext*> sLru GUARDED_BY(sLruMutex);
|
||||
static std::list<WebGLContext*> sLru MOZ_GUARDED_BY(sLruMutex);
|
||||
|
||||
// State tracking slots
|
||||
bool mDitherEnabled = true;
|
||||
|
|
|
@ -81,7 +81,7 @@ class ConsoleReportCollector final : public nsIConsoleReportCollector {
|
|||
Mutex mMutex;
|
||||
|
||||
// protected by mMutex
|
||||
nsTArray<PendingReport> mPendingReports GUARDED_BY(mMutex);
|
||||
nsTArray<PendingReport> mPendingReports MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
|
|
@ -66,12 +66,12 @@ class RemoteLazyInputStream final : public nsIAsyncInputStream,
|
|||
|
||||
~RemoteLazyInputStream();
|
||||
|
||||
void StreamNeeded() REQUIRES(mMutex);
|
||||
void StreamNeeded() MOZ_REQUIRES(mMutex);
|
||||
|
||||
// Upon receiving the stream from our actor, we will not wrap it into an async
|
||||
// stream until needed. This allows callers to get access to the underlying
|
||||
// potentially-sync stream using `TakeInternalStream` before reading.
|
||||
nsresult EnsureAsyncRemoteStream() REQUIRES(mMutex);
|
||||
nsresult EnsureAsyncRemoteStream() MOZ_REQUIRES(mMutex);
|
||||
|
||||
// Note that data has been read from our input stream, and disconnect from our
|
||||
// remote actor.
|
||||
|
@ -82,7 +82,7 @@ class RemoteLazyInputStream final : public nsIAsyncInputStream,
|
|||
IPC::MessageReader* aReader);
|
||||
|
||||
// Helper method to generate a description of a stream for use in loggging.
|
||||
nsCString Describe() REQUIRES(mMutex);
|
||||
nsCString Describe() MOZ_REQUIRES(mMutex);
|
||||
|
||||
// Start and length of the slice to apply on this RemoteLazyInputStream when
|
||||
// fetching the underlying stream with `SendStreamNeeded`.
|
||||
|
@ -112,7 +112,7 @@ class RemoteLazyInputStream final : public nsIAsyncInputStream,
|
|||
// mInnerStream is released and any method will return
|
||||
// NS_BASE_STREAM_CLOSED.
|
||||
eClosed,
|
||||
} mState GUARDED_BY(mMutex) = eClosed;
|
||||
} mState MOZ_GUARDED_BY(mMutex) = eClosed;
|
||||
|
||||
// The actor which will be used to provide the underlying stream or length
|
||||
// information when needed, as well as to efficiently allow transferring the
|
||||
|
@ -121,22 +121,25 @@ class RemoteLazyInputStream final : public nsIAsyncInputStream,
|
|||
// The connection to our actor will be cleared once the stream has been closed
|
||||
// or has started reading, at which point this stream will be serialized and
|
||||
// cloned as-if it was the underlying stream.
|
||||
RefPtr<RemoteLazyInputStreamChild> mActor GUARDED_BY(mMutex);
|
||||
RefPtr<RemoteLazyInputStreamChild> mActor MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
nsCOMPtr<nsIInputStream> mInnerStream GUARDED_BY(mMutex);
|
||||
nsCOMPtr<nsIAsyncInputStream> mAsyncInnerStream GUARDED_BY(mMutex);
|
||||
nsCOMPtr<nsIInputStream> mInnerStream MOZ_GUARDED_BY(mMutex);
|
||||
nsCOMPtr<nsIAsyncInputStream> mAsyncInnerStream MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// These 2 values are set only if mState is ePending or eRunning.
|
||||
// RefPtr is used instead of nsCOMPtr to avoid invoking QueryInterface when
|
||||
// assigning in debug builds, as `mInputStreamCallback` may not be threadsafe.
|
||||
RefPtr<nsIInputStreamCallback> mInputStreamCallback GUARDED_BY(mMutex);
|
||||
nsCOMPtr<nsIEventTarget> mInputStreamCallbackEventTarget GUARDED_BY(mMutex);
|
||||
uint32_t mInputStreamCallbackFlags GUARDED_BY(mMutex) = 0;
|
||||
uint32_t mInputStreamCallbackRequestedCount GUARDED_BY(mMutex) = 0;
|
||||
RefPtr<nsIInputStreamCallback> mInputStreamCallback MOZ_GUARDED_BY(mMutex);
|
||||
nsCOMPtr<nsIEventTarget> mInputStreamCallbackEventTarget
|
||||
MOZ_GUARDED_BY(mMutex);
|
||||
uint32_t mInputStreamCallbackFlags MOZ_GUARDED_BY(mMutex) = 0;
|
||||
uint32_t mInputStreamCallbackRequestedCount MOZ_GUARDED_BY(mMutex) = 0;
|
||||
|
||||
// These 2 values are set only if mState is ePending.
|
||||
nsCOMPtr<nsIFileMetadataCallback> mFileMetadataCallback GUARDED_BY(mMutex);
|
||||
nsCOMPtr<nsIEventTarget> mFileMetadataCallbackEventTarget GUARDED_BY(mMutex);
|
||||
nsCOMPtr<nsIFileMetadataCallback> mFileMetadataCallback
|
||||
MOZ_GUARDED_BY(mMutex);
|
||||
nsCOMPtr<nsIEventTarget> mFileMetadataCallbackEventTarget
|
||||
MOZ_GUARDED_BY(mMutex);
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -154,21 +154,22 @@ class HangMonitorChild : public PProcessHangMonitorChild,
|
|||
bool mSentReport;
|
||||
|
||||
// These fields must be accessed with mMonitor held.
|
||||
bool mTerminateScript GUARDED_BY(mMonitor);
|
||||
bool mStartDebugger GUARDED_BY(mMonitor);
|
||||
bool mFinishedStartingDebugger GUARDED_BY(mMonitor);
|
||||
bool mPaintWhileInterruptingJS GUARDED_BY(mMonitor);
|
||||
TabId mPaintWhileInterruptingJSTab GUARDED_BY(mMonitor);
|
||||
bool mTerminateScript MOZ_GUARDED_BY(mMonitor);
|
||||
bool mStartDebugger MOZ_GUARDED_BY(mMonitor);
|
||||
bool mFinishedStartingDebugger MOZ_GUARDED_BY(mMonitor);
|
||||
bool mPaintWhileInterruptingJS MOZ_GUARDED_BY(mMonitor);
|
||||
TabId mPaintWhileInterruptingJSTab MOZ_GUARDED_BY(mMonitor);
|
||||
MOZ_INIT_OUTSIDE_CTOR LayersObserverEpoch mPaintWhileInterruptingJSEpoch
|
||||
GUARDED_BY(mMonitor);
|
||||
bool mCancelContentJS GUARDED_BY(mMonitor);
|
||||
TabId mCancelContentJSTab GUARDED_BY(mMonitor);
|
||||
MOZ_GUARDED_BY(mMonitor);
|
||||
bool mCancelContentJS MOZ_GUARDED_BY(mMonitor);
|
||||
TabId mCancelContentJSTab MOZ_GUARDED_BY(mMonitor);
|
||||
nsIRemoteTab::NavigationType mCancelContentJSNavigationType
|
||||
GUARDED_BY(mMonitor);
|
||||
int32_t mCancelContentJSNavigationIndex GUARDED_BY(mMonitor);
|
||||
mozilla::Maybe<nsCString> mCancelContentJSNavigationURI GUARDED_BY(mMonitor);
|
||||
int32_t mCancelContentJSEpoch GUARDED_BY(mMonitor);
|
||||
bool mShutdownDone GUARDED_BY(mMonitor);
|
||||
MOZ_GUARDED_BY(mMonitor);
|
||||
int32_t mCancelContentJSNavigationIndex MOZ_GUARDED_BY(mMonitor);
|
||||
mozilla::Maybe<nsCString> mCancelContentJSNavigationURI
|
||||
MOZ_GUARDED_BY(mMonitor);
|
||||
int32_t mCancelContentJSEpoch MOZ_GUARDED_BY(mMonitor);
|
||||
bool mShutdownDone MOZ_GUARDED_BY(mMonitor);
|
||||
|
||||
JSContext* mContext; // const after constructor
|
||||
|
||||
|
@ -291,14 +292,14 @@ class HangMonitorParent : public PProcessHangMonitorParent,
|
|||
RefPtr<HangMonitoredProcess> mProcess;
|
||||
|
||||
// Must be accessed with mMonitor held.
|
||||
bool mShutdownDone GUARDED_BY(mMonitor);
|
||||
bool mShutdownDone MOZ_GUARDED_BY(mMonitor);
|
||||
// Map from plugin ID to crash dump ID. Protected by
|
||||
// mBrowserCrashDumpHashLock.
|
||||
nsTHashMap<nsUint32HashKey, nsString> mBrowserCrashDumpIds
|
||||
GUARDED_BY(mMonitor);
|
||||
Mutex mBrowserCrashDumpHashLock GUARDED_BY(mMonitor);
|
||||
MOZ_GUARDED_BY(mMonitor);
|
||||
Mutex mBrowserCrashDumpHashLock MOZ_GUARDED_BY(mMonitor);
|
||||
mozilla::ipc::TaskFactory<HangMonitorParent> mMainThreadTaskFactory
|
||||
GUARDED_BY(mMonitor);
|
||||
MOZ_GUARDED_BY(mMonitor);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -228,7 +228,7 @@ int AudioStream::InvokeCubeb(Function aFunction, Args&&... aArgs) {
|
|||
}
|
||||
|
||||
nsresult AudioStream::Init(AudioDeviceInfo* aSinkInfo)
|
||||
NO_THREAD_SAFETY_ANALYSIS {
|
||||
MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
auto startTime = TimeStamp::Now();
|
||||
TRACE("AudioStream::Init");
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ class AudioClock {
|
|||
// protected by the AudioStream monitor on other platforms.
|
||||
const UniquePtr<FrameHistory> mFrameHistory
|
||||
# ifndef XP_MACOSX
|
||||
GUARDED_BY(mMutex)
|
||||
MOZ_GUARDED_BY(mMutex)
|
||||
# endif
|
||||
;
|
||||
# ifdef XP_MACOSX
|
||||
|
@ -335,10 +335,10 @@ class AudioStream final {
|
|||
|
||||
// Return true if audio frames are valid (correct sampling rate and valid
|
||||
// channel count) otherwise false.
|
||||
bool IsValidAudioFormat(Chunk* aChunk) REQUIRES(mMonitor);
|
||||
bool IsValidAudioFormat(Chunk* aChunk) MOZ_REQUIRES(mMonitor);
|
||||
|
||||
template <typename Function, typename... Args>
|
||||
int InvokeCubeb(Function aFunction, Args&&... aArgs) REQUIRES(mMonitor);
|
||||
int InvokeCubeb(Function aFunction, Args&&... aArgs) MOZ_REQUIRES(mMonitor);
|
||||
bool CheckThreadIdChanged();
|
||||
void AssertIsOnAudioThread() const;
|
||||
|
||||
|
@ -382,7 +382,8 @@ class AudioStream final {
|
|||
std::atomic<ProfilerThreadId> mAudioThreadId;
|
||||
const bool mSandboxed = false;
|
||||
|
||||
MozPromiseHolder<MediaSink::EndedPromise> mEndedPromise GUARDED_BY(mMonitor);
|
||||
MozPromiseHolder<MediaSink::EndedPromise> mEndedPromise
|
||||
MOZ_GUARDED_BY(mMonitor);
|
||||
std::atomic<bool> mPlaybackComplete;
|
||||
// Both written on the MDSM thread, read on the audio thread.
|
||||
std::atomic<float> mPlaybackRate;
|
||||
|
|
|
@ -151,9 +151,9 @@ class FileBlockCache : public MediaBlockCacheBase {
|
|||
nsresult WriteBlockToFile(int32_t aBlockIndex, const uint8_t* aBlockData);
|
||||
// File descriptor we're writing to. This is created externally, but
|
||||
// shutdown by us.
|
||||
PRFileDesc* mFD PT_GUARDED_BY(mFileMutex);
|
||||
PRFileDesc* mFD MOZ_PT_GUARDED_BY(mFileMutex);
|
||||
// The current file offset in the file.
|
||||
int64_t mFDCurrentPos GUARDED_BY(mFileMutex);
|
||||
int64_t mFDCurrentPos MOZ_GUARDED_BY(mFileMutex);
|
||||
|
||||
// Mutex which controls access to all data in this class, except mFD
|
||||
// and mFDCurrentPos. Don't hold mDataMutex while holding mFileMutex!
|
||||
|
@ -170,22 +170,22 @@ class FileBlockCache : public MediaBlockCacheBase {
|
|||
// mBlockChanges[offset/BLOCK_SIZE] != nullptr, then either there's a block
|
||||
// cached in memory waiting to be written, or this block is the target of a
|
||||
// block move.
|
||||
nsTArray<RefPtr<BlockChange> > mBlockChanges GUARDED_BY(mDataMutex);
|
||||
nsTArray<RefPtr<BlockChange> > mBlockChanges MOZ_GUARDED_BY(mDataMutex);
|
||||
// Event target upon which block writes and block moves are performed. This is
|
||||
// created upon open, and dropped on close.
|
||||
nsCOMPtr<nsISerialEventTarget> mBackgroundET GUARDED_BY(mDataMutex);
|
||||
nsCOMPtr<nsISerialEventTarget> mBackgroundET MOZ_GUARDED_BY(mDataMutex);
|
||||
// Queue of pending block indexes that need to be written or moved.
|
||||
std::deque<int32_t> mChangeIndexList GUARDED_BY(mDataMutex);
|
||||
std::deque<int32_t> mChangeIndexList MOZ_GUARDED_BY(mDataMutex);
|
||||
// True if we've dispatched an event to commit all pending block changes
|
||||
// to file on mBackgroundET.
|
||||
bool mIsWriteScheduled GUARDED_BY(mDataMutex);
|
||||
bool mIsWriteScheduled MOZ_GUARDED_BY(mDataMutex);
|
||||
// True when a read is happening. Pending writes may be postponed, to give
|
||||
// higher priority to reads (which may be blocking the caller).
|
||||
bool mIsReading GUARDED_BY(mDataMutex);
|
||||
bool mIsReading MOZ_GUARDED_BY(mDataMutex);
|
||||
// True if we've got a temporary file descriptor. Note: we don't use mFD
|
||||
// directly as that's synchronized via mFileMutex and we need to make
|
||||
// decisions about whether we can write while holding mDataMutex.
|
||||
bool mInitialized GUARDED_BY(mDataMutex) = false;
|
||||
bool mInitialized MOZ_GUARDED_BY(mDataMutex) = false;
|
||||
};
|
||||
|
||||
} // End namespace mozilla.
|
||||
|
|
|
@ -91,21 +91,21 @@ class FileMediaResource : public BaseMediaResource {
|
|||
// calling. The implmentation of Read, Seek and ReadAt obtains the
|
||||
// lock before calling these Unsafe variants to read or seek.
|
||||
nsresult UnsafeRead(char* aBuffer, uint32_t aCount, uint32_t* aBytes)
|
||||
REQUIRES(mLock);
|
||||
nsresult UnsafeSeek(int32_t aWhence, int64_t aOffset) REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
nsresult UnsafeSeek(int32_t aWhence, int64_t aOffset) MOZ_REQUIRES(mLock);
|
||||
|
||||
private:
|
||||
// Ensures mSize is initialized, if it can be.
|
||||
// mLock must be held when this is called, and mInput must be non-null.
|
||||
void EnsureSizeInitialized() REQUIRES(mLock);
|
||||
void EnsureSizeInitialized() MOZ_REQUIRES(mLock);
|
||||
already_AddRefed<MediaByteBuffer> UnsafeMediaReadAt(int64_t aOffset,
|
||||
uint32_t aCount)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
// The file size, or -1 if not known. Immutable after Open().
|
||||
// Can be used from any thread.
|
||||
// XXX FIX? is this under mLock? comments are contradictory
|
||||
int64_t mSize GUARDED_BY(mLock);
|
||||
int64_t mSize MOZ_GUARDED_BY(mLock);
|
||||
|
||||
// This lock handles synchronisation between calls to Close() and
|
||||
// the Read, Seek, etc calls. Close must not be called while a
|
||||
|
@ -116,16 +116,16 @@ class FileMediaResource : public BaseMediaResource {
|
|||
|
||||
// Seekable stream interface to file. This can be used from any
|
||||
// thread.
|
||||
nsCOMPtr<nsISeekableStream> mSeekable GUARDED_BY(mLock);
|
||||
nsCOMPtr<nsISeekableStream> mSeekable MOZ_GUARDED_BY(mLock);
|
||||
|
||||
// Input stream for the media data. This can be used from any
|
||||
// thread.
|
||||
nsCOMPtr<nsIInputStream> mInput GUARDED_BY(mLock);
|
||||
nsCOMPtr<nsIInputStream> mInput MOZ_GUARDED_BY(mLock);
|
||||
|
||||
// Whether we've attempted to initialize mSize. Note that mSize can be -1
|
||||
// when mSizeInitialized is true if we tried and failed to get the size
|
||||
// of the file.
|
||||
bool mSizeInitialized GUARDED_BY(mLock);
|
||||
bool mSizeInitialized MOZ_GUARDED_BY(mLock);
|
||||
// Set to true if NotifyDataEnded callback has been processed (which only
|
||||
// occurs if resource size is known)
|
||||
bool mNotifyDataEndedProcessed = false;
|
||||
|
|
|
@ -86,9 +86,9 @@ class GraphRunner final : public Runnable {
|
|||
MediaTrackGraphImpl* const mGraph;
|
||||
// State being handed over to the graph through OneIteration. Protected by
|
||||
// mMonitor.
|
||||
Maybe<IterationState> mIterationState GUARDED_BY(mMonitor);
|
||||
Maybe<IterationState> mIterationState MOZ_GUARDED_BY(mMonitor);
|
||||
// Result from mGraph's OneIteration. Protected by mMonitor.
|
||||
IterationResult mIterationResult GUARDED_BY(mMonitor);
|
||||
IterationResult mIterationResult MOZ_GUARDED_BY(mMonitor);
|
||||
|
||||
enum class ThreadState {
|
||||
Wait, // Waiting for a message. This is the initial state.
|
||||
|
@ -100,7 +100,7 @@ class GraphRunner final : public Runnable {
|
|||
};
|
||||
// Protected by mMonitor until set to Shutdown, after which this is not
|
||||
// modified.
|
||||
ThreadState mThreadState GUARDED_BY(mMonitor);
|
||||
ThreadState mThreadState MOZ_GUARDED_BY(mMonitor);
|
||||
|
||||
// The thread running mGraph. Set on construction, after other members are
|
||||
// initialized. Cleared at the end of Shutdown().
|
||||
|
|
|
@ -1533,9 +1533,9 @@ auto MediaTrackGraphImpl::OneIterationImpl(GraphTime aStateTime,
|
|||
// > LIFECYCLE_RUNNING)
|
||||
|
||||
// Ignore mutex warning: static during execution of the graph
|
||||
PUSH_IGNORE_THREAD_SAFETY
|
||||
MOZ_PUSH_IGNORE_THREAD_SAFETY
|
||||
MOZ_DIAGNOSTIC_ASSERT(mLifecycleState <= LIFECYCLE_RUNNING);
|
||||
POP_THREAD_SAFETY
|
||||
MOZ_POP_THREAD_SAFETY
|
||||
|
||||
MOZ_ASSERT(OnGraphThread());
|
||||
|
||||
|
@ -2725,7 +2725,7 @@ bool SourceMediaTrack::PullNewData(GraphTime aDesiredUpToTime) {
|
|||
static void MoveToSegment(SourceMediaTrack* aTrack, MediaSegment* aIn,
|
||||
MediaSegment* aOut, TrackTime aCurrentTime,
|
||||
TrackTime aDesiredUpToTime)
|
||||
REQUIRES(aTrack->GetMutex()) {
|
||||
MOZ_REQUIRES(aTrack->GetMutex()) {
|
||||
MOZ_ASSERT(aIn->GetType() == aOut->GetType());
|
||||
MOZ_ASSERT(aOut->GetDuration() >= aCurrentTime);
|
||||
MOZ_ASSERT(aDesiredUpToTime >= aCurrentTime);
|
||||
|
|
|
@ -671,9 +671,9 @@ class SourceMediaTrack : public MediaTrack {
|
|||
// The value set here is applied in MoveToSegment so we can avoid the
|
||||
// buffering delay in applying the change. See Bug 1443511.
|
||||
void SetVolume(float aVolume);
|
||||
float GetVolumeLocked() REQUIRES(mMutex);
|
||||
float GetVolumeLocked() MOZ_REQUIRES(mMutex);
|
||||
|
||||
Mutex& GetMutex() RETURN_CAPABILITY(mMutex) { return mMutex; }
|
||||
Mutex& GetMutex() MOZ_RETURN_CAPABILITY(mMutex) { return mMutex; }
|
||||
|
||||
friend class MediaTrackGraphImpl;
|
||||
|
||||
|
@ -706,7 +706,8 @@ class SourceMediaTrack : public MediaTrack {
|
|||
|
||||
bool NeedsMixing();
|
||||
|
||||
void ResampleAudioToGraphSampleRate(MediaSegment* aSegment) REQUIRES(mMutex);
|
||||
void ResampleAudioToGraphSampleRate(MediaSegment* aSegment)
|
||||
MOZ_REQUIRES(mMutex);
|
||||
|
||||
void AddDirectListenerImpl(
|
||||
already_AddRefed<DirectMediaTrackListener> aListener) override;
|
||||
|
@ -718,7 +719,7 @@ class SourceMediaTrack : public MediaTrack {
|
|||
* from AppendData on the thread providing the data, and will call
|
||||
* the Listeners on this thread.
|
||||
*/
|
||||
void NotifyDirectConsumers(MediaSegment* aSegment) REQUIRES(mMutex);
|
||||
void NotifyDirectConsumers(MediaSegment* aSegment) MOZ_REQUIRES(mMutex);
|
||||
|
||||
void OnGraphThreadDone() override {
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
@ -739,10 +740,10 @@ class SourceMediaTrack : public MediaTrack {
|
|||
// held together.
|
||||
Mutex mMutex;
|
||||
// protected by mMutex
|
||||
float mVolume GUARDED_BY(mMutex) = 1.0;
|
||||
UniquePtr<TrackData> mUpdateTrack GUARDED_BY(mMutex);
|
||||
float mVolume MOZ_GUARDED_BY(mMutex) = 1.0;
|
||||
UniquePtr<TrackData> mUpdateTrack MOZ_GUARDED_BY(mMutex);
|
||||
nsTArray<RefPtr<DirectMediaTrackListener>> mDirectTrackListeners
|
||||
GUARDED_BY(mMutex);
|
||||
MOZ_GUARDED_BY(mMutex);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -189,7 +189,7 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
/**
|
||||
* Called to apply a TrackUpdate to its track.
|
||||
*/
|
||||
void ApplyTrackUpdate(TrackUpdate* aUpdate) REQUIRES(mMonitor);
|
||||
void ApplyTrackUpdate(TrackUpdate* aUpdate) MOZ_REQUIRES(mMonitor);
|
||||
/**
|
||||
* Append a ControlMessage to the message queue. This queue is drained
|
||||
* during RunInStableState; the messages will run on the graph thread.
|
||||
|
@ -280,12 +280,13 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
* mMonitor must be held.
|
||||
* See EnsureRunInStableState
|
||||
*/
|
||||
void EnsureStableStateEventPosted() REQUIRES(mMonitor);
|
||||
void EnsureStableStateEventPosted() MOZ_REQUIRES(mMonitor);
|
||||
/**
|
||||
* Generate messages to the main thread to update it for all state changes.
|
||||
* mMonitor must be held.
|
||||
*/
|
||||
void PrepareUpdatesToMainThreadState(bool aFinalUpdate) REQUIRES(mMonitor);
|
||||
void PrepareUpdatesToMainThreadState(bool aFinalUpdate)
|
||||
MOZ_REQUIRES(mMonitor);
|
||||
/**
|
||||
* If we are rendering in non-realtime mode, we don't want to send messages to
|
||||
* the main thread at each iteration for performance reasons. We instead
|
||||
|
@ -319,7 +320,7 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
*/
|
||||
void UpdateGraph(GraphTime aEndBlockingDecisions);
|
||||
|
||||
void SwapMessageQueues() REQUIRES(mMonitor) {
|
||||
void SwapMessageQueues() MOZ_REQUIRES(mMonitor) {
|
||||
MOZ_ASSERT(OnGraphThreadOrNotRunning());
|
||||
mMonitor.AssertCurrentThreadOwns();
|
||||
MOZ_ASSERT(mFrontMessageQueue.IsEmpty());
|
||||
|
@ -553,7 +554,7 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
/**
|
||||
* Not safe to call off the MediaTrackGraph thread unless monitor is held!
|
||||
*/
|
||||
GraphDriver* CurrentDriver() const NO_THREAD_SAFETY_ANALYSIS {
|
||||
GraphDriver* CurrentDriver() const MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
#ifdef DEBUG
|
||||
if (!OnGraphThreadOrNotRunning()) {
|
||||
mMonitor.AssertCurrentThreadOwns();
|
||||
|
@ -787,11 +788,11 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
/**
|
||||
* State to copy to main thread
|
||||
*/
|
||||
nsTArray<TrackUpdate> mTrackUpdates GUARDED_BY(mMonitor);
|
||||
nsTArray<TrackUpdate> mTrackUpdates MOZ_GUARDED_BY(mMonitor);
|
||||
/**
|
||||
* Runnables to run after the next update to main thread state.
|
||||
*/
|
||||
nsTArray<nsCOMPtr<nsIRunnable>> mUpdateRunnables GUARDED_BY(mMonitor);
|
||||
nsTArray<nsCOMPtr<nsIRunnable>> mUpdateRunnables MOZ_GUARDED_BY(mMonitor);
|
||||
/**
|
||||
* A list of batches of messages to process. Each batch is processed
|
||||
* as an atomic unit.
|
||||
|
@ -805,10 +806,10 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
* Message queue in which the main thread appends messages.
|
||||
* Access guarded by mMonitor.
|
||||
*/
|
||||
nsTArray<MessageBlock> mBackMessageQueue GUARDED_BY(mMonitor);
|
||||
nsTArray<MessageBlock> mBackMessageQueue MOZ_GUARDED_BY(mMonitor);
|
||||
|
||||
/* True if there will messages to process if we swap the message queues. */
|
||||
bool MessagesQueued() const REQUIRES(mMonitor) {
|
||||
bool MessagesQueued() const MOZ_REQUIRES(mMonitor) {
|
||||
mMonitor.AssertCurrentThreadOwns();
|
||||
return !mBackMessageQueue.IsEmpty();
|
||||
}
|
||||
|
@ -862,8 +863,8 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
* LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP occur on the graph thread at
|
||||
* the end of an iteration. All other transitions occur on the main thread.
|
||||
*/
|
||||
LifecycleState mLifecycleState GUARDED_BY(mMonitor);
|
||||
LifecycleState& LifecycleStateRef() NO_THREAD_SAFETY_ANALYSIS {
|
||||
LifecycleState mLifecycleState MOZ_GUARDED_BY(mMonitor);
|
||||
LifecycleState& LifecycleStateRef() MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
#if DEBUG
|
||||
if (mGraphDriverRunning) {
|
||||
mMonitor.AssertCurrentThreadOwns();
|
||||
|
@ -873,7 +874,8 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
#endif
|
||||
return mLifecycleState;
|
||||
}
|
||||
const LifecycleState& LifecycleStateRef() const NO_THREAD_SAFETY_ANALYSIS {
|
||||
const LifecycleState& LifecycleStateRef() const
|
||||
MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
#if DEBUG
|
||||
if (mGraphDriverRunning) {
|
||||
mMonitor.AssertCurrentThreadOwns();
|
||||
|
@ -899,7 +901,7 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
* forced) has commenced. Set on the main thread under mMonitor and read on
|
||||
* the graph thread under mMonitor.
|
||||
**/
|
||||
bool mInterruptJSCalled GUARDED_BY(mMonitor) = false;
|
||||
bool mInterruptJSCalled MOZ_GUARDED_BY(mMonitor) = false;
|
||||
|
||||
/**
|
||||
* Remove this blocker to unblock shutdown.
|
||||
|
@ -912,7 +914,7 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
* RunInStableState() and the event hasn't run yet.
|
||||
* Accessed on both main and MTG thread, mMonitor must be held.
|
||||
*/
|
||||
bool mPostedRunInStableStateEvent GUARDED_BY(mMonitor);
|
||||
bool mPostedRunInStableStateEvent MOZ_GUARDED_BY(mMonitor);
|
||||
|
||||
/**
|
||||
* The JSContext of the graph thread. Set under mMonitor on only the graph
|
||||
|
@ -920,7 +922,7 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
* the thread is about to exit. Read under mMonitor on the main thread to
|
||||
* interrupt running JS for forced shutdown.
|
||||
**/
|
||||
JSContext* mJSContext GUARDED_BY(mMonitor) = nullptr;
|
||||
JSContext* mJSContext MOZ_GUARDED_BY(mMonitor) = nullptr;
|
||||
|
||||
// Main thread only
|
||||
|
||||
|
@ -1015,7 +1017,7 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
* Set based on mProcessedTime at end of iteration.
|
||||
* Read by stable state runnable on main thread. Protected by mMonitor.
|
||||
*/
|
||||
GraphTime mNextMainThreadGraphTime GUARDED_BY(mMonitor) = 0;
|
||||
GraphTime mNextMainThreadGraphTime MOZ_GUARDED_BY(mMonitor) = 0;
|
||||
|
||||
/**
|
||||
* Cached audio output latency, in seconds. Main thread only. This is reset
|
||||
|
|
|
@ -20,12 +20,12 @@ namespace mozilla {
|
|||
|
||||
// Default reader locking strategy, using a mutex to ensure that concurrent
|
||||
// PopAll calls won't overlap.
|
||||
class CAPABILITY MultiWriterQueueReaderLocking_Mutex {
|
||||
class MOZ_CAPABILITY MultiWriterQueueReaderLocking_Mutex {
|
||||
public:
|
||||
MultiWriterQueueReaderLocking_Mutex()
|
||||
: mMutex("MultiWriterQueueReaderLocking_Mutex") {}
|
||||
void Lock() CAPABILITY_ACQUIRE(mMutex) { mMutex.Lock(); };
|
||||
void Unlock() CAPABILITY_RELEASE(mMutex) { mMutex.Unlock(); };
|
||||
void Lock() MOZ_CAPABILITY_ACQUIRE(mMutex) { mMutex.Lock(); };
|
||||
void Unlock() MOZ_CAPABILITY_RELEASE(mMutex) { mMutex.Unlock(); };
|
||||
|
||||
private:
|
||||
Mutex mMutex;
|
||||
|
@ -33,17 +33,17 @@ class CAPABILITY MultiWriterQueueReaderLocking_Mutex {
|
|||
|
||||
// Reader non-locking strategy, trusting that PopAll will never be called
|
||||
// concurrently (e.g., by only calling it from a specific thread).
|
||||
class CAPABILITY MultiWriterQueueReaderLocking_None {
|
||||
class MOZ_CAPABILITY MultiWriterQueueReaderLocking_None {
|
||||
public:
|
||||
#ifndef DEBUG
|
||||
void Lock() CAPABILITY_ACQUIRE(){};
|
||||
void Unlock() CAPABILITY_RELEASE(){};
|
||||
void Lock() MOZ_CAPABILITY_ACQUIRE(){};
|
||||
void Unlock() MOZ_CAPABILITY_RELEASE(){};
|
||||
#else
|
||||
// DEBUG-mode checks to catch concurrent misuses.
|
||||
void Lock() CAPABILITY_ACQUIRE() {
|
||||
void Lock() MOZ_CAPABILITY_ACQUIRE() {
|
||||
MOZ_ASSERT(mLocked.compareExchange(false, true));
|
||||
};
|
||||
void Unlock() CAPABILITY_RELEASE() {
|
||||
void Unlock() MOZ_CAPABILITY_RELEASE() {
|
||||
MOZ_ASSERT(mLocked.compareExchange(true, false));
|
||||
};
|
||||
|
||||
|
|
|
@ -257,11 +257,11 @@ GMPMutexImpl::~GMPMutexImpl() { MOZ_COUNT_DTOR(GMPMutexImpl); }
|
|||
|
||||
void GMPMutexImpl::Destroy() { delete this; }
|
||||
|
||||
PUSH_IGNORE_THREAD_SAFETY
|
||||
MOZ_PUSH_IGNORE_THREAD_SAFETY
|
||||
void GMPMutexImpl::Acquire() { mMonitor.Enter(); }
|
||||
|
||||
void GMPMutexImpl::Release() { mMonitor.Exit(); }
|
||||
POP_THREAD_SAFETY
|
||||
MOZ_POP_THREAD_SAFETY
|
||||
|
||||
GMPTask* NewGMPTask(std::function<void()>&& aFunction) {
|
||||
class Task : public GMPTask {
|
||||
|
|
|
@ -36,11 +36,11 @@ using namespace gfx;
|
|||
// launched serially. Protects sLaunchPromise
|
||||
StaticMutex sLaunchRDDMutex;
|
||||
static StaticRefPtr<GenericNonExclusivePromise> sLaunchRDDPromise
|
||||
GUARDED_BY(sLaunchRDDMutex);
|
||||
MOZ_GUARDED_BY(sLaunchRDDMutex);
|
||||
|
||||
StaticMutex sLaunchUtilityMutex;
|
||||
static StaticRefPtr<GenericNonExclusivePromise> sLaunchUtilityPromise
|
||||
GUARDED_BY(sLaunchUtilityMutex);
|
||||
MOZ_GUARDED_BY(sLaunchUtilityMutex);
|
||||
|
||||
// Only modified on the main-thread, read on any thread. While it could be read
|
||||
// on the main thread directly, for clarity we force access via the DataMutex
|
||||
|
|
|
@ -154,7 +154,7 @@ class TrackBuffersManager final
|
|||
MediaResult& aResult);
|
||||
int32_t FindCurrentPosition(TrackInfo::TrackType aTrack,
|
||||
const media::TimeUnit& aFuzz) const
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
|
||||
// Will set the next GetSample index if needed. This information is determined
|
||||
// through the value of mNextSampleTimecode. Return false if the index
|
||||
|
@ -163,7 +163,7 @@ class TrackBuffersManager final
|
|||
// timecode or is empty.
|
||||
nsresult SetNextGetSampleIndexIfNeeded(TrackInfo::TrackType aTrack,
|
||||
const media::TimeUnit& aFuzz)
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
|
||||
media::TimeUnit GetNextRandomAccessPoint(TrackInfo::TrackType aTrack,
|
||||
const media::TimeUnit& aFuzz);
|
||||
|
@ -183,62 +183,62 @@ class TrackBuffersManager final
|
|||
// All following functions run on the taskqueue.
|
||||
RefPtr<AppendPromise> DoAppendData(already_AddRefed<MediaByteBuffer> aData,
|
||||
const SourceBufferAttributes& aAttributes);
|
||||
void ScheduleSegmentParserLoop() REQUIRES(mTaskQueueCapability);
|
||||
void SegmentParserLoop() REQUIRES(mTaskQueueCapability);
|
||||
void InitializationSegmentReceived() REQUIRES(mTaskQueueCapability);
|
||||
void ShutdownDemuxers() REQUIRES(mTaskQueueCapability);
|
||||
void CreateDemuxerforMIMEType() REQUIRES(mTaskQueueCapability);
|
||||
void ResetDemuxingState() REQUIRES(mTaskQueueCapability);
|
||||
void NeedMoreData() REQUIRES(mTaskQueueCapability);
|
||||
void ScheduleSegmentParserLoop() MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void SegmentParserLoop() MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void InitializationSegmentReceived() MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void ShutdownDemuxers() MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void CreateDemuxerforMIMEType() MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void ResetDemuxingState() MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void NeedMoreData() MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void RejectAppend(const MediaResult& aRejectValue, const char* aName)
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
// Will return a promise that will be resolved once all frames of the current
|
||||
// media segment have been processed.
|
||||
RefPtr<CodedFrameProcessingPromise> CodedFrameProcessing()
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
void CompleteCodedFrameProcessing() REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void CompleteCodedFrameProcessing() MOZ_REQUIRES(mTaskQueueCapability);
|
||||
// Called by ResetParserState.
|
||||
void CompleteResetParserState() REQUIRES(mTaskQueueCapability);
|
||||
void CompleteResetParserState() MOZ_REQUIRES(mTaskQueueCapability);
|
||||
RefPtr<RangeRemovalPromise> CodedFrameRemovalWithPromise(
|
||||
media::TimeInterval aInterval) REQUIRES(mTaskQueueCapability);
|
||||
media::TimeInterval aInterval) MOZ_REQUIRES(mTaskQueueCapability);
|
||||
bool CodedFrameRemoval(media::TimeInterval aInterval)
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
// Removes all coded frames -- this is not to spec and should be used as a
|
||||
// last resort to clear buffers only if other methods cannot.
|
||||
void RemoveAllCodedFrames() REQUIRES(mTaskQueueCapability);
|
||||
void RemoveAllCodedFrames() MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void SetAppendState(SourceBufferAttributes::AppendState aAppendState)
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
|
||||
bool HasVideo() const { return mVideoTracks.mNumTracks > 0; }
|
||||
bool HasAudio() const { return mAudioTracks.mNumTracks > 0; }
|
||||
|
||||
// The input buffer as per
|
||||
// http://w3c.github.io/media-source/index.html#sourcebuffer-input-buffer
|
||||
Maybe<MediaSpan> mInputBuffer GUARDED_BY(mTaskQueueCapability);
|
||||
Maybe<MediaSpan> mInputBuffer MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
// Buffer full flag as per
|
||||
// https://w3c.github.io/media-source/#sourcebuffer-buffer-full-flag. Accessed
|
||||
// on both the main thread and the task queue.
|
||||
Atomic<bool> mBufferFull;
|
||||
bool mFirstInitializationSegmentReceived GUARDED_BY(mTaskQueueCapability);
|
||||
bool mChangeTypeReceived GUARDED_BY(mTaskQueueCapability);
|
||||
bool mFirstInitializationSegmentReceived MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
bool mChangeTypeReceived MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
// Set to true once a new segment is started.
|
||||
bool mNewMediaSegmentStarted GUARDED_BY(mTaskQueueCapability);
|
||||
bool mActiveTrack GUARDED_BY(mTaskQueueCapability);
|
||||
MediaContainerType mType GUARDED_BY(mTaskQueueCapability);
|
||||
bool mNewMediaSegmentStarted MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
bool mActiveTrack MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
MediaContainerType mType MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
|
||||
// ContainerParser objects and methods.
|
||||
// Those are used to parse the incoming input buffer.
|
||||
|
||||
// Recreate the ContainerParser and if aReuseInitData is true then
|
||||
// feed it with the previous init segment found.
|
||||
void RecreateParser(bool aReuseInitData) REQUIRES(mTaskQueueCapability);
|
||||
void RecreateParser(bool aReuseInitData) MOZ_REQUIRES(mTaskQueueCapability);
|
||||
UniquePtr<ContainerParser> mParser;
|
||||
|
||||
// Demuxer objects and methods.
|
||||
void AppendDataToCurrentInputBuffer(const MediaSpan& aData)
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
|
||||
RefPtr<MediaByteBuffer> mInitData GUARDED_BY(mTaskQueueCapability);
|
||||
RefPtr<MediaByteBuffer> mInitData MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
|
||||
// Checks if a new set of init data is a repeat of the last set of init data
|
||||
// received. Because streams may retransmit the same init data (or
|
||||
|
@ -246,36 +246,37 @@ class TrackBuffersManager final
|
|||
// operations each time we receive init data, only when it's actually
|
||||
// different data.
|
||||
bool IsRepeatInitData(const MediaInfo& aNewMediaInfo) const
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
|
||||
// Temporary input buffer to handle partial media segment header.
|
||||
// We store the current input buffer content into it should we need to
|
||||
// reinitialize the demuxer once we have some samples and a discontinuity is
|
||||
// detected.
|
||||
Maybe<MediaSpan> mPendingInputBuffer GUARDED_BY(mTaskQueueCapability);
|
||||
Maybe<MediaSpan> mPendingInputBuffer MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
RefPtr<SourceBufferResource> mCurrentInputBuffer
|
||||
GUARDED_BY(mTaskQueueCapability);
|
||||
RefPtr<MediaDataDemuxer> mInputDemuxer GUARDED_BY(mTaskQueueCapability);
|
||||
MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
RefPtr<MediaDataDemuxer> mInputDemuxer MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
// Length already processed in current media segment.
|
||||
uint64_t mProcessedInput GUARDED_BY(mTaskQueueCapability);
|
||||
Maybe<media::TimeUnit> mLastParsedEndTime GUARDED_BY(mTaskQueueCapability);
|
||||
uint64_t mProcessedInput MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
Maybe<media::TimeUnit> mLastParsedEndTime
|
||||
MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
|
||||
void OnDemuxerInitDone(const MediaResult& aResult);
|
||||
void OnDemuxerInitFailed(const MediaResult& aFailure);
|
||||
void OnDemuxerResetDone(const MediaResult& aResult)
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
MozPromiseRequestHolder<MediaDataDemuxer::InitPromise> mDemuxerInitRequest;
|
||||
|
||||
void OnDemuxFailed(TrackType aTrack, const MediaResult& aError)
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
void DoDemuxVideo() REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void DoDemuxVideo() MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void OnVideoDemuxCompleted(RefPtr<MediaTrackDemuxer::SamplesHolder> aSamples);
|
||||
void OnVideoDemuxFailed(const MediaResult& aError) {
|
||||
mVideoTracks.mDemuxRequest.Complete();
|
||||
mTaskQueueCapability->AssertOnCurrentThread();
|
||||
OnDemuxFailed(TrackType::kVideoTrack, aError);
|
||||
}
|
||||
void DoDemuxAudio() REQUIRES(mTaskQueueCapability);
|
||||
void DoDemuxAudio() MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void OnAudioDemuxCompleted(RefPtr<MediaTrackDemuxer::SamplesHolder> aSamples);
|
||||
void OnAudioDemuxFailed(const MediaResult& aError) {
|
||||
mAudioTracks.mDemuxRequest.Complete();
|
||||
|
@ -289,10 +290,10 @@ class TrackBuffersManager final
|
|||
const nsTArray<RefPtr<MediaRawData>>& aSamples);
|
||||
|
||||
void DoEvictData(const media::TimeUnit& aPlaybackTime, int64_t aSizeToEvict)
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
|
||||
void GetDebugInfo(dom::TrackBuffersManagerDebugInfo& aInfo) const
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
|
||||
struct TrackData {
|
||||
TrackData() : mNumTracks(0), mNeedRandomAccessPoint(true), mSizeBuffer(0) {}
|
||||
|
@ -416,20 +417,20 @@ class TrackBuffersManager final
|
|||
};
|
||||
|
||||
void CheckSequenceDiscontinuity(const media::TimeUnit& aPresentationTime)
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void ProcessFrames(TrackBuffer& aSamples, TrackData& aTrackData)
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
media::TimeInterval PresentationInterval(const TrackBuffer& aSamples) const
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
bool CheckNextInsertionIndex(TrackData& aTrackData,
|
||||
const media::TimeUnit& aSampleTime)
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void InsertFrames(TrackBuffer& aSamples,
|
||||
const media::TimeIntervals& aIntervals,
|
||||
TrackData& aTrackData) REQUIRES(mTaskQueueCapability);
|
||||
TrackData& aTrackData) MOZ_REQUIRES(mTaskQueueCapability);
|
||||
void UpdateHighestTimestamp(TrackData& aTrackData,
|
||||
const media::TimeUnit& aHighestTime)
|
||||
REQUIRES(mTaskQueueCapability);
|
||||
MOZ_REQUIRES(mTaskQueueCapability);
|
||||
// Remove all frames and their dependencies contained in aIntervals.
|
||||
// Return the index at which frames were first removed or 0 if no frames
|
||||
// removed.
|
||||
|
@ -507,15 +508,15 @@ class TrackBuffersManager final
|
|||
void ProcessTasks();
|
||||
// Set if the TrackBuffersManager is currently processing a task.
|
||||
// At this stage, this task is always a AppendBufferTask.
|
||||
RefPtr<SourceBufferTask> mCurrentTask GUARDED_BY(mTaskQueueCapability);
|
||||
RefPtr<SourceBufferTask> mCurrentTask MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
// Current SourceBuffer state for ongoing task.
|
||||
// Its content is returned to the SourceBuffer once the AppendBufferTask has
|
||||
// completed.
|
||||
UniquePtr<SourceBufferAttributes> mSourceBufferAttributes
|
||||
GUARDED_BY(mTaskQueueCapability);
|
||||
MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
// The current sourcebuffer append window. It's content is equivalent to
|
||||
// mSourceBufferAttributes.mAppendWindowStart/End
|
||||
media::TimeInterval mAppendWindow GUARDED_BY(mTaskQueueCapability);
|
||||
media::TimeInterval mAppendWindow MOZ_GUARDED_BY(mTaskQueueCapability);
|
||||
|
||||
// Strong references to external objects.
|
||||
nsMainThreadPtrHandle<MediaSourceDecoder> mParentDecoder;
|
||||
|
|
|
@ -29,7 +29,7 @@ class FFmpegAudioDecoder<LIBAV_VER>
|
|||
virtual ~FFmpegAudioDecoder();
|
||||
|
||||
RefPtr<InitPromise> Init() override;
|
||||
void InitCodecContext() REQUIRES(sMutex) override;
|
||||
void InitCodecContext() MOZ_REQUIRES(sMutex) override;
|
||||
static AVCodecID GetCodecId(const nsACString& aMimeType);
|
||||
nsCString GetDescriptionName() const override {
|
||||
return "ffmpeg audio decoder"_ns;
|
||||
|
|
|
@ -48,7 +48,7 @@ class FFmpegDataDecoder<LIBAV_VER>
|
|||
// Flush and Drain operation, always run
|
||||
virtual RefPtr<FlushPromise> ProcessFlush();
|
||||
virtual void ProcessShutdown();
|
||||
virtual void InitCodecContext() REQUIRES(sMutex) {}
|
||||
virtual void InitCodecContext() MOZ_REQUIRES(sMutex) {}
|
||||
AVFrame* PrepareFrame();
|
||||
MediaResult InitDecoder();
|
||||
MediaResult AllocateExtraData();
|
||||
|
|
|
@ -53,7 +53,7 @@ class FFmpegVideoDecoder<LIBAV_VER>
|
|||
~FFmpegVideoDecoder();
|
||||
|
||||
RefPtr<InitPromise> Init() override;
|
||||
void InitCodecContext() REQUIRES(sMutex) override;
|
||||
void InitCodecContext() MOZ_REQUIRES(sMutex) override;
|
||||
nsCString GetDescriptionName() const override {
|
||||
#ifdef USING_MOZFFVPX
|
||||
return "ffvpx video decoder"_ns;
|
||||
|
|
|
@ -392,9 +392,9 @@ class OriginKeyStore {
|
|||
}
|
||||
|
||||
// Only accessed on StreamTS threads
|
||||
OriginKeysLoader mOriginKeys GUARDED_BY(sOriginKeyStoreStsMutex);
|
||||
OriginKeysLoader mOriginKeys MOZ_GUARDED_BY(sOriginKeyStoreStsMutex);
|
||||
OriginKeysTable mPrivateBrowsingOriginKeys
|
||||
GUARDED_BY(sOriginKeyStoreStsMutex);
|
||||
MOZ_GUARDED_BY(sOriginKeyStoreStsMutex);
|
||||
};
|
||||
OriginKeyStore* OriginKeyStore::sOriginKeyStore = nullptr;
|
||||
|
||||
|
|
|
@ -69,15 +69,15 @@ class PlatformUIThread : public PlatformThread {
|
|||
// Initialize the UI thread that is servicing the timer events
|
||||
bool InternalInit();
|
||||
|
||||
HWND hwnd_ GUARDED_BY(cs_) = nullptr;
|
||||
UINT_PTR timerid_ GUARDED_BY(cs_) = 0;
|
||||
unsigned int timeout_ GUARDED_BY(cs_) = 0;
|
||||
HWND hwnd_ MOZ_GUARDED_BY(cs_) = nullptr;
|
||||
UINT_PTR timerid_ MOZ_GUARDED_BY(cs_) = 0;
|
||||
unsigned int timeout_ MOZ_GUARDED_BY(cs_) = 0;
|
||||
enum class State {
|
||||
UNSTARTED,
|
||||
STARTED,
|
||||
STOPPED,
|
||||
};
|
||||
State state_ GUARDED_BY(cs_) = State::UNSTARTED;
|
||||
State state_ MOZ_GUARDED_BY(cs_) = State::UNSTARTED;
|
||||
};
|
||||
|
||||
} // namespace rtc
|
||||
|
|
|
@ -32,7 +32,7 @@ class SharedBuffers final {
|
|||
explicit OutputQueue(const char* aName) : mMutex(aName) {}
|
||||
|
||||
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
REQUIRES(mMutex) {
|
||||
MOZ_REQUIRES(mMutex) {
|
||||
mMutex.AssertCurrentThreadOwns();
|
||||
|
||||
size_t amount = 0;
|
||||
|
@ -43,18 +43,18 @@ class SharedBuffers final {
|
|||
return amount;
|
||||
}
|
||||
|
||||
Mutex& Lock() const RETURN_CAPABILITY(mMutex) {
|
||||
Mutex& Lock() const MOZ_RETURN_CAPABILITY(mMutex) {
|
||||
return const_cast<OutputQueue*>(this)->mMutex;
|
||||
}
|
||||
|
||||
size_t ReadyToConsume() const REQUIRES(mMutex) {
|
||||
size_t ReadyToConsume() const MOZ_REQUIRES(mMutex) {
|
||||
// Accessed on both main thread and media graph thread.
|
||||
mMutex.AssertCurrentThreadOwns();
|
||||
return mBufferList.size();
|
||||
}
|
||||
|
||||
// Produce one buffer
|
||||
AudioChunk& Produce() REQUIRES(mMutex) {
|
||||
AudioChunk& Produce() MOZ_REQUIRES(mMutex) {
|
||||
mMutex.AssertCurrentThreadOwns();
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mBufferList.push_back(AudioChunk());
|
||||
|
@ -62,7 +62,7 @@ class SharedBuffers final {
|
|||
}
|
||||
|
||||
// Consumes one buffer.
|
||||
AudioChunk Consume() REQUIRES(mMutex) {
|
||||
AudioChunk Consume() MOZ_REQUIRES(mMutex) {
|
||||
mMutex.AssertCurrentThreadOwns();
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(ReadyToConsume() > 0);
|
||||
|
@ -72,7 +72,7 @@ class SharedBuffers final {
|
|||
}
|
||||
|
||||
// Empties the buffer queue.
|
||||
void Clear() REQUIRES(mMutex) {
|
||||
void Clear() MOZ_REQUIRES(mMutex) {
|
||||
mMutex.AssertCurrentThreadOwns();
|
||||
mBufferList.clear();
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ class HRTFDatabaseLoader {
|
|||
|
||||
// Holding a m_threadLock is required when accessing m_databaseLoaderThread.
|
||||
mozilla::Mutex m_threadLock;
|
||||
PRThread* m_databaseLoaderThread GUARDED_BY(m_threadLock);
|
||||
PRThread* m_databaseLoaderThread MOZ_GUARDED_BY(m_threadLock);
|
||||
|
||||
float m_databaseSampleRate;
|
||||
mozilla::Atomic<bool> m_databaseLoaded;
|
||||
|
|
|
@ -299,9 +299,9 @@ class WebMBufferedState final {
|
|||
|
||||
// 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 GUARDED_BY(mMutex);
|
||||
nsTArray<WebMTimeDataOffset> mTimeMapping MOZ_GUARDED_BY(mMutex);
|
||||
// The last complete block parsed. -1 if not set.
|
||||
int64_t mLastBlockOffset GUARDED_BY(mMutex);
|
||||
int64_t mLastBlockOffset MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// Sorted (by offset) live parser instances. Main thread only.
|
||||
nsTArray<WebMBufferedParser> mRangeParsers;
|
||||
|
|
|
@ -40,7 +40,7 @@ class PerformanceStorageWorker final : public PerformanceStorage {
|
|||
|
||||
// Protected by mutex.
|
||||
// Created and released on worker-thread. Used also on main-thread.
|
||||
RefPtr<WeakWorkerRef> mWorkerRef GUARDED_BY(mMutex);
|
||||
RefPtr<WeakWorkerRef> mWorkerRef MOZ_GUARDED_BY(mMutex);
|
||||
};
|
||||
|
||||
} // namespace mozilla::dom
|
||||
|
|
|
@ -146,7 +146,7 @@ class PromiseWorkerProxy : public PromiseNativeHandler,
|
|||
// Main thread callers must hold Lock() and check CleanUp() before calling
|
||||
// this. Worker thread callers, this will assert that the proxy has not been
|
||||
// cleaned up.
|
||||
WorkerPrivate* GetWorkerPrivate() const NO_THREAD_SAFETY_ANALYSIS;
|
||||
WorkerPrivate* GetWorkerPrivate() const MOZ_NO_THREAD_SAFETY_ANALYSIS;
|
||||
|
||||
// This should only be used within WorkerRunnable::WorkerRun() running on the
|
||||
// worker thread! Do not call this after calling CleanUp().
|
||||
|
@ -158,9 +158,9 @@ class PromiseWorkerProxy : public PromiseNativeHandler,
|
|||
// 2. WorkerPromise() will crash!
|
||||
void CleanUp();
|
||||
|
||||
Mutex& Lock() RETURN_CAPABILITY(mCleanUpLock) { return mCleanUpLock; }
|
||||
Mutex& Lock() MOZ_RETURN_CAPABILITY(mCleanUpLock) { return mCleanUpLock; }
|
||||
|
||||
bool CleanedUp() const REQUIRES(mCleanUpLock) {
|
||||
bool CleanedUp() const MOZ_REQUIRES(mCleanUpLock) {
|
||||
mCleanUpLock.AssertCurrentThreadOwns();
|
||||
return mCleanedUp;
|
||||
}
|
||||
|
@ -204,8 +204,8 @@ class PromiseWorkerProxy : public PromiseNativeHandler,
|
|||
// 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
|
||||
GUARDED_BY(mCleanUpLock); // To specify if the cleanUp() has been done.
|
||||
bool mCleanedUp MOZ_GUARDED_BY(
|
||||
mCleanUpLock); // To specify if the cleanUp() has been done.
|
||||
|
||||
const PromiseWorkerProxyStructuredCloneCallbacks* mCallbacks;
|
||||
|
||||
|
|
|
@ -879,12 +879,12 @@ nsresult ServiceWorkerRegistrar::ReadData() {
|
|||
// XXX NOTE: if we could be accessed multi-threaded here, we would need to
|
||||
// find a way to lock around access to mData. Since we can't, suppress the
|
||||
// thread-safety warnings.
|
||||
PUSH_IGNORE_THREAD_SAFETY
|
||||
MOZ_PUSH_IGNORE_THREAD_SAFETY
|
||||
if (overwrite && NS_FAILED(WriteData(mData))) {
|
||||
NS_WARNING("Failed to write data for the ServiceWorker Registations.");
|
||||
DeleteData();
|
||||
}
|
||||
POP_THREAD_SAFETY
|
||||
MOZ_POP_THREAD_SAFETY
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class ServiceWorkerRegistrar : public nsIObserver,
|
|||
void DeleteData();
|
||||
|
||||
void RegisterServiceWorkerInternal(const ServiceWorkerRegistrationData& aData)
|
||||
REQUIRES(mMonitor);
|
||||
MOZ_REQUIRES(mMonitor);
|
||||
|
||||
ServiceWorkerRegistrar();
|
||||
virtual ~ServiceWorkerRegistrar();
|
||||
|
@ -100,11 +100,11 @@ class ServiceWorkerRegistrar : public nsIObserver,
|
|||
mozilla::Monitor mMonitor;
|
||||
|
||||
// protected by mMonitor.
|
||||
nsCOMPtr<nsIFile> mProfileDir GUARDED_BY(mMonitor);
|
||||
nsCOMPtr<nsIFile> mProfileDir MOZ_GUARDED_BY(mMonitor);
|
||||
// Read on mainthread, modified on background thread EXCEPT for
|
||||
// ReloadDataForTest() AND for gtest, which modifies this on MainThread.
|
||||
nsTArray<ServiceWorkerRegistrationData> mData GUARDED_BY(mMonitor);
|
||||
bool mDataLoaded GUARDED_BY(mMonitor);
|
||||
nsTArray<ServiceWorkerRegistrationData> mData MOZ_GUARDED_BY(mMonitor);
|
||||
bool mDataLoaded MOZ_GUARDED_BY(mMonitor);
|
||||
|
||||
// PBackground thread only
|
||||
uint32_t mDataGeneration;
|
||||
|
|
|
@ -37,7 +37,7 @@ class ServiceWorkerRegistrarTest : public ServiceWorkerRegistrar {
|
|||
}
|
||||
|
||||
nsresult TestReadData() { return ReadData(); }
|
||||
nsresult TestWriteData() NO_THREAD_SAFETY_ANALYSIS {
|
||||
nsresult TestWriteData() MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
return WriteData(mData);
|
||||
}
|
||||
void TestDeleteData() { DeleteData(); }
|
||||
|
|
|
@ -248,7 +248,7 @@ class WebSocketImpl final : public nsIInterfaceRequestor,
|
|||
|
||||
// This mutex protects mWorkerShuttingDown.
|
||||
mozilla::Mutex mMutex;
|
||||
bool mWorkerShuttingDown GUARDED_BY(mMutex);
|
||||
bool mWorkerShuttingDown MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
RefPtr<WebSocketEventService> mService;
|
||||
nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
|
||||
|
|
|
@ -181,7 +181,7 @@ class WebSocket final : public DOMEventTargetHelper {
|
|||
mozilla::Mutex mMutex;
|
||||
|
||||
// This value should not be used directly but use ReadyState() instead.
|
||||
uint16_t mReadyState GUARDED_BY(mMutex);
|
||||
uint16_t mReadyState MOZ_GUARDED_BY(mMutex);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -104,16 +104,17 @@ class JSExecutionManager {
|
|||
|
||||
// Workers waiting to be given permission for execution.
|
||||
// Guarded by mExecutionQueueMutex.
|
||||
std::deque<WorkerPrivate*> mExecutionQueue GUARDED_BY(mExecutionQueueMutex);
|
||||
std::deque<WorkerPrivate*> mExecutionQueue
|
||||
MOZ_GUARDED_BY(mExecutionQueueMutex);
|
||||
|
||||
// Number of threads currently executing concurrently for this manager.
|
||||
// Guarded by mExecutionQueueMutex.
|
||||
int32_t mRunning GUARDED_BY(mExecutionQueueMutex) = 0;
|
||||
int32_t mRunning MOZ_GUARDED_BY(mExecutionQueueMutex) = 0;
|
||||
|
||||
// Number of threads allowed to run concurrently for environments managed
|
||||
// by this manager.
|
||||
// Guarded by mExecutionQueueMutex.
|
||||
int32_t mMaxRunning GUARDED_BY(mExecutionQueueMutex) = 1;
|
||||
int32_t mMaxRunning MOZ_GUARDED_BY(mExecutionQueueMutex) = 1;
|
||||
|
||||
// Mutex that guards the execution queue and associated state.
|
||||
Mutex mExecutionQueueMutex =
|
||||
|
@ -130,7 +131,8 @@ class JSExecutionManager {
|
|||
// Whether the main thread is currently awaiting permission to execute. Main
|
||||
// thread execution is always prioritized.
|
||||
// Guarded by mExecutionQueueMutex.
|
||||
bool mMainThreadAwaitingExecution GUARDED_BY(mExecutionQueueMutex) = false;
|
||||
bool mMainThreadAwaitingExecution MOZ_GUARDED_BY(mExecutionQueueMutex) =
|
||||
false;
|
||||
};
|
||||
|
||||
// Helper for managing execution requests and allowing re-entrant permission
|
||||
|
|
|
@ -51,26 +51,26 @@ struct StorageWithTArray {
|
|||
static void Compact(StorageType& aStorage) { aStorage.Compact(); }
|
||||
};
|
||||
|
||||
class CAPABILITY LockingWithMutex {
|
||||
class MOZ_CAPABILITY LockingWithMutex {
|
||||
mozilla::Mutex mMutex;
|
||||
|
||||
protected:
|
||||
LockingWithMutex() : mMutex("LockingWithMutex::mMutex") {}
|
||||
|
||||
void Lock() CAPABILITY_ACQUIRE() { mMutex.Lock(); }
|
||||
void Lock() MOZ_CAPABILITY_ACQUIRE() { mMutex.Lock(); }
|
||||
|
||||
void Unlock() CAPABILITY_RELEASE() { mMutex.Unlock(); }
|
||||
void Unlock() MOZ_CAPABILITY_RELEASE() { mMutex.Unlock(); }
|
||||
|
||||
class SCOPED_CAPABILITY AutoLock {
|
||||
class MOZ_SCOPED_CAPABILITY AutoLock {
|
||||
LockingWithMutex& mHost;
|
||||
|
||||
public:
|
||||
explicit AutoLock(LockingWithMutex& aHost) CAPABILITY_ACQUIRE(aHost)
|
||||
explicit AutoLock(LockingWithMutex& aHost) MOZ_CAPABILITY_ACQUIRE(aHost)
|
||||
: mHost(aHost) {
|
||||
mHost.Lock();
|
||||
}
|
||||
|
||||
~AutoLock() CAPABILITY_RELEASE() { mHost.Unlock(); }
|
||||
~AutoLock() MOZ_CAPABILITY_RELEASE() { mHost.Unlock(); }
|
||||
};
|
||||
|
||||
friend class AutoLock;
|
||||
|
|
|
@ -57,7 +57,7 @@ class RuntimeService final : public nsIObserver {
|
|||
|
||||
// Protected by mMutex.
|
||||
nsClassHashtable<nsCStringHashKey, WorkerDomainInfo> mDomainMap
|
||||
GUARDED_BY(mMutex);
|
||||
MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// *Not* protected by mMutex.
|
||||
nsClassHashtable<nsPtrHashKey<const nsPIDOMWindowInner>,
|
||||
|
@ -181,7 +181,7 @@ class RuntimeService final : public nsIObserver {
|
|||
void Cleanup();
|
||||
|
||||
void AddAllTopLevelWorkersToArray(nsTArray<WorkerPrivate*>& aWorkers)
|
||||
REQUIRES(mMutex);
|
||||
MOZ_REQUIRES(mMutex);
|
||||
|
||||
nsTArray<WorkerPrivate*> GetWorkersForWindow(
|
||||
const nsPIDOMWindowInner& aWindow) const;
|
||||
|
|
|
@ -32,7 +32,7 @@ class WorkerCSPEventListener final : public nsICSPEventListener {
|
|||
Mutex mMutex;
|
||||
|
||||
// Protected by mutex.
|
||||
RefPtr<WeakWorkerRef> mWorkerRef GUARDED_BY(mMutex);
|
||||
RefPtr<WeakWorkerRef> mWorkerRef MOZ_GUARDED_BY(mMutex);
|
||||
};
|
||||
|
||||
} // namespace mozilla::dom
|
||||
|
|
|
@ -28,8 +28,8 @@ class WorkerEventTarget final : public nsISerialEventTarget {
|
|||
|
||||
private:
|
||||
mozilla::Mutex mMutex;
|
||||
CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate GUARDED_BY(mMutex);
|
||||
const Behavior mBehavior GUARDED_BY(mMutex);
|
||||
CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate MOZ_GUARDED_BY(mMutex);
|
||||
const Behavior mBehavior MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
~WorkerEventTarget() = default;
|
||||
|
||||
|
|
|
@ -663,7 +663,7 @@ class DebuggerImmediateRunnable : public WorkerRunnable {
|
|||
|
||||
// GetJSContext() is safe on the worker thread
|
||||
void PeriodicGCTimerCallback(nsITimer* aTimer,
|
||||
void* aClosure) NO_THREAD_SAFETY_ANALYSIS {
|
||||
void* aClosure) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
auto* workerPrivate = static_cast<WorkerPrivate*>(aClosure);
|
||||
MOZ_DIAGNOSTIC_ASSERT(workerPrivate);
|
||||
workerPrivate->AssertIsOnWorkerThread();
|
||||
|
@ -673,7 +673,7 @@ void PeriodicGCTimerCallback(nsITimer* aTimer,
|
|||
}
|
||||
|
||||
void IdleGCTimerCallback(nsITimer* aTimer,
|
||||
void* aClosure) NO_THREAD_SAFETY_ANALYSIS {
|
||||
void* aClosure) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
auto* workerPrivate = static_cast<WorkerPrivate*>(aClosure);
|
||||
MOZ_DIAGNOSTIC_ASSERT(workerPrivate);
|
||||
workerPrivate->AssertIsOnWorkerThread();
|
||||
|
@ -943,7 +943,7 @@ 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;
|
||||
WorkerPrivate* mWorkerPrivate GUARDED_BY(mMutex);
|
||||
WorkerPrivate* mWorkerPrivate MOZ_GUARDED_BY(mMutex);
|
||||
nsIEventTarget* mWeakNestedEventTarget;
|
||||
nsCOMPtr<nsIEventTarget> mNestedEventTarget;
|
||||
|
||||
|
@ -3695,7 +3695,7 @@ void WorkerPrivate::ScheduleDeletion(WorkerRanOrNot aRanOrNot) {
|
|||
}
|
||||
|
||||
bool WorkerPrivate::CollectRuntimeStats(
|
||||
JS::RuntimeStats* aRtStats, bool aAnonymize) NO_THREAD_SAFETY_ANALYSIS {
|
||||
JS::RuntimeStats* aRtStats, bool aAnonymize) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
// We don't have a lock to access mJSContext, but it's safe to access on this
|
||||
// thread.
|
||||
AssertIsOnWorkerThread();
|
||||
|
|
|
@ -85,10 +85,10 @@ class WorkerThread;
|
|||
// SharedMutex is a small wrapper around an (internal) reference-counted Mutex
|
||||
// object. It exists to avoid changing a lot of code to use Mutex* instead of
|
||||
// Mutex&.
|
||||
class CAPABILITY SharedMutex {
|
||||
class MOZ_CAPABILITY SharedMutex {
|
||||
using Mutex = mozilla::Mutex;
|
||||
|
||||
class CAPABILITY RefCountedMutex final : public Mutex {
|
||||
class MOZ_CAPABILITY RefCountedMutex final : public Mutex {
|
||||
public:
|
||||
explicit RefCountedMutex(const char* aName) : Mutex(aName) {}
|
||||
|
||||
|
@ -106,17 +106,17 @@ class CAPABILITY SharedMutex {
|
|||
|
||||
SharedMutex(const SharedMutex& aOther) = default;
|
||||
|
||||
operator Mutex&() RETURN_CAPABILITY(this) { return *mMutex; }
|
||||
operator Mutex&() MOZ_RETURN_CAPABILITY(this) { return *mMutex; }
|
||||
|
||||
operator const Mutex&() const RETURN_CAPABILITY(this) { return *mMutex; }
|
||||
operator const Mutex&() const MOZ_RETURN_CAPABILITY(this) { return *mMutex; }
|
||||
|
||||
// We need these to make thread-safety analysis work
|
||||
void Lock() CAPABILITY_ACQUIRE() { mMutex->Lock(); }
|
||||
void Unlock() CAPABILITY_RELEASE() { mMutex->Unlock(); }
|
||||
void Lock() MOZ_CAPABILITY_ACQUIRE() { mMutex->Lock(); }
|
||||
void Unlock() MOZ_CAPABILITY_RELEASE() { mMutex->Unlock(); }
|
||||
|
||||
// We can assert we own 'this', but we can't assert we hold mMutex
|
||||
void AssertCurrentThreadOwns() const
|
||||
ASSERT_CAPABILITY(this) NO_THREAD_SAFETY_ANALYSIS {
|
||||
MOZ_ASSERT_CAPABILITY(this) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
mMutex->AssertCurrentThreadOwns();
|
||||
}
|
||||
};
|
||||
|
@ -173,14 +173,14 @@ class WorkerPrivate final
|
|||
|
||||
bool Cancel() { return Notify(Canceling); }
|
||||
|
||||
bool Close() REQUIRES(mMutex);
|
||||
bool Close() MOZ_REQUIRES(mMutex);
|
||||
|
||||
// The passed principal must be the Worker principal in case of a
|
||||
// ServiceWorker and the loading principal for any other type.
|
||||
static void OverrideLoadInfoLoadGroup(WorkerLoadInfo& aLoadInfo,
|
||||
nsIPrincipal* aPrincipal);
|
||||
|
||||
bool IsDebuggerRegistered() NO_THREAD_SAFETY_ANALYSIS {
|
||||
bool IsDebuggerRegistered() MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
AssertIsOnMainThread();
|
||||
|
||||
// No need to lock here since this is only ever modified by the same thread.
|
||||
|
@ -369,7 +369,7 @@ class WorkerPrivate final
|
|||
return mFetchHandlerWasAdded;
|
||||
}
|
||||
|
||||
JSContext* GetJSContext() const NO_THREAD_SAFETY_ANALYSIS {
|
||||
JSContext* GetJSContext() const MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
// mJSContext is only modified on the worker thread, so workerthread code
|
||||
// can safely read it without a lock
|
||||
AssertIsOnWorkerThread();
|
||||
|
@ -547,7 +547,7 @@ class WorkerPrivate final
|
|||
return mParentStatus;
|
||||
}
|
||||
|
||||
WorkerStatus ParentStatus() const REQUIRES(mMutex) {
|
||||
WorkerStatus ParentStatus() const MOZ_REQUIRES(mMutex) {
|
||||
mMutex.AssertCurrentThreadOwns();
|
||||
return mParentStatus;
|
||||
}
|
||||
|
@ -1115,13 +1115,13 @@ class WorkerPrivate final
|
|||
}
|
||||
|
||||
ProcessAllControlRunnablesResult ProcessAllControlRunnablesLocked()
|
||||
REQUIRES(mMutex);
|
||||
MOZ_REQUIRES(mMutex);
|
||||
|
||||
void EnableMemoryReporter();
|
||||
|
||||
void DisableMemoryReporter();
|
||||
|
||||
void WaitForWorkerEvents() REQUIRES(mMutex);
|
||||
void WaitForWorkerEvents() MOZ_REQUIRES(mMutex);
|
||||
|
||||
// If the worker shutdown status is equal or greater then aFailStatus, this
|
||||
// operation will fail and nullptr will be returned. See WorkerStatus.h for
|
||||
|
@ -1158,7 +1158,8 @@ class WorkerPrivate final
|
|||
// to allow runnables to be atomically dispatched in bulk.
|
||||
nsresult DispatchLockHeld(already_AddRefed<WorkerRunnable> aRunnable,
|
||||
nsIEventTarget* aSyncLoopTarget,
|
||||
const MutexAutoLock& aProofOfLock) REQUIRES(mMutex);
|
||||
const MutexAutoLock& aProofOfLock)
|
||||
MOZ_REQUIRES(mMutex);
|
||||
|
||||
// This method dispatches a simple runnable that starts the shutdown procedure
|
||||
// after a self.close(). This method is called after a ClearMainEventQueue()
|
||||
|
@ -1197,7 +1198,7 @@ class WorkerPrivate final
|
|||
friend class mozilla::dom::WorkerThread;
|
||||
|
||||
SharedMutex mMutex;
|
||||
mozilla::CondVar mCondVar GUARDED_BY(mMutex);
|
||||
mozilla::CondVar mCondVar MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// We cannot make this CheckedUnsafePtr<WorkerPrivate> as this would violate
|
||||
// our static assert
|
||||
|
@ -1231,7 +1232,7 @@ class WorkerPrivate final
|
|||
LocationInfo mLocationInfo;
|
||||
|
||||
// Protected by mMutex.
|
||||
workerinternals::JSSettings mJSSettings GUARDED_BY(mMutex);
|
||||
workerinternals::JSSettings mJSSettings MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
WorkerDebugger* mDebugger;
|
||||
|
||||
|
@ -1240,9 +1241,9 @@ class WorkerPrivate final
|
|||
|
||||
// Touched on multiple threads, protected with mMutex. Only modified on the
|
||||
// worker thread
|
||||
JSContext* mJSContext GUARDED_BY(mMutex);
|
||||
JSContext* mJSContext MOZ_GUARDED_BY(mMutex);
|
||||
// mThread is only modified on the Worker thread, before calling DoRunLoop
|
||||
RefPtr<WorkerThread> mThread GUARDED_BY(mMutex);
|
||||
RefPtr<WorkerThread> mThread MOZ_GUARDED_BY(mMutex);
|
||||
// mPRThread is only modified on another thread in ScheduleWorker(), and is
|
||||
// constant for the duration of DoRunLoop. Static mutex analysis doesn't help
|
||||
// here
|
||||
|
@ -1286,7 +1287,7 @@ class WorkerPrivate final
|
|||
RefPtr<WorkerCSPEventListener> mCSPEventListener;
|
||||
|
||||
// Protected by mMutex.
|
||||
nsTArray<RefPtr<WorkerRunnable>> mPreStartRunnables GUARDED_BY(mMutex);
|
||||
nsTArray<RefPtr<WorkerRunnable>> mPreStartRunnables MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// Only touched on the parent thread. This is set only if IsSharedWorker().
|
||||
RefPtr<RemoteWorkerChild> mRemoteWorkerController;
|
||||
|
@ -1296,8 +1297,8 @@ class WorkerPrivate final
|
|||
|
||||
JS::UniqueChars mDefaultLocale; // nulled during worker JSContext init
|
||||
TimeStamp mKillTime;
|
||||
WorkerStatus mParentStatus GUARDED_BY(mMutex);
|
||||
WorkerStatus mStatus GUARDED_BY(mMutex);
|
||||
WorkerStatus mParentStatus MOZ_GUARDED_BY(mMutex);
|
||||
WorkerStatus mStatus MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// This is touched on parent thread only, but it can be read on a different
|
||||
// thread before crashing because hanging.
|
||||
|
@ -1430,7 +1431,7 @@ class WorkerPrivate final
|
|||
// use our global object's secure state there.
|
||||
const bool mIsSecureContext;
|
||||
|
||||
bool mDebuggerRegistered GUARDED_BY(mMutex);
|
||||
bool mDebuggerRegistered MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// During registration, this worker may be marked as not being ready to
|
||||
// execute debuggee runnables or content.
|
||||
|
|
|
@ -117,7 +117,7 @@ class ArrayBufferBuilder {
|
|||
ArrayBufferBuilder& operator=(const ArrayBufferBuilder&&) = delete;
|
||||
|
||||
bool SetCapacityInternal(uint32_t aNewCap, const MutexAutoLock& aProofOfLock)
|
||||
REQUIRES(mMutex);
|
||||
MOZ_REQUIRES(mMutex);
|
||||
|
||||
static bool AreOverlappingRegions(const uint8_t* aStart1, uint32_t aLength1,
|
||||
const uint8_t* aStart2, uint32_t aLength2);
|
||||
|
@ -125,10 +125,10 @@ class ArrayBufferBuilder {
|
|||
Mutex mMutex;
|
||||
|
||||
// All of these are protected by mMutex.
|
||||
uint8_t* mDataPtr GUARDED_BY(mMutex);
|
||||
uint32_t mCapacity GUARDED_BY(mMutex);
|
||||
uint32_t mLength GUARDED_BY(mMutex);
|
||||
void* mMapPtr GUARDED_BY(mMutex);
|
||||
uint8_t* mDataPtr MOZ_GUARDED_BY(mMutex);
|
||||
uint32_t mCapacity MOZ_GUARDED_BY(mMutex);
|
||||
uint32_t mLength MOZ_GUARDED_BY(mMutex);
|
||||
void* mMapPtr MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// This is used in assertions only.
|
||||
bool mNeutered;
|
||||
|
|
|
@ -25,12 +25,12 @@ class XMLHttpRequestStringBuffer final {
|
|||
return mData.Length();
|
||||
}
|
||||
|
||||
uint32_t UnsafeLength() const NO_THREAD_SAFETY_ANALYSIS {
|
||||
uint32_t UnsafeLength() const MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
return mData.Length();
|
||||
}
|
||||
|
||||
mozilla::Result<mozilla::BulkWriteHandle<char16_t>, nsresult> UnsafeBulkWrite(
|
||||
uint32_t aCapacity) NO_THREAD_SAFETY_ANALYSIS {
|
||||
uint32_t aCapacity) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
return mData.BulkWrite(aCapacity, UnsafeLength(), false);
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ class XMLHttpRequestStringBuffer final {
|
|||
Mutex mMutex;
|
||||
|
||||
// The following member variable is protected by mutex.
|
||||
nsString mData GUARDED_BY(mMutex);
|
||||
nsString mData MOZ_GUARDED_BY(mMutex);
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
@ -1092,11 +1092,11 @@ class SharedFTFace : public external::AtomicRefCounted<SharedFTFace> {
|
|||
* If no owner is given, then the user should avoid modifying any state on
|
||||
* the face so as not to invalidate the prior owner's modification.
|
||||
*/
|
||||
bool Lock(const void* aOwner = nullptr) CAPABILITY_ACQUIRE(mLock) {
|
||||
bool Lock(const void* aOwner = nullptr) MOZ_CAPABILITY_ACQUIRE(mLock) {
|
||||
mLock.Lock();
|
||||
return !aOwner || mLastLockOwner.exchange(aOwner) == aOwner;
|
||||
}
|
||||
void Unlock() CAPABILITY_RELEASE(mLock) { mLock.Unlock(); }
|
||||
void Unlock() MOZ_CAPABILITY_RELEASE(mLock) { mLock.Unlock(); }
|
||||
|
||||
/** Should be called when a lock owner is destroyed so that we don't have
|
||||
* a dangling pointer to a destroyed owner.
|
||||
|
|
|
@ -172,11 +172,11 @@ void mozilla_ForgetSharedFTFaceLockOwner(void* aContext, void* aOwner) {
|
|||
}
|
||||
|
||||
int mozilla_LockSharedFTFace(void* aContext,
|
||||
void* aOwner) NO_THREAD_SAFETY_ANALYSIS {
|
||||
void* aOwner) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
return int(static_cast<mozilla::gfx::SharedFTFace*>(aContext)->Lock(aOwner));
|
||||
}
|
||||
|
||||
void mozilla_UnlockSharedFTFace(void* aContext) NO_THREAD_SAFETY_ANALYSIS {
|
||||
void mozilla_UnlockSharedFTFace(void* aContext) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
static_cast<mozilla::gfx::SharedFTFace*>(aContext)->Unlock();
|
||||
}
|
||||
|
||||
|
@ -624,12 +624,12 @@ void Factory::ReleaseFTLibrary(FT_Library aFTLibrary) {
|
|||
}
|
||||
|
||||
void Factory::LockFTLibrary(FT_Library aFTLibrary)
|
||||
CAPABILITY_ACQUIRE(mFTLock) NO_THREAD_SAFETY_ANALYSIS {
|
||||
MOZ_CAPABILITY_ACQUIRE(mFTLock) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
mFTLock.Lock();
|
||||
}
|
||||
|
||||
void Factory::UnlockFTLibrary(FT_Library aFTLibrary)
|
||||
CAPABILITY_RELEASE(mFTLock) NO_THREAD_SAFETY_ANALYSIS {
|
||||
MOZ_CAPABILITY_RELEASE(mFTLock) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
mFTLock.Unlock();
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ uint8_t* SourceSurfaceSkia::GetData() {
|
|||
}
|
||||
|
||||
bool SourceSurfaceSkia::Map(MapType, MappedSurface* aMappedSurface)
|
||||
NO_THREAD_SAFETY_ANALYSIS {
|
||||
MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
mChangeMutex.Lock();
|
||||
aMappedSurface->mData = GetData();
|
||||
aMappedSurface->mStride = Stride();
|
||||
|
@ -169,12 +169,12 @@ bool SourceSurfaceSkia::Map(MapType, MappedSurface* aMappedSurface)
|
|||
mChangeMutex.Unlock();
|
||||
}
|
||||
// Static analysis will warn due to a conditional Unlock
|
||||
PUSH_IGNORE_THREAD_SAFETY
|
||||
MOZ_PUSH_IGNORE_THREAD_SAFETY
|
||||
return isMapped;
|
||||
POP_THREAD_SAFETY
|
||||
MOZ_POP_THREAD_SAFETY
|
||||
}
|
||||
|
||||
void SourceSurfaceSkia::Unmap() NO_THREAD_SAFETY_ANALYSIS {
|
||||
void SourceSurfaceSkia::Unmap() MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
mChangeMutex.AssertCurrentThreadOwns();
|
||||
MOZ_ASSERT(mIsMapped);
|
||||
mIsMapped = false;
|
||||
|
|
|
@ -140,7 +140,7 @@ class GLLibraryEGL final {
|
|||
~GLLibraryEGL() = default;
|
||||
|
||||
static StaticMutex sMutex;
|
||||
static StaticRefPtr<GLLibraryEGL> sInstance GUARDED_BY(sMutex);
|
||||
static StaticRefPtr<GLLibraryEGL> sInstance MOZ_GUARDED_BY(sMutex);
|
||||
|
||||
bool Init(nsACString* const out_failureId);
|
||||
void InitLibExtensions();
|
||||
|
|
|
@ -3665,7 +3665,7 @@ void APZCTreeManager::AssertOnUpdaterThread() {
|
|||
GetUpdater()->AssertOnUpdaterThread();
|
||||
}
|
||||
|
||||
PUSH_IGNORE_THREAD_SAFETY
|
||||
MOZ_PUSH_IGNORE_THREAD_SAFETY
|
||||
void APZCTreeManager::LockTree() {
|
||||
AssertOnUpdaterThread();
|
||||
mTreeLock.Lock();
|
||||
|
@ -3675,7 +3675,7 @@ void APZCTreeManager::UnlockTree() {
|
|||
AssertOnUpdaterThread();
|
||||
mTreeLock.Unlock();
|
||||
}
|
||||
POP_THREAD_SAFETY
|
||||
MOZ_POP_THREAD_SAFETY
|
||||
|
||||
void APZCTreeManager::SetDPI(float aDpiValue) {
|
||||
if (!APZThreadUtils::IsControllerThread()) {
|
||||
|
|
|
@ -507,8 +507,8 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
|
|||
// functions to the world.
|
||||
private:
|
||||
friend class APZUpdater;
|
||||
void LockTree() CAPABILITY_ACQUIRE(mTreeLock);
|
||||
void UnlockTree() CAPABILITY_RELEASE(mTreeLock);
|
||||
void LockTree() MOZ_CAPABILITY_ACQUIRE(mTreeLock);
|
||||
void UnlockTree() MOZ_CAPABILITY_RELEASE(mTreeLock);
|
||||
|
||||
// Protected hooks for gtests subclass
|
||||
virtual AsyncPanZoomController* NewAPZCInstance(
|
||||
|
@ -591,7 +591,8 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
|
|||
/* Helpers */
|
||||
|
||||
void AttachNodeToTree(HitTestingTreeNode* aNode, HitTestingTreeNode* aParent,
|
||||
HitTestingTreeNode* aNextSibling) REQUIRES(mTreeLock);
|
||||
HitTestingTreeNode* aNextSibling)
|
||||
MOZ_REQUIRES(mTreeLock);
|
||||
already_AddRefed<AsyncPanZoomController> GetTargetAPZC(
|
||||
const ScrollableLayerGuid& aGuid);
|
||||
already_AddRefed<HitTestingTreeNode> GetTargetNode(
|
||||
|
@ -730,7 +731,7 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
|
|||
// the coordinates of |aNode|'s parent in the hit-testing tree.
|
||||
// Requires the caller to hold mTreeLock.
|
||||
LayerToParentLayerMatrix4x4 ComputeTransformForNode(
|
||||
const HitTestingTreeNode* aNode) const REQUIRES(mTreeLock);
|
||||
const HitTestingTreeNode* aNode) const MOZ_REQUIRES(mTreeLock);
|
||||
|
||||
// Look up the GeckoContentController for the given layers id.
|
||||
static already_AddRefed<GeckoContentController> GetContentController(
|
||||
|
@ -787,7 +788,7 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
|
|||
* management state.
|
||||
* IMPORTANT: See the note about lock ordering at the top of this file. */
|
||||
mutable mozilla::RecursiveMutex mTreeLock;
|
||||
RefPtr<HitTestingTreeNode> mRootNode GUARDED_BY(mTreeLock);
|
||||
RefPtr<HitTestingTreeNode> mRootNode MOZ_GUARDED_BY(mTreeLock);
|
||||
|
||||
/*
|
||||
* A set of LayersIds for which APZCTM should only send empty
|
||||
|
@ -799,7 +800,7 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
|
|||
* Acquire mTreeLock before accessing this.
|
||||
*/
|
||||
std::unordered_set<LayersId, LayersId::HashFn> mDetachedLayersIds
|
||||
GUARDED_BY(mTreeLock);
|
||||
MOZ_GUARDED_BY(mTreeLock);
|
||||
|
||||
/* 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.
|
||||
|
|
|
@ -73,7 +73,7 @@ void APZUpdater::SetUpdaterThread(const wr::WrWindowId& aWindowId) {
|
|||
// Takes a conditional lock!
|
||||
/*static*/
|
||||
void APZUpdater::PrepareForSceneSwap(const wr::WrWindowId& aWindowId)
|
||||
NO_THREAD_SAFETY_ANALYSIS {
|
||||
MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
if (RefPtr<APZUpdater> updater = GetUpdater(aWindowId)) {
|
||||
updater->mApz->LockTree();
|
||||
}
|
||||
|
|
|
@ -272,7 +272,7 @@ class CanvasTranslator final : public gfx::InlineTranslator,
|
|||
UniquePtr<gfx::DataSourceSurface::ScopedMap> mPreparedMap;
|
||||
typedef std::unordered_map<int64_t, UniquePtr<SurfaceDescriptor>>
|
||||
DescriptorMap;
|
||||
DescriptorMap mSurfaceDescriptors GUARDED_BY(mSurfaceDescriptorsMonitor);
|
||||
DescriptorMap mSurfaceDescriptors MOZ_GUARDED_BY(mSurfaceDescriptorsMonitor);
|
||||
Monitor mSurfaceDescriptorsMonitor{
|
||||
"CanvasTranslator::mSurfaceDescriptorsMonitor"};
|
||||
Atomic<bool> mDeactivated{false};
|
||||
|
|
|
@ -64,7 +64,7 @@ class gfxDWriteFontFamily final : public gfxFontFamily {
|
|||
virtual ~gfxDWriteFontFamily();
|
||||
|
||||
void FindStyleVariationsLocked(FontInfoData* aFontInfoData = nullptr)
|
||||
REQUIRES(mLock) final;
|
||||
MOZ_REQUIRES(mLock) final;
|
||||
|
||||
void LocalizedName(nsACString& aLocalizedName) final;
|
||||
|
||||
|
@ -376,8 +376,8 @@ class gfxDWriteFontList final : public gfxPlatformFontList {
|
|||
}
|
||||
|
||||
// initialize font lists
|
||||
nsresult InitFontListForPlatform() REQUIRES(mLock) override;
|
||||
void InitSharedFontListForPlatform() REQUIRES(mLock) override;
|
||||
nsresult InitFontListForPlatform() MOZ_REQUIRES(mLock) override;
|
||||
void InitSharedFontListForPlatform() MOZ_REQUIRES(mLock) override;
|
||||
|
||||
FontVisibility GetVisibilityForFamily(const nsACString& aName) const;
|
||||
|
||||
|
@ -390,7 +390,7 @@ class gfxDWriteFontList final : public gfxPlatformFontList {
|
|||
|
||||
void ReadFaceNamesForFamily(mozilla::fontlist::Family* aFamily,
|
||||
bool aNeedFullnamePostscriptNames)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
bool ReadFaceNames(mozilla::fontlist::Family* aFamily,
|
||||
mozilla::fontlist::Face* aFace, nsCString& aPSName,
|
||||
|
@ -422,7 +422,7 @@ class gfxDWriteFontList final : public gfxPlatformFontList {
|
|||
const nsACString& aFamily, nsTArray<FamilyAndGeneric>* aOutput,
|
||||
FindFamiliesFlags aFlags, gfxFontStyle* aStyle = nullptr,
|
||||
nsAtom* aLanguage = nullptr, gfxFloat aDevToCssSize = 1.0)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
gfxFloat GetForceGDIClassicMaxFontSize() {
|
||||
return mForceGDIClassicMaxFontSize;
|
||||
|
@ -437,7 +437,7 @@ class gfxDWriteFontList final : public gfxPlatformFontList {
|
|||
FontFamily GetDefaultFontForPlatform(nsPresContext* aPresContext,
|
||||
const gfxFontStyle* aStyle,
|
||||
nsAtom* aLanguage = nullptr)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
// attempt to use platform-specific fallback for the given character,
|
||||
// return null if no usable result found
|
||||
|
@ -446,24 +446,25 @@ class gfxDWriteFontList final : public gfxPlatformFontList {
|
|||
Script aRunScript,
|
||||
const gfxFontStyle* aMatchStyle,
|
||||
FontFamily& aMatchedFamily)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
private:
|
||||
friend class gfxDWriteFontFamily;
|
||||
|
||||
nsresult GetFontSubstitutes() REQUIRES(mLock);
|
||||
nsresult GetFontSubstitutes() MOZ_REQUIRES(mLock);
|
||||
|
||||
void GetDirectWriteSubstitutes() REQUIRES(mLock);
|
||||
void GetDirectWriteSubstitutes() MOZ_REQUIRES(mLock);
|
||||
|
||||
virtual bool UsesSystemFallback() { return true; }
|
||||
|
||||
void GetFontsFromCollection(IDWriteFontCollection* aCollection)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
void AppendFamiliesFromCollection(
|
||||
IDWriteFontCollection* aCollection,
|
||||
nsTArray<mozilla::fontlist::Family::InitData>& aFamilies,
|
||||
const nsTArray<nsCString>* aForceClassicFams = nullptr) REQUIRES(mLock);
|
||||
const nsTArray<nsCString>* aForceClassicFams = nullptr)
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
#ifdef MOZ_BUNDLED_FONTS
|
||||
already_AddRefed<IDWriteFontCollection> CreateBundledFontsCollection(
|
||||
|
|
|
@ -43,7 +43,7 @@ gfxFT2FontBase::gfxFT2FontBase(
|
|||
gfxFT2FontBase::~gfxFT2FontBase() { mFTFace->ForgetLockOwner(this); }
|
||||
|
||||
FT_Face gfxFT2FontBase::LockFTFace() const
|
||||
CAPABILITY_ACQUIRE(mFTFace) NO_THREAD_SAFETY_ANALYSIS {
|
||||
MOZ_CAPABILITY_ACQUIRE(mFTFace) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
if (!mFTFace->Lock(this)) {
|
||||
FT_Set_Transform(mFTFace->GetFace(), nullptr, nullptr);
|
||||
|
||||
|
@ -54,7 +54,7 @@ FT_Face gfxFT2FontBase::LockFTFace() const
|
|||
}
|
||||
|
||||
void gfxFT2FontBase::UnlockFTFace() const
|
||||
CAPABILITY_RELEASE(mFTFace) NO_THREAD_SAFETY_ANALYSIS {
|
||||
MOZ_CAPABILITY_RELEASE(mFTFace) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
mFTFace->Unlock();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class gfxFT2FontEntryBase : public gfxFontEntry {
|
|||
uint32_t mGlyphIndex;
|
||||
};
|
||||
|
||||
mozilla::UniquePtr<CmapCacheSlot[]> mCmapCache GUARDED_BY(mLock);
|
||||
mozilla::UniquePtr<CmapCacheSlot[]> mCmapCache MOZ_GUARDED_BY(mLock);
|
||||
};
|
||||
|
||||
class gfxFT2FontBase : public gfxFont {
|
||||
|
@ -147,7 +147,7 @@ class gfxFT2FontBase : public gfxFont {
|
|||
uint16_t aGID, mozilla::gfx::IntRect* aBounds = nullptr) const;
|
||||
|
||||
mutable mozilla::UniquePtr<nsTHashMap<nsUint32HashKey, GlyphMetrics>>
|
||||
mGlyphMetrics GUARDED_BY(mLock);
|
||||
mGlyphMetrics MOZ_GUARDED_BY(mLock);
|
||||
};
|
||||
|
||||
// Helper classes used for clearing out user font data when FT font
|
||||
|
|
|
@ -174,26 +174,26 @@ class gfxFT2FontList final : public gfxPlatformFontList {
|
|||
typedef enum { kUnknown, kStandard } StandardFile;
|
||||
|
||||
// initialize font lists
|
||||
nsresult InitFontListForPlatform() REQUIRES(mLock) override;
|
||||
nsresult InitFontListForPlatform() MOZ_REQUIRES(mLock) override;
|
||||
|
||||
void AppendFaceFromFontListEntry(const FontListEntry& aFLE,
|
||||
StandardFile aStdFile) REQUIRES(mLock);
|
||||
StandardFile aStdFile) MOZ_REQUIRES(mLock);
|
||||
|
||||
void AppendFacesFromBlob(const nsCString& aFileName, StandardFile aStdFile,
|
||||
hb_blob_t* aBlob, FontNameCache* aCache,
|
||||
uint32_t aTimestamp, uint32_t aFilesize)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
void AppendFacesFromFontFile(const nsCString& aFileName,
|
||||
FontNameCache* aCache, StandardFile aStdFile)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
void AppendFacesFromOmnijarEntry(nsZipArchive* aReader,
|
||||
const nsCString& aEntryName,
|
||||
FontNameCache* aCache, bool aJarChanged)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
void InitSharedFontListForPlatform() REQUIRES(mLock) override;
|
||||
void InitSharedFontListForPlatform() MOZ_REQUIRES(mLock) override;
|
||||
void CollectInitData(const FontListEntry& aFLE, const nsCString& aPSName,
|
||||
const nsCString& aFullName, StandardFile aStdFile);
|
||||
|
||||
|
@ -217,23 +217,23 @@ class gfxFT2FontList final : public gfxPlatformFontList {
|
|||
bool AppendFacesFromCachedFaceList(CollectFunc aCollectFace,
|
||||
const nsCString& aFileName,
|
||||
const nsCString& aFaceList,
|
||||
StandardFile aStdFile) REQUIRES(mLock);
|
||||
StandardFile aStdFile) MOZ_REQUIRES(mLock);
|
||||
|
||||
void AddFaceToList(const nsCString& aEntryName, uint32_t aIndex,
|
||||
StandardFile aStdFile, hb_face_t* aFace,
|
||||
nsCString& aFaceList) REQUIRES(mLock);
|
||||
nsCString& aFaceList) MOZ_REQUIRES(mLock);
|
||||
|
||||
void FindFonts() REQUIRES(mLock);
|
||||
void FindFonts() MOZ_REQUIRES(mLock);
|
||||
|
||||
void FindFontsInOmnijar(FontNameCache* aCache) REQUIRES(mLock);
|
||||
void FindFontsInOmnijar(FontNameCache* aCache) MOZ_REQUIRES(mLock);
|
||||
|
||||
void FindFontsInDir(const nsCString& aDir, FontNameCache* aFNC)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
FontFamily GetDefaultFontForPlatform(nsPresContext* aPresContext,
|
||||
const gfxFontStyle* aStyle,
|
||||
nsAtom* aLanguage = nullptr)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
nsTHashSet<nsCString> mSkipSpaceLookupCheckFamilies;
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ class gfxFontconfigFontFamily final : public gfxFontFamily {
|
|||
void AddFacesToFontList(Func aAddPatternFunc);
|
||||
|
||||
void FindStyleVariationsLocked(FontInfoData* aFontInfoData = nullptr)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
// Families are constructed initially with just references to patterns.
|
||||
// When necessary, these are enumerated within FindStyleVariations.
|
||||
|
@ -245,8 +245,8 @@ class gfxFcPlatformFontList final : public gfxPlatformFontList {
|
|||
}
|
||||
|
||||
// initialize font lists
|
||||
nsresult InitFontListForPlatform() REQUIRES(mLock) override;
|
||||
void InitSharedFontListForPlatform() REQUIRES(mLock) override;
|
||||
nsresult InitFontListForPlatform() MOZ_REQUIRES(mLock) override;
|
||||
void InitSharedFontListForPlatform() MOZ_REQUIRES(mLock) override;
|
||||
|
||||
void GetFontList(nsAtom* aLangGroup, const nsACString& aGenericFamily,
|
||||
nsTArray<nsString>& aListOfFonts) override;
|
||||
|
@ -275,7 +275,7 @@ class gfxFcPlatformFontList final : public gfxPlatformFontList {
|
|||
const nsACString& aFamily, nsTArray<FamilyAndGeneric>* aOutput,
|
||||
FindFamiliesFlags aFlags, gfxFontStyle* aStyle = nullptr,
|
||||
nsAtom* aLanguage = nullptr, gfxFloat aDevToCssSize = 1.0)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
bool GetStandardFamilyName(const nsCString& aFontName,
|
||||
nsACString& aFamilyName) override;
|
||||
|
@ -287,14 +287,14 @@ class gfxFcPlatformFontList final : public gfxPlatformFontList {
|
|||
mozilla::StyleGenericFontFamily, nsAtom* aLanguage,
|
||||
nsTArray<FamilyAndGeneric>& aFamilyList) override;
|
||||
|
||||
void ClearLangGroupPrefFontsLocked() REQUIRES(mLock) override;
|
||||
void ClearLangGroupPrefFontsLocked() MOZ_REQUIRES(mLock) override;
|
||||
|
||||
// clear out cached generic-lang ==> family-list mappings
|
||||
void ClearGenericMappings() {
|
||||
AutoLock lock(mLock);
|
||||
ClearGenericMappingsLocked();
|
||||
}
|
||||
void ClearGenericMappingsLocked() REQUIRES(mLock) {
|
||||
void ClearGenericMappingsLocked() MOZ_REQUIRES(mLock) {
|
||||
mGenericMappings.Clear();
|
||||
}
|
||||
|
||||
|
@ -318,29 +318,29 @@ class gfxFcPlatformFontList final : public gfxPlatformFontList {
|
|||
// Add all the font families found in a font set.
|
||||
// aAppFonts indicates whether this is the system or application fontset.
|
||||
void AddFontSetFamilies(FcFontSet* aFontSet, const SandboxPolicy* aPolicy,
|
||||
bool aAppFonts) REQUIRES(mLock);
|
||||
bool aAppFonts) MOZ_REQUIRES(mLock);
|
||||
|
||||
// Helper for above, to add a single font pattern.
|
||||
void AddPatternToFontList(FcPattern* aFont, FcChar8*& aLastFamilyName,
|
||||
nsACString& aFamilyName,
|
||||
RefPtr<gfxFontconfigFontFamily>& aFontFamily,
|
||||
bool aAppFonts) REQUIRES(mLock);
|
||||
bool aAppFonts) MOZ_REQUIRES(mLock);
|
||||
|
||||
// figure out which families fontconfig maps a generic to
|
||||
// (aGeneric assumed already lowercase)
|
||||
PrefFontList* FindGenericFamilies(nsPresContext* aPresContext,
|
||||
const nsCString& aGeneric,
|
||||
nsAtom* aLanguage) REQUIRES(mLock);
|
||||
nsAtom* aLanguage) MOZ_REQUIRES(mLock);
|
||||
|
||||
// are all pref font settings set to use fontconfig generics?
|
||||
bool PrefFontListsUseOnlyGenerics() REQUIRES(mLock);
|
||||
bool PrefFontListsUseOnlyGenerics() MOZ_REQUIRES(mLock);
|
||||
|
||||
static void CheckFontUpdates(nsITimer* aTimer, void* aThis);
|
||||
|
||||
FontFamily GetDefaultFontForPlatform(nsPresContext* aPresContext,
|
||||
const gfxFontStyle* aStyle,
|
||||
nsAtom* aLanguage = nullptr)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
enum class DistroID : int8_t {
|
||||
Unknown = 0,
|
||||
|
|
|
@ -392,7 +392,7 @@ class gfxFontCache final
|
|||
// This gets called when the timeout has expired on a single-refcount
|
||||
// font; we just delete it.
|
||||
void NotifyExpiredLocked(gfxFont* aFont, const AutoLock&)
|
||||
REQUIRES(mMutex) override;
|
||||
MOZ_REQUIRES(mMutex) override;
|
||||
void NotifyHandlerEnd() override;
|
||||
|
||||
void DestroyDiscard(nsTArray<RefPtr<gfxFont>>& aDiscard);
|
||||
|
@ -440,13 +440,13 @@ class gfxFontCache final
|
|||
RefPtr<gfxFont> mFont;
|
||||
};
|
||||
|
||||
nsTHashtable<HashEntry> mFonts GUARDED_BY(mMutex);
|
||||
nsTHashtable<HashEntry> mFonts MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
nsTArray<RefPtr<gfxFont>> mTrackerDiscard GUARDED_BY(mMutex);
|
||||
nsTArray<RefPtr<gfxFont>> mTrackerDiscard MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
static void WordCacheExpirationTimerCallback(nsITimer* aTimer, void* aCache);
|
||||
|
||||
nsCOMPtr<nsITimer> mWordCacheExpirationTimer GUARDED_BY(mMutex);
|
||||
nsCOMPtr<nsITimer> mWordCacheExpirationTimer MOZ_GUARDED_BY(mMutex);
|
||||
std::atomic<bool> mTimerRunning = false;
|
||||
};
|
||||
|
||||
|
@ -1826,7 +1826,7 @@ class gfxFont {
|
|||
ClearCachedWordsLocked();
|
||||
}
|
||||
}
|
||||
void ClearCachedWordsLocked() REQUIRES(mLock) {
|
||||
void ClearCachedWordsLocked() MOZ_REQUIRES(mLock) {
|
||||
MOZ_ASSERT(mWordCache);
|
||||
mWordCache->Clear();
|
||||
}
|
||||
|
@ -2145,14 +2145,15 @@ class gfxFont {
|
|||
mozilla::UniquePtr<gfxShapedWord> mShapedWord;
|
||||
};
|
||||
|
||||
mozilla::UniquePtr<nsTHashtable<CacheHashEntry>> mWordCache GUARDED_BY(mLock);
|
||||
mozilla::UniquePtr<nsTHashtable<CacheHashEntry>> mWordCache
|
||||
MOZ_GUARDED_BY(mLock);
|
||||
|
||||
static const uint32_t kShapedWordCacheMaxAge = 3;
|
||||
|
||||
nsTArray<mozilla::UniquePtr<gfxGlyphExtents>> mGlyphExtentsArray
|
||||
GUARDED_BY(mLock);
|
||||
MOZ_GUARDED_BY(mLock);
|
||||
mozilla::UniquePtr<nsTHashSet<GlyphChangeObserver*>> mGlyphChangeObservers
|
||||
GUARDED_BY(mLock);
|
||||
MOZ_GUARDED_BY(mLock);
|
||||
|
||||
// a copy of the font without antialiasing, if needed for separate
|
||||
// measurement by mathml code
|
||||
|
|
|
@ -520,7 +520,7 @@ hb_blob_t* gfxFontEntry::FontTableHashEntry::GetBlob() const {
|
|||
bool gfxFontEntry::GetExistingFontTable(uint32_t aTag, hb_blob_t** aBlob) {
|
||||
// Accessing the mFontTableCache pointer is atomic, so we don't need to take
|
||||
// a write lock even if we're initializing it here...
|
||||
PUSH_IGNORE_THREAD_SAFETY
|
||||
MOZ_PUSH_IGNORE_THREAD_SAFETY
|
||||
if (MOZ_UNLIKELY(!mFontTableCache)) {
|
||||
// We do this here rather than on fontEntry construction
|
||||
// because not all shapers will access the table cache at all.
|
||||
|
@ -533,7 +533,7 @@ bool gfxFontEntry::GetExistingFontTable(uint32_t aTag, hb_blob_t** aBlob) {
|
|||
}
|
||||
}
|
||||
FontTableCache* cache = GetFontTableCache();
|
||||
POP_THREAD_SAFETY
|
||||
MOZ_POP_THREAD_SAFETY
|
||||
|
||||
// ...but we do need a lock to read the actual hashtable contents.
|
||||
AutoReadLock lock(mLock);
|
||||
|
@ -548,7 +548,7 @@ bool gfxFontEntry::GetExistingFontTable(uint32_t aTag, hb_blob_t** aBlob) {
|
|||
|
||||
hb_blob_t* gfxFontEntry::ShareFontTableAndGetBlob(uint32_t aTag,
|
||||
nsTArray<uint8_t>* aBuffer) {
|
||||
PUSH_IGNORE_THREAD_SAFETY
|
||||
MOZ_PUSH_IGNORE_THREAD_SAFETY
|
||||
if (MOZ_UNLIKELY(!mFontTableCache)) {
|
||||
auto* newCache = new FontTableCache(8);
|
||||
if (MOZ_UNLIKELY(!mFontTableCache.compareExchange(nullptr, newCache))) {
|
||||
|
@ -556,7 +556,7 @@ hb_blob_t* gfxFontEntry::ShareFontTableAndGetBlob(uint32_t aTag,
|
|||
}
|
||||
}
|
||||
FontTableCache* cache = GetFontTableCache();
|
||||
POP_THREAD_SAFETY
|
||||
MOZ_POP_THREAD_SAFETY
|
||||
|
||||
AutoWriteLock lock(mLock);
|
||||
FontTableHashEntry* entry = cache->PutEntry(aTag);
|
||||
|
|
|
@ -492,14 +492,14 @@ class gfxFontEntry {
|
|||
gfxSVGGlyphs* GetSVGGlyphs() const { return mSVGGlyphs; }
|
||||
|
||||
// list of gfxFonts that are using SVG glyphs
|
||||
nsTArray<const gfxFont*> mFontsUsingSVGGlyphs GUARDED_BY(mLock);
|
||||
nsTArray<const gfxFont*> mFontsUsingSVGGlyphs MOZ_GUARDED_BY(mLock);
|
||||
nsTArray<gfxFontFeature> mFeatureSettings;
|
||||
nsTArray<gfxFontVariation> mVariationSettings;
|
||||
|
||||
mozilla::UniquePtr<nsTHashMap<nsUint32HashKey, bool>> mSupportedFeatures
|
||||
GUARDED_BY(mFeatureInfoLock);
|
||||
MOZ_GUARDED_BY(mFeatureInfoLock);
|
||||
mozilla::UniquePtr<nsTHashMap<nsUint32HashKey, hb_set_t*>> mFeatureInputs
|
||||
GUARDED_BY(mFeatureInfoLock);
|
||||
MOZ_GUARDED_BY(mFeatureInfoLock);
|
||||
|
||||
// Color Layer font support. These tables are inert once loaded, so we don't
|
||||
// need to hold a lock when reading them.
|
||||
|
@ -615,7 +615,7 @@ class gfxFontEntry {
|
|||
// Helper for HasTrackingTable; check/parse the table and cache pointers
|
||||
// to the subtables we need. Returns false on failure, in which case the
|
||||
// table is unusable.
|
||||
bool ParseTrakTable() REQUIRES(mLock);
|
||||
bool ParseTrakTable() MOZ_REQUIRES(mLock);
|
||||
|
||||
// lookup the cmap in cached font data
|
||||
virtual already_AddRefed<gfxCharacterMap> GetCMAPFromFontInfo(
|
||||
|
@ -862,11 +862,12 @@ class gfxFontFamily {
|
|||
bool CheckForLegacyFamilyNames(gfxPlatformFontList* aFontList);
|
||||
|
||||
// Callers must hold a read-lock for as long as they're using the list.
|
||||
const nsTArray<RefPtr<gfxFontEntry>>& GetFontList() REQUIRES_SHARED(mLock) {
|
||||
const nsTArray<RefPtr<gfxFontEntry>>& GetFontList()
|
||||
MOZ_REQUIRES_SHARED(mLock) {
|
||||
return mAvailableFonts;
|
||||
}
|
||||
void ReadLock() ACQUIRE_SHARED(mLock) { mLock.ReadLock(); }
|
||||
void ReadUnlock() RELEASE_SHARED(mLock) { mLock.ReadUnlock(); }
|
||||
void ReadLock() MOZ_ACQUIRE_SHARED(mLock) { mLock.ReadLock(); }
|
||||
void ReadUnlock() MOZ_RELEASE_SHARED(mLock) { mLock.ReadUnlock(); }
|
||||
|
||||
uint32_t FontListLength() const {
|
||||
mozilla::AutoReadLock lock(mLock);
|
||||
|
@ -878,7 +879,7 @@ class gfxFontFamily {
|
|||
AddFontEntryLocked(aFontEntry);
|
||||
}
|
||||
|
||||
void AddFontEntryLocked(RefPtr<gfxFontEntry> aFontEntry) REQUIRES(mLock) {
|
||||
void AddFontEntryLocked(RefPtr<gfxFontEntry> aFontEntry) MOZ_REQUIRES(mLock) {
|
||||
// Avoid potentially duplicating entries.
|
||||
if (mAvailableFonts.Contains(aFontEntry)) {
|
||||
return;
|
||||
|
@ -951,7 +952,7 @@ class gfxFontFamily {
|
|||
// This is a no-op in cases where the family is explicitly populated by other
|
||||
// means, rather than being asked to find its faces via system API.
|
||||
virtual void FindStyleVariationsLocked(FontInfoData* aFontInfoData = nullptr)
|
||||
REQUIRES(mLock){};
|
||||
MOZ_REQUIRES(mLock){};
|
||||
void FindStyleVariations(FontInfoData* aFontInfoData = nullptr) {
|
||||
if (mHasStyles) {
|
||||
return;
|
||||
|
@ -977,7 +978,7 @@ class gfxFontFamily {
|
|||
return mFamilyCharacterMap.test(aCh);
|
||||
}
|
||||
|
||||
void ResetCharacterMap() REQUIRES(mLock) {
|
||||
void ResetCharacterMap() MOZ_REQUIRES(mLock) {
|
||||
mFamilyCharacterMap.reset();
|
||||
mFamilyCharacterMapInitialized = false;
|
||||
}
|
||||
|
@ -997,12 +998,12 @@ class gfxFontFamily {
|
|||
bool CheckForFallbackFaces() const { return mCheckForFallbackFaces; }
|
||||
|
||||
// sort available fonts to put preferred (standard) faces towards the end
|
||||
void SortAvailableFonts() REQUIRES(mLock);
|
||||
void SortAvailableFonts() MOZ_REQUIRES(mLock);
|
||||
|
||||
// check whether the family fits into the simple 4-face model,
|
||||
// so we can use simplified style-matching;
|
||||
// if so set the mIsSimpleFamily flag (defaults to False before we've checked)
|
||||
void CheckForSimpleFamily() REQUIRES(mLock);
|
||||
void CheckForSimpleFamily() MOZ_REQUIRES(mLock);
|
||||
|
||||
// For memory reporter
|
||||
virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
|
@ -1045,7 +1046,7 @@ class gfxFontFamily {
|
|||
bool useFullName = false);
|
||||
|
||||
// set whether this font family is in "bad" underline offset blocklist.
|
||||
void SetBadUnderlineFonts() REQUIRES(mLock) {
|
||||
void SetBadUnderlineFonts() MOZ_REQUIRES(mLock) {
|
||||
for (auto& f : mAvailableFonts) {
|
||||
if (f) {
|
||||
f->mIsBadUnderlineFont = true;
|
||||
|
@ -1054,8 +1055,8 @@ class gfxFontFamily {
|
|||
}
|
||||
|
||||
nsCString mName;
|
||||
nsTArray<RefPtr<gfxFontEntry>> mAvailableFonts GUARDED_BY(mLock);
|
||||
gfxSparseBitSet mFamilyCharacterMap GUARDED_BY(mLock);
|
||||
nsTArray<RefPtr<gfxFontEntry>> mAvailableFonts MOZ_GUARDED_BY(mLock);
|
||||
gfxSparseBitSet mFamilyCharacterMap MOZ_GUARDED_BY(mLock);
|
||||
|
||||
mutable mozilla::RWLock mLock;
|
||||
|
||||
|
@ -1068,7 +1069,7 @@ class gfxFontFamily {
|
|||
mozilla::Atomic<bool> mCheckedForLegacyFamilyNames;
|
||||
mozilla::Atomic<bool> mHasOtherFamilyNames;
|
||||
|
||||
bool mIsSimpleFamily : 1 GUARDED_BY(mLock);
|
||||
bool mIsSimpleFamily : 1 MOZ_GUARDED_BY(mLock);
|
||||
bool mIsBadUnderlineFamily : 1;
|
||||
bool mSkipDefaultFeatureSpaceCheck : 1;
|
||||
bool mCheckForFallbackFaces : 1; // check other faces for character
|
||||
|
|
|
@ -400,7 +400,7 @@ static bool ShouldIgnoreItalicStyle(const nsACString& aName) {
|
|||
|
||||
int CALLBACK GDIFontFamily::FamilyAddStylesProc(
|
||||
const ENUMLOGFONTEXW* lpelfe, const NEWTEXTMETRICEXW* nmetrics,
|
||||
DWORD fontType, LPARAM data) NO_THREAD_SAFETY_ANALYSIS {
|
||||
DWORD fontType, LPARAM data) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
const NEWTEXTMETRICW& metrics = nmetrics->ntmTm;
|
||||
LOGFONTW logFont = lpelfe->elfLogFont;
|
||||
GDIFontFamily* ff = reinterpret_cast<GDIFontFamily*>(data);
|
||||
|
|
|
@ -188,7 +188,7 @@ class GDIFontFamily final : public gfxFontFamily {
|
|||
mCharset() {}
|
||||
|
||||
void FindStyleVariationsLocked(FontInfoData* aFontInfoData = nullptr)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
bool FilterForFontList(nsAtom* aLangGroup,
|
||||
const nsACString& aGeneric) const final {
|
||||
|
@ -296,7 +296,7 @@ class gfxGDIFontList final : public gfxPlatformFontList {
|
|||
virtual ~gfxGDIFontList() { AutoLock lock(mLock); }
|
||||
|
||||
// initialize font lists
|
||||
nsresult InitFontListForPlatform() REQUIRES(mLock) override;
|
||||
nsresult InitFontListForPlatform() MOZ_REQUIRES(mLock) override;
|
||||
|
||||
gfxFontFamily* CreateFontFamily(const nsACString& aName,
|
||||
FontVisibility aVisibility) const override;
|
||||
|
@ -306,7 +306,7 @@ class gfxGDIFontList final : public gfxPlatformFontList {
|
|||
const nsACString& aFamily, nsTArray<FamilyAndGeneric>* aOutput,
|
||||
FindFamiliesFlags aFlags, gfxFontStyle* aStyle = nullptr,
|
||||
nsAtom* aLanguage = nullptr, gfxFloat aDevToCssSize = 1.0)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
gfxFontEntry* LookupLocalFont(nsPresContext* aPresContext,
|
||||
const nsACString& aFontName,
|
||||
|
@ -330,14 +330,14 @@ class gfxGDIFontList final : public gfxPlatformFontList {
|
|||
FontFamily GetDefaultFontForPlatform(nsPresContext* aPresContext,
|
||||
const gfxFontStyle* aStyle,
|
||||
nsAtom* aLanguage = nullptr)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
private:
|
||||
friend class gfxWindowsPlatform;
|
||||
|
||||
gfxGDIFontList();
|
||||
|
||||
nsresult GetFontSubstitutes() REQUIRES(mLock);
|
||||
nsresult GetFontSubstitutes() MOZ_REQUIRES(mLock);
|
||||
|
||||
static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEXW* lpelfe,
|
||||
NEWTEXTMETRICEXW* lpntme,
|
||||
|
|
|
@ -149,8 +149,8 @@ class gfxGlyphExtents {
|
|||
nsTArray<uintptr_t> mBlocks;
|
||||
};
|
||||
|
||||
GlyphWidths mContainedGlyphWidths GUARDED_BY(mLock);
|
||||
nsTHashtable<HashEntry> mTightGlyphExtents GUARDED_BY(mLock);
|
||||
GlyphWidths mContainedGlyphWidths MOZ_GUARDED_BY(mLock);
|
||||
nsTHashtable<HashEntry> mTightGlyphExtents MOZ_GUARDED_BY(mLock);
|
||||
const int32_t mAppUnitsPerDevUnit;
|
||||
mutable mozilla::RWLock mLock;
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ class gfxMacPlatformFontList final : public gfxPlatformFontList {
|
|||
const nsACString& aFamily, nsTArray<FamilyAndGeneric>* aOutput,
|
||||
FindFamiliesFlags aFlags, gfxFontStyle* aStyle = nullptr,
|
||||
nsAtom* aLanguage = nullptr, gfxFloat aDevToCssSize = 1.0)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
// lookup the system font for a particular system font type and set
|
||||
// the name and style characteristics
|
||||
|
@ -165,7 +165,7 @@ class gfxMacPlatformFontList final : public gfxPlatformFontList {
|
|||
FontFamily GetDefaultFontForPlatform(nsPresContext* aPresContext,
|
||||
const gfxFontStyle* aStyle,
|
||||
nsAtom* aLanguage = nullptr)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
private:
|
||||
friend class gfxPlatformMac;
|
||||
|
@ -174,23 +174,23 @@ class gfxMacPlatformFontList final : public gfxPlatformFontList {
|
|||
virtual ~gfxMacPlatformFontList();
|
||||
|
||||
// initialize font lists
|
||||
nsresult InitFontListForPlatform() REQUIRES(mLock) override;
|
||||
void InitSharedFontListForPlatform() REQUIRES(mLock) override;
|
||||
nsresult InitFontListForPlatform() MOZ_REQUIRES(mLock) override;
|
||||
void InitSharedFontListForPlatform() MOZ_REQUIRES(mLock) override;
|
||||
|
||||
// handle commonly used fonts for which the name table should be loaded at
|
||||
// startup
|
||||
void PreloadNamesList() REQUIRES(mLock);
|
||||
void PreloadNamesList() MOZ_REQUIRES(mLock);
|
||||
|
||||
// special case font faces treated as font families (set via prefs)
|
||||
void InitSingleFaceList() REQUIRES(mLock);
|
||||
void InitAliasesForSingleFaceList() REQUIRES(mLock);
|
||||
void InitSingleFaceList() MOZ_REQUIRES(mLock);
|
||||
void InitAliasesForSingleFaceList() MOZ_REQUIRES(mLock);
|
||||
|
||||
// initialize system fonts
|
||||
void InitSystemFontNames() REQUIRES(mLock);
|
||||
void InitSystemFontNames() MOZ_REQUIRES(mLock);
|
||||
|
||||
// helper function to lookup in both hidden system fonts and normal fonts
|
||||
gfxFontFamily* FindSystemFontFamily(const nsACString& aFamily)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
FontVisibility GetVisibilityForFamily(const nsACString& aName) const;
|
||||
|
||||
|
@ -205,7 +205,7 @@ class gfxMacPlatformFontList final : public gfxPlatformFontList {
|
|||
Script aRunScript,
|
||||
const gfxFontStyle* aMatchStyle,
|
||||
FontFamily& aMatchedFamily)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
bool UsesSystemFallback() override { return true; }
|
||||
|
||||
|
@ -216,10 +216,10 @@ class gfxMacPlatformFontList final : public gfxPlatformFontList {
|
|||
// file is included in .cpp files, so we can't use objective C classes here.
|
||||
// But CFStringRef and NSString* are the same thing anyway (they're
|
||||
// toll-free bridged).
|
||||
void AddFamily(CFStringRef aFamily) REQUIRES(mLock);
|
||||
void AddFamily(CFStringRef aFamily) MOZ_REQUIRES(mLock);
|
||||
|
||||
void AddFamily(const nsACString& aFamilyName, FontVisibility aVisibility)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
gfxFontEntry* CreateFontEntry(
|
||||
mozilla::fontlist::Face* aFace,
|
||||
|
@ -232,7 +232,7 @@ class gfxMacPlatformFontList final : public gfxPlatformFontList {
|
|||
|
||||
void ReadFaceNamesForFamily(mozilla::fontlist::Family* aFamily,
|
||||
bool aNeedFullnamePostscriptNames)
|
||||
REQUIRES(mLock) override;
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
enum { kATSGenerationInitial = -1 };
|
||||
|
||||
|
|
|
@ -759,7 +759,8 @@ class gfxMacFontFamily final : public gfxFontFamily {
|
|||
|
||||
void LocalizedName(nsACString& aLocalizedName) override;
|
||||
|
||||
void FindStyleVariationsLocked(FontInfoData* aFontInfoData = nullptr) REQUIRES(mLock) override;
|
||||
void FindStyleVariationsLocked(FontInfoData* aFontInfoData = nullptr)
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
protected:
|
||||
double mSizeHint;
|
||||
|
@ -929,7 +930,8 @@ class gfxSingleFaceMacFontFamily final : public gfxFontFamily {
|
|||
|
||||
virtual ~gfxSingleFaceMacFontFamily() = default;
|
||||
|
||||
void FindStyleVariationsLocked(FontInfoData* aFontInfoData = nullptr) REQUIRES(mLock) override{};
|
||||
void FindStyleVariationsLocked(FontInfoData* aFontInfoData = nullptr)
|
||||
MOZ_REQUIRES(mLock) override{};
|
||||
|
||||
void LocalizedName(nsACString& aLocalizedName) override;
|
||||
|
||||
|
@ -1065,7 +1067,7 @@ void gfxMacPlatformFontList::AddFamily(CFStringRef aFamily) {
|
|||
}
|
||||
|
||||
void gfxMacPlatformFontList::ReadSystemFontList(dom::SystemFontList* aList)
|
||||
NO_THREAD_SAFETY_ANALYSIS {
|
||||
MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
// Note: We rely on the records for mSystemTextFontFamilyName and
|
||||
// mSystemDisplayFontFamilyName (if present) being *before* the main
|
||||
// font list, so that those names are known in the content process
|
||||
|
|
|
@ -271,7 +271,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
AutoLock lock(mLock);
|
||||
ClearLangGroupPrefFontsLocked();
|
||||
}
|
||||
virtual void ClearLangGroupPrefFontsLocked() REQUIRES(mLock);
|
||||
virtual void ClearLangGroupPrefFontsLocked() MOZ_REQUIRES(mLock);
|
||||
|
||||
void GetFontFamilyList(nsTArray<RefPtr<gfxFontFamily>>& aFamilyArray);
|
||||
|
||||
|
@ -326,7 +326,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
const nsACString& aFamily, nsTArray<FamilyAndGeneric>* aOutput,
|
||||
FindFamiliesFlags aFlags, gfxFontStyle* aStyle = nullptr,
|
||||
nsAtom* aLanguage = nullptr, gfxFloat aDevToCssSize = 1.0)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
gfxFontEntry* FindFontForFamily(nsPresContext* aPresContext,
|
||||
const nsACString& aFamily,
|
||||
|
@ -394,7 +394,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
AddFullnameLocked(aFontEntry, aFullname);
|
||||
}
|
||||
void AddFullnameLocked(gfxFontEntry* aFontEntry, const nsCString& aFullname)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
void AddPostscriptName(gfxFontEntry* aFontEntry,
|
||||
const nsCString& aPostscriptName) {
|
||||
|
@ -403,7 +403,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
}
|
||||
void AddPostscriptNameLocked(gfxFontEntry* aFontEntry,
|
||||
const nsCString& aPostscriptName)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
bool NeedFullnamePostscriptNames() { return mExtraNames != nullptr; }
|
||||
|
||||
|
@ -427,7 +427,8 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
FontFamily GetDefaultFont(nsPresContext* aPresContext,
|
||||
const gfxFontStyle* aStyle);
|
||||
FontFamily GetDefaultFontLocked(nsPresContext* aPresContext,
|
||||
const gfxFontStyle* aStyle) REQUIRES(mLock);
|
||||
const gfxFontStyle* aStyle)
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
// get the "ultimate" default font, for use if the font list is otherwise
|
||||
// unusable (e.g. in the middle of being updated)
|
||||
|
@ -492,7 +493,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
return GetShmemCharMapLocked(aCmap);
|
||||
}
|
||||
mozilla::fontlist::Pointer GetShmemCharMapLocked(const gfxSparseBitSet* aCmap)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
// Search for existing cmap that matches the input; return the input if no
|
||||
// match is found.
|
||||
|
@ -537,9 +538,9 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
}
|
||||
gfxFontEntry* GetOrCreateFontEntryLocked(
|
||||
mozilla::fontlist::Face* aFace, const mozilla::fontlist::Family* aFamily)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
const FontPrefs* GetFontPrefs() const REQUIRES(mLock) {
|
||||
const FontPrefs* GetFontPrefs() const MOZ_REQUIRES(mLock) {
|
||||
return mFontPrefs.get();
|
||||
}
|
||||
|
||||
|
@ -556,7 +557,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
}
|
||||
PrefFontList* GetPrefFontsLangGroupLocked(
|
||||
nsPresContext* aPresContext, mozilla::StyleGenericFontFamily aGenericType,
|
||||
eFontPrefLang aPrefLang) REQUIRES(mLock);
|
||||
eFontPrefLang aPrefLang) MOZ_REQUIRES(mLock);
|
||||
|
||||
// in some situations, need to make decisions about ambiguous characters, may
|
||||
// need to look at multiple pref langs
|
||||
|
@ -619,7 +620,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
FontVisibility aVisibility) const;
|
||||
|
||||
// (Re-)initialize the set of codepoints that we know cannot be rendered.
|
||||
void InitializeCodepointsWithNoFonts() REQUIRES(mLock);
|
||||
void InitializeCodepointsWithNoFonts() MOZ_REQUIRES(mLock);
|
||||
|
||||
// If using the shared font list, returns a generation count that is
|
||||
// incremented if/when the platform list is reinitialized (e.g. because
|
||||
|
@ -634,8 +635,8 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
return PR_GetCurrentThread() == sInitFontListThread;
|
||||
}
|
||||
|
||||
void Lock() CAPABILITY_ACQUIRE(mLock) { mLock.Lock(); }
|
||||
void Unlock() CAPABILITY_RELEASE(mLock) { mLock.Unlock(); }
|
||||
void Lock() MOZ_CAPABILITY_ACQUIRE(mLock) { mLock.Lock(); }
|
||||
void Unlock() MOZ_CAPABILITY_RELEASE(mLock) { mLock.Unlock(); }
|
||||
|
||||
// This is only public because some external callers want to be able to
|
||||
// assert about the locked status.
|
||||
|
@ -740,13 +741,13 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
nsPresContext* aPresContext, const nsACString& aFamily,
|
||||
FindFamiliesFlags aFlags = FindFamiliesFlags(0),
|
||||
gfxFontStyle* aStyle = nullptr, nsAtom* aLanguage = nullptr,
|
||||
gfxFloat aDevToCssSize = 1.0) REQUIRES(mLock);
|
||||
gfxFloat aDevToCssSize = 1.0) MOZ_REQUIRES(mLock);
|
||||
|
||||
gfxFontFamily* FindUnsharedFamily(
|
||||
nsPresContext* aPresContext, const nsACString& aFamily,
|
||||
FindFamiliesFlags aFlags = FindFamiliesFlags(0),
|
||||
gfxFontStyle* aStyle = nullptr, nsAtom* aLanguage = nullptr,
|
||||
gfxFloat aDevToCssSize = 1.0) REQUIRES(mLock) {
|
||||
gfxFloat aDevToCssSize = 1.0) MOZ_REQUIRES(mLock) {
|
||||
if (SharedFontList()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -763,7 +764,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
FindFamiliesFlags aFlags = FindFamiliesFlags(0),
|
||||
gfxFontStyle* aStyle = nullptr,
|
||||
nsAtom* aLanguage = nullptr,
|
||||
gfxFloat aDevToCssSize = 1.0) REQUIRES(mLock) {
|
||||
gfxFloat aDevToCssSize = 1.0) MOZ_REQUIRES(mLock) {
|
||||
if (SharedFontList()) {
|
||||
return FontFamily(FindSharedFamily(aPresContext, aFamily, aFlags, aStyle,
|
||||
aLanguage, aDevToCssSize));
|
||||
|
@ -775,7 +776,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
// Lookup family name in global family list without substitutions or
|
||||
// localized family name lookup. Used for common font fallback families.
|
||||
gfxFontFamily* FindFamilyByCanonicalName(const nsACString& aFamily)
|
||||
REQUIRES(mLock) {
|
||||
MOZ_REQUIRES(mLock) {
|
||||
nsAutoCString key;
|
||||
gfxFontFamily* familyEntry;
|
||||
GenerateFontListKey(aFamily, key);
|
||||
|
@ -792,14 +793,14 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
eFontPresentation aPresentation,
|
||||
const gfxFontStyle* aMatchStyle,
|
||||
FontFamily& aMatchedFamily)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
// Search fonts system-wide for a given character, null if not found.
|
||||
already_AddRefed<gfxFont> GlobalFontFallback(
|
||||
nsPresContext* aPresContext, uint32_t aCh, uint32_t aNextCh,
|
||||
Script aRunScript, eFontPresentation aPresentation,
|
||||
const gfxFontStyle* aMatchStyle, uint32_t& aCmapCount,
|
||||
FontFamily& aMatchedFamily) REQUIRES(mLock);
|
||||
FontFamily& aMatchedFamily) MOZ_REQUIRES(mLock);
|
||||
|
||||
// Platform-specific implementation of global font fallback, if any;
|
||||
// this may return nullptr in which case the default cmap-based fallback
|
||||
|
@ -816,37 +817,37 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
|
||||
void AppendCJKPrefLangs(eFontPrefLang aPrefLangs[], uint32_t& aLen,
|
||||
eFontPrefLang aCharLang, eFontPrefLang aPageLang)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
// verifies that a family contains a non-zero font count
|
||||
gfxFontFamily* CheckFamily(gfxFontFamily* aFamily) REQUIRES(mLock);
|
||||
gfxFontFamily* CheckFamily(gfxFontFamily* aFamily) MOZ_REQUIRES(mLock);
|
||||
|
||||
// initialize localized family names
|
||||
void InitOtherFamilyNamesInternal(bool aDeferOtherFamilyNamesLoading);
|
||||
void CancelInitOtherFamilyNamesTask();
|
||||
|
||||
void AddToMissedNames(const nsCString& aKey) REQUIRES(mLock);
|
||||
void AddToMissedNames(const nsCString& aKey) MOZ_REQUIRES(mLock);
|
||||
|
||||
// search through font families, looking for a given name, initializing
|
||||
// facename lists along the way. first checks all families with names
|
||||
// close to face name, then searchs all families if not found.
|
||||
gfxFontEntry* SearchFamiliesForFaceName(const nsACString& aFaceName)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
// helper method for finding fullname/postscript names in facename lists
|
||||
gfxFontEntry* FindFaceName(const nsACString& aFaceName) REQUIRES(mLock);
|
||||
gfxFontEntry* FindFaceName(const nsACString& aFaceName) MOZ_REQUIRES(mLock);
|
||||
|
||||
// look up a font by name, for cases where platform font list
|
||||
// maintains explicit mappings of fullname/psname ==> font
|
||||
virtual gfxFontEntry* LookupInFaceNameLists(const nsACString& aFaceName)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
gfxFontEntry* LookupInSharedFaceNameList(nsPresContext* aPresContext,
|
||||
const nsACString& aFaceName,
|
||||
WeightRange aWeightForEntry,
|
||||
StretchRange aStretchForEntry,
|
||||
SlantStyleRange aStyleForEntry)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
// load the bad underline blocklist from pref.
|
||||
void LoadBadUnderlineList();
|
||||
|
@ -854,13 +855,13 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
void GenerateFontListKey(const nsACString& aKeyName, nsACString& aResult);
|
||||
|
||||
virtual void GetFontFamilyNames(nsTArray<nsCString>& aFontFamilyNames)
|
||||
REQUIRES(mLock);
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
// helper function to map lang to lang group
|
||||
nsAtom* GetLangGroup(nsAtom* aLanguage);
|
||||
|
||||
// gfxFontInfoLoader overrides, used to load in font cmaps
|
||||
void InitLoader() REQUIRES(mLock) override;
|
||||
void InitLoader() MOZ_REQUIRES(mLock) override;
|
||||
bool LoadFontInfo() override;
|
||||
void CleanupLoader() override;
|
||||
|
||||
|
@ -870,23 +871,25 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
// If aForgetLocalFaces is true, all gfxFontEntries for src:local fonts must
|
||||
// be discarded (not potentially reused to satisfy the rebuilt rules),
|
||||
// because they may no longer be valid.
|
||||
void RebuildLocalFonts(bool aForgetLocalFaces = false) REQUIRES(mLock);
|
||||
void RebuildLocalFonts(bool aForgetLocalFaces = false) MOZ_REQUIRES(mLock);
|
||||
|
||||
void ResolveGenericFontNames(nsPresContext* aPresContext,
|
||||
mozilla::StyleGenericFontFamily aGenericType,
|
||||
eFontPrefLang aPrefLang,
|
||||
PrefFontList* aGenericFamilies) REQUIRES(mLock);
|
||||
PrefFontList* aGenericFamilies)
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
void ResolveEmojiFontNames(nsPresContext* aPresContext,
|
||||
PrefFontList* aGenericFamilies) REQUIRES(mLock);
|
||||
PrefFontList* aGenericFamilies)
|
||||
MOZ_REQUIRES(mLock);
|
||||
|
||||
void GetFontFamiliesFromGenericFamilies(
|
||||
nsPresContext* aPresContext, mozilla::StyleGenericFontFamily aGenericType,
|
||||
nsTArray<nsCString>& aGenericNameFamilies, nsAtom* aLangGroup,
|
||||
PrefFontList* aFontFamilies) REQUIRES(mLock);
|
||||
PrefFontList* aFontFamilies) MOZ_REQUIRES(mLock);
|
||||
|
||||
virtual nsresult InitFontListForPlatform() REQUIRES(mLock) = 0;
|
||||
virtual void InitSharedFontListForPlatform() REQUIRES(mLock) {}
|
||||
virtual nsresult InitFontListForPlatform() MOZ_REQUIRES(mLock) = 0;
|
||||
virtual void InitSharedFontListForPlatform() MOZ_REQUIRES(mLock) {}
|
||||
|
||||
virtual gfxFontEntry* CreateFontEntry(
|
||||
mozilla::fontlist::Face* aFace,
|
||||
|
@ -901,7 +904,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
* There are separate implementations of this for the per-process font list
|
||||
* and for the shared-memory font list.
|
||||
*/
|
||||
void ApplyWhitelist() REQUIRES(mLock);
|
||||
void ApplyWhitelist() MOZ_REQUIRES(mLock);
|
||||
void ApplyWhitelist(nsTArray<mozilla::fontlist::Family::InitData>& aFamilies);
|
||||
|
||||
// Create a new gfxFontFamily of the appropriate subclass for the platform,
|
||||
|
@ -921,7 +924,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
*/
|
||||
virtual void ReadFaceNamesForFamily(mozilla::fontlist::Family* aFamily,
|
||||
bool aNeedFullnamePostscriptNames)
|
||||
REQUIRES(mLock) {}
|
||||
MOZ_REQUIRES(mLock) {}
|
||||
|
||||
typedef nsRefPtrHashtable<nsCStringHashKey, gfxFontFamily> FontFamilyTable;
|
||||
typedef nsRefPtrHashtable<nsCStringHashKey, gfxFontEntry> FontEntryTable;
|
||||
|
@ -936,14 +939,14 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
virtual FontFamily GetDefaultFontForPlatform(nsPresContext* aPresContext,
|
||||
const gfxFontStyle* aStyle,
|
||||
nsAtom* aLanguage = nullptr)
|
||||
REQUIRES(mLock) = 0;
|
||||
MOZ_REQUIRES(mLock) = 0;
|
||||
|
||||
// canonical family name ==> family entry (unique, one name per family entry)
|
||||
FontFamilyTable mFontFamilies GUARDED_BY(mLock);
|
||||
FontFamilyTable mFontFamilies MOZ_GUARDED_BY(mLock);
|
||||
|
||||
// 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 GUARDED_BY(mLock);
|
||||
FontFamilyTable mOtherFamilyNames MOZ_GUARDED_BY(mLock);
|
||||
|
||||
// flag set after InitOtherFamilyNames is called upon first name lookup miss
|
||||
mozilla::Atomic<bool> mOtherFamilyNamesInitialized;
|
||||
|
@ -965,13 +968,15 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
// The lock is needed to guard access to the actual name tables, but does not
|
||||
// need to be held to just test whether mExtraNames is non-null as it is set
|
||||
// during initialization before other threads have a chance to see it.
|
||||
mozilla::UniquePtr<ExtraNames> mExtraNames PT_GUARDED_BY(mLock);
|
||||
mozilla::UniquePtr<ExtraNames> mExtraNames MOZ_PT_GUARDED_BY(mLock);
|
||||
|
||||
// face names missed when face name loading takes a long time
|
||||
mozilla::UniquePtr<nsTHashSet<nsCString>> mFaceNamesMissed GUARDED_BY(mLock);
|
||||
mozilla::UniquePtr<nsTHashSet<nsCString>> mFaceNamesMissed
|
||||
MOZ_GUARDED_BY(mLock);
|
||||
|
||||
// localized family names missed when face name loading takes a long time
|
||||
mozilla::UniquePtr<nsTHashSet<nsCString>> mOtherNamesMissed GUARDED_BY(mLock);
|
||||
mozilla::UniquePtr<nsTHashSet<nsCString>> mOtherNamesMissed
|
||||
MOZ_GUARDED_BY(mLock);
|
||||
|
||||
typedef mozilla::RangedArray<mozilla::UniquePtr<PrefFontList>,
|
||||
size_t(mozilla::StyleGenericFontFamily::None),
|
||||
|
@ -980,28 +985,28 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
PrefFontsForLangGroup;
|
||||
mozilla::RangedArray<PrefFontsForLangGroup, eFontPrefLang_First,
|
||||
eFontPrefLang_Count>
|
||||
mLangGroupPrefFonts GUARDED_BY(mLock);
|
||||
mozilla::UniquePtr<PrefFontList> mEmojiPrefFont GUARDED_BY(mLock);
|
||||
mLangGroupPrefFonts MOZ_GUARDED_BY(mLock);
|
||||
mozilla::UniquePtr<PrefFontList> mEmojiPrefFont MOZ_GUARDED_BY(mLock);
|
||||
|
||||
// When system-wide font lookup fails for a character, cache it to skip future
|
||||
// searches. This is an array of bitsets, one for each FontVisibility level.
|
||||
mozilla::EnumeratedArray<FontVisibility, FontVisibility::Count,
|
||||
gfxSparseBitSet>
|
||||
mCodepointsWithNoFonts GUARDED_BY(mLock);
|
||||
mCodepointsWithNoFonts MOZ_GUARDED_BY(mLock);
|
||||
|
||||
// the family to use for U+FFFD fallback, to avoid expensive search every time
|
||||
// on pages with lots of problems
|
||||
mozilla::EnumeratedArray<FontVisibility, FontVisibility::Count, FontFamily>
|
||||
mReplacementCharFallbackFamily GUARDED_BY(mLock);
|
||||
mReplacementCharFallbackFamily MOZ_GUARDED_BY(mLock);
|
||||
|
||||
// Sorted array of lowercased family names; use ContainsSorted to test
|
||||
nsTArray<nsCString> mBadUnderlineFamilyNames;
|
||||
|
||||
// character map data shared across families
|
||||
// contains weak ptrs to cmaps shared by font entry objects
|
||||
nsTHashtable<CharMapHashKey> mSharedCmaps GUARDED_BY(mLock);
|
||||
nsTHashtable<CharMapHashKey> mSharedCmaps MOZ_GUARDED_BY(mLock);
|
||||
|
||||
nsTHashtable<ShmemCharMapHashEntry> mShmemCharMaps GUARDED_BY(mLock);
|
||||
nsTHashtable<ShmemCharMapHashEntry> mShmemCharMaps MOZ_GUARDED_BY(mLock);
|
||||
|
||||
// data used as part of the font cmap loading process
|
||||
nsTArray<RefPtr<gfxFontFamily>> mFontFamiliesToLoad;
|
||||
|
@ -1012,13 +1017,13 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
// see bugs 636957, 1070983, 1189129
|
||||
uint32_t mFontlistInitCount = 0; // num times InitFontList called
|
||||
|
||||
nsTHashSet<gfxUserFontSet*> mUserFontSetList GUARDED_BY(mLock);
|
||||
nsTHashSet<gfxUserFontSet*> mUserFontSetList MOZ_GUARDED_BY(mLock);
|
||||
|
||||
nsLanguageAtomService* mLangService = nullptr;
|
||||
|
||||
nsTArray<uint32_t> mCJKPrefLangs GUARDED_BY(mLock);
|
||||
nsTArray<uint32_t> mCJKPrefLangs MOZ_GUARDED_BY(mLock);
|
||||
nsTArray<mozilla::StyleGenericFontFamily> mDefaultGenericsLangGroup
|
||||
GUARDED_BY(mLock);
|
||||
MOZ_GUARDED_BY(mLock);
|
||||
|
||||
nsTArray<nsCString> mEnabledFontsList;
|
||||
|
||||
|
@ -1029,11 +1034,11 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
mLocalNameTable;
|
||||
|
||||
nsRefPtrHashtable<nsPtrHashKey<mozilla::fontlist::Face>, gfxFontEntry>
|
||||
mFontEntries GUARDED_BY(mLock);
|
||||
mFontEntries MOZ_GUARDED_BY(mLock);
|
||||
|
||||
mozilla::UniquePtr<FontPrefs> mFontPrefs;
|
||||
|
||||
RefPtr<gfxFontEntry> mDefaultFontEntry GUARDED_BY(mLock);
|
||||
RefPtr<gfxFontEntry> mDefaultFontEntry MOZ_GUARDED_BY(mLock);
|
||||
|
||||
RefPtr<mozilla::CancelableRunnable> mLoadCmapsRunnable;
|
||||
uint32_t mStartedLoadingCmapsFrom = 0xffffffffu;
|
||||
|
|
|
@ -99,7 +99,7 @@ class DecodePool final : public nsIObserver {
|
|||
|
||||
// mMutex protects mIOThread.
|
||||
Mutex mMutex;
|
||||
nsCOMPtr<nsIThread> mIOThread GUARDED_BY(mMutex);
|
||||
nsCOMPtr<nsIThread> mIOThread MOZ_GUARDED_BY(mMutex);
|
||||
};
|
||||
|
||||
} // namespace image
|
||||
|
|
|
@ -438,19 +438,19 @@ class SourceBuffer final {
|
|||
char* mData;
|
||||
};
|
||||
|
||||
nsresult AppendChunk(Maybe<Chunk>&& aChunk) REQUIRES(mMutex);
|
||||
nsresult AppendChunk(Maybe<Chunk>&& aChunk) MOZ_REQUIRES(mMutex);
|
||||
Maybe<Chunk> CreateChunk(size_t aCapacity, size_t aExistingCapacity = 0,
|
||||
bool aRoundUp = true);
|
||||
nsresult Compact() REQUIRES(mMutex);
|
||||
nsresult Compact() MOZ_REQUIRES(mMutex);
|
||||
static size_t RoundedUpCapacity(size_t aCapacity);
|
||||
size_t FibonacciCapacityWithMinimum(size_t aMinCapacity) REQUIRES(mMutex);
|
||||
size_t FibonacciCapacityWithMinimum(size_t aMinCapacity) MOZ_REQUIRES(mMutex);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Iterator / consumer methods.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void AddWaitingConsumer(IResumable* aConsumer) REQUIRES(mMutex);
|
||||
void ResumeWaitingConsumers() REQUIRES(mMutex);
|
||||
void AddWaitingConsumer(IResumable* aConsumer) MOZ_REQUIRES(mMutex);
|
||||
void ResumeWaitingConsumers() MOZ_REQUIRES(mMutex);
|
||||
|
||||
typedef SourceBufferIterator::State State;
|
||||
|
||||
|
@ -466,9 +466,9 @@ class SourceBuffer final {
|
|||
// Helper methods.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult HandleError(nsresult aError) REQUIRES(mMutex);
|
||||
bool IsEmpty() REQUIRES(mMutex);
|
||||
bool IsLastChunk(uint32_t aChunk) REQUIRES(mMutex);
|
||||
nsresult HandleError(nsresult aError) MOZ_REQUIRES(mMutex);
|
||||
bool IsEmpty() MOZ_REQUIRES(mMutex);
|
||||
bool IsLastChunk(uint32_t aChunk) MOZ_REQUIRES(mMutex);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Member variables.
|
||||
|
@ -478,19 +478,19 @@ class SourceBuffer final {
|
|||
mutable Mutex mMutex;
|
||||
|
||||
/// The data in this SourceBuffer, stored as a series of Chunks.
|
||||
AutoTArray<Chunk, 1> mChunks GUARDED_BY(mMutex);
|
||||
AutoTArray<Chunk, 1> mChunks MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
/// Consumers which are waiting to be notified when new data is available.
|
||||
nsTArray<RefPtr<IResumable>> mWaitingConsumers GUARDED_BY(mMutex);
|
||||
nsTArray<RefPtr<IResumable>> mWaitingConsumers MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
/// If present, marks this SourceBuffer complete with the given final status.
|
||||
Maybe<nsresult> mStatus GUARDED_BY(mMutex);
|
||||
Maybe<nsresult> mStatus MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
/// Count of active consumers.
|
||||
uint32_t mConsumerCount GUARDED_BY(mMutex);
|
||||
uint32_t mConsumerCount MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
/// True if compacting has been performed.
|
||||
bool mCompacted GUARDED_BY(mMutex);
|
||||
bool mCompacted MOZ_GUARDED_BY(mMutex);
|
||||
};
|
||||
|
||||
} // namespace image
|
||||
|
|
|
@ -185,7 +185,7 @@ class imgFrame {
|
|||
private: // methods
|
||||
~imgFrame();
|
||||
|
||||
bool AreAllPixelsWritten() const REQUIRES(mMonitor);
|
||||
bool AreAllPixelsWritten() const MOZ_REQUIRES(mMonitor);
|
||||
nsresult ImageUpdatedInternal(const nsIntRect& aUpdateRect);
|
||||
void GetImageDataInternal(uint8_t** aData, uint32_t* length) const;
|
||||
uint32_t GetImageBytesPerRow() const;
|
||||
|
@ -229,20 +229,20 @@ class imgFrame {
|
|||
/**
|
||||
* Used for rasterized images, this contains the raw pixel data.
|
||||
*/
|
||||
RefPtr<SourceSurfaceSharedData> mRawSurface GUARDED_BY(mMonitor);
|
||||
RefPtr<SourceSurfaceSharedData> mBlankRawSurface GUARDED_BY(mMonitor);
|
||||
RefPtr<SourceSurfaceSharedData> mRawSurface MOZ_GUARDED_BY(mMonitor);
|
||||
RefPtr<SourceSurfaceSharedData> mBlankRawSurface MOZ_GUARDED_BY(mMonitor);
|
||||
|
||||
/**
|
||||
* Used for vector images that were not rasterized directly. This might be a
|
||||
* blob recording or native surface.
|
||||
*/
|
||||
RefPtr<SourceSurface> mOptSurface GUARDED_BY(mMonitor);
|
||||
RefPtr<SourceSurface> mOptSurface MOZ_GUARDED_BY(mMonitor);
|
||||
|
||||
nsIntRect mDecoded GUARDED_BY(mMonitor);
|
||||
nsIntRect mDecoded MOZ_GUARDED_BY(mMonitor);
|
||||
|
||||
bool mAborted GUARDED_BY(mMonitor);
|
||||
bool mFinished GUARDED_BY(mMonitor);
|
||||
bool mShouldRecycle GUARDED_BY(mMonitor);
|
||||
bool mAborted MOZ_GUARDED_BY(mMonitor);
|
||||
bool mFinished MOZ_GUARDED_BY(mMonitor);
|
||||
bool mShouldRecycle MOZ_GUARDED_BY(mMonitor);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Effectively const data, only mutated in the Init methods.
|
||||
|
|
|
@ -413,7 +413,7 @@ class imgLoader final : public imgILoader,
|
|||
// 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 GUARDED_BY(mUncachedImagesMutex);
|
||||
imgSet mUncachedImages MOZ_GUARDED_BY(mUncachedImagesMutex);
|
||||
// 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.
|
||||
|
|
|
@ -90,7 +90,7 @@ nsresult imgRequest::Init(
|
|||
nsIRequest* aRequest, nsIChannel* aChannel, imgCacheEntry* aCacheEntry,
|
||||
mozilla::dom::Document* aLoadingDocument,
|
||||
nsIPrincipal* aTriggeringPrincipal, mozilla::CORSMode aCORSMode,
|
||||
nsIReferrerInfo* aReferrerInfo) NO_THREAD_SAFETY_ANALYSIS {
|
||||
nsIReferrerInfo* aReferrerInfo) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Cannot use nsIURI off main thread!");
|
||||
// Init() can only be called once, and that's before it can be used off
|
||||
// mainthread
|
||||
|
|
|
@ -285,15 +285,15 @@ class imgRequest final : public nsIStreamListener,
|
|||
// 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 GUARDED_BY(mMutex);
|
||||
RefPtr<Image> mImage GUARDED_BY(mMutex);
|
||||
bool mIsMultiPartChannel : 1 GUARDED_BY(mMutex);
|
||||
bool mIsInCache : 1 GUARDED_BY(mMutex);
|
||||
bool mDecodeRequested : 1 GUARDED_BY(mMutex);
|
||||
bool mNewPartPending : 1 GUARDED_BY(mMutex);
|
||||
bool mHadInsecureRedirect : 1 GUARDED_BY(mMutex);
|
||||
RefPtr<ProgressTracker> mProgressTracker MOZ_GUARDED_BY(mMutex);
|
||||
RefPtr<Image> mImage MOZ_GUARDED_BY(mMutex);
|
||||
bool mIsMultiPartChannel : 1 MOZ_GUARDED_BY(mMutex);
|
||||
bool mIsInCache : 1 MOZ_GUARDED_BY(mMutex);
|
||||
bool mDecodeRequested : 1 MOZ_GUARDED_BY(mMutex);
|
||||
bool mNewPartPending : 1 MOZ_GUARDED_BY(mMutex);
|
||||
bool mHadInsecureRedirect : 1 MOZ_GUARDED_BY(mMutex);
|
||||
// The ID of the inner window origin, used for error reporting.
|
||||
uint64_t mInnerWindowId GUARDED_BY(mMutex);
|
||||
uint64_t mInnerWindowId MOZ_GUARDED_BY(mMutex);
|
||||
};
|
||||
|
||||
#endif // mozilla_image_imgRequest_h
|
||||
|
|
|
@ -65,7 +65,7 @@ class AtExitManager {
|
|||
};
|
||||
|
||||
mozilla::Mutex lock_;
|
||||
std::stack<CallbackAndParam> stack_ GUARDED_BY(lock_);
|
||||
std::stack<CallbackAndParam> stack_ MOZ_GUARDED_BY(lock_);
|
||||
AtExitManager* next_manager_; // Stack of managers to allow shadowing.
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtExitManager);
|
||||
|
|
|
@ -137,9 +137,10 @@ class MessageLoop::EventTarget : public nsISerialEventTarget,
|
|||
}
|
||||
|
||||
mozilla::Mutex mMutex;
|
||||
bool mShutdownTasksRun GUARDED_BY(mMutex) = false;
|
||||
nsTArray<nsCOMPtr<nsITargetShutdownTask>> mShutdownTasks GUARDED_BY(mMutex);
|
||||
MessageLoop* mLoop GUARDED_BY(mMutex);
|
||||
bool mShutdownTasksRun MOZ_GUARDED_BY(mMutex) = false;
|
||||
nsTArray<nsCOMPtr<nsITargetShutdownTask>> mShutdownTasks
|
||||
MOZ_GUARDED_BY(mMutex);
|
||||
MessageLoop* mLoop MOZ_GUARDED_BY(mMutex);
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(MessageLoop::EventTarget, nsIEventTarget,
|
||||
|
|
|
@ -420,7 +420,7 @@ class MessageLoop : public base::MessagePump::Delegate {
|
|||
// 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_ GUARDED_BY(incoming_queue_lock_);
|
||||
TaskQueue incoming_queue_ MOZ_GUARDED_BY(incoming_queue_lock_);
|
||||
// Protect access to incoming_queue_.
|
||||
mozilla::Mutex incoming_queue_lock_;
|
||||
|
||||
|
|
|
@ -246,11 +246,11 @@ class NowSingleton {
|
|||
: rollover_(TimeDelta::FromMilliseconds(0)), last_seen_(0) {}
|
||||
~NowSingleton() = default;
|
||||
|
||||
TimeDelta rollover_ GUARDED_BY(
|
||||
TimeDelta rollover_ MOZ_GUARDED_BY(
|
||||
sNowSingletonLock); // Accumulation of time lost due to rollover.
|
||||
DWORD last_seen_
|
||||
GUARDED_BY(sNowSingletonLock); // The last timeGetTime value we saw, to
|
||||
// detect rollover.
|
||||
MOZ_GUARDED_BY(sNowSingletonLock); // The last timeGetTime value we saw,
|
||||
// to detect rollover.
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NowSingleton);
|
||||
};
|
||||
|
|
|
@ -226,7 +226,7 @@ class Node {
|
|||
void ConvertToProxy(Port* port, const NodeName& to_node_name,
|
||||
PortName* port_name,
|
||||
Event::PortDescriptor* port_descriptor)
|
||||
REQUIRES(ports_lock_);
|
||||
MOZ_REQUIRES(ports_lock_);
|
||||
int AcceptPort(const PortName& port_name,
|
||||
const Event::PortDescriptor& port_descriptor);
|
||||
|
||||
|
@ -249,19 +249,19 @@ class Node {
|
|||
void UpdatePortPeerAddress(const PortName& local_port_name, Port* local_port,
|
||||
const NodeName& new_peer_node,
|
||||
const PortName& new_peer_port)
|
||||
REQUIRES(ports_lock_);
|
||||
MOZ_REQUIRES(ports_lock_);
|
||||
|
||||
// Removes an entry from |peer_port_map_| corresponding to |local_port|'s peer
|
||||
// address, if valid.
|
||||
void RemoveFromPeerPortMap(const PortName& local_port_name, Port* local_port)
|
||||
REQUIRES(ports_lock_);
|
||||
MOZ_REQUIRES(ports_lock_);
|
||||
|
||||
// Swaps the peer information for two local ports. Used during port merges.
|
||||
// Note that |ports_lock_| must be held along with each of the two port's own
|
||||
// locks, through the extent of this method.
|
||||
void SwapPortPeers(const PortName& port0_name, Port* port0,
|
||||
const PortName& port1_name, Port* port1)
|
||||
REQUIRES(ports_lock_);
|
||||
MOZ_REQUIRES(ports_lock_);
|
||||
|
||||
// Sends an acknowledge request to the peer if the port has a non-zero
|
||||
// |sequence_num_acknowledge_interval|. This needs to be done when the port's
|
||||
|
@ -296,7 +296,7 @@ class Node {
|
|||
// destroyed while this (or any individual Port) lock is held.
|
||||
mozilla::Mutex ports_lock_{"Ports Lock"};
|
||||
std::unordered_map<LocalPortName, RefPtr<Port>> ports_
|
||||
GUARDED_BY(ports_lock_);
|
||||
MOZ_GUARDED_BY(ports_lock_);
|
||||
|
||||
// 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
|
||||
|
@ -316,7 +316,7 @@ class Node {
|
|||
// port on a peer node. The key to this map is the corresponding peer node
|
||||
// name.
|
||||
std::unordered_map<NodeName, PeerPortMap> peer_port_maps_
|
||||
GUARDED_BY(ports_lock_);
|
||||
MOZ_GUARDED_BY(ports_lock_);
|
||||
};
|
||||
|
||||
} // namespace ports
|
||||
|
|
|
@ -28,9 +28,9 @@ namespace detail {
|
|||
|
||||
// Ports cannot use mozilla::Mutex, as the acquires-before relationships handled
|
||||
// by PortLocker can overload the debug-only deadlock detector.
|
||||
class CAPABILITY PortMutex : private ::mozilla::detail::MutexImpl {
|
||||
class MOZ_CAPABILITY PortMutex : private ::mozilla::detail::MutexImpl {
|
||||
public:
|
||||
void AssertCurrentThreadOwns() const ASSERT_CAPABILITY(this) {
|
||||
void AssertCurrentThreadOwns() const MOZ_ASSERT_CAPABILITY(this) {
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(mOwningThread == PR_GetCurrentThread());
|
||||
#endif
|
||||
|
@ -40,13 +40,13 @@ class CAPABILITY PortMutex : private ::mozilla::detail::MutexImpl {
|
|||
// PortMutex should only be locked/unlocked via PortLocker
|
||||
friend class ::mojo::core::ports::PortLocker;
|
||||
|
||||
void Lock() CAPABILITY_ACQUIRE() {
|
||||
void Lock() MOZ_CAPABILITY_ACQUIRE() {
|
||||
::mozilla::detail::MutexImpl::lock();
|
||||
#ifdef DEBUG
|
||||
mOwningThread = PR_GetCurrentThread();
|
||||
#endif
|
||||
}
|
||||
void Unlock() CAPABILITY_RELEASE() {
|
||||
void Unlock() MOZ_CAPABILITY_RELEASE() {
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(mOwningThread == PR_GetCurrentThread());
|
||||
mOwningThread = nullptr;
|
||||
|
|
|
@ -78,7 +78,7 @@ class AsyncBlockers {
|
|||
}
|
||||
|
||||
private:
|
||||
void MaybeResolve() REQUIRES(mLock) {
|
||||
void MaybeResolve() MOZ_REQUIRES(mLock) {
|
||||
mLock.AssertCurrentThreadOwns();
|
||||
if (mResolved) {
|
||||
return;
|
||||
|
@ -90,8 +90,8 @@ class AsyncBlockers {
|
|||
mResolved = true;
|
||||
}
|
||||
Mutex mLock;
|
||||
nsTArray<void*> mBlockers GUARDED_BY(mLock);
|
||||
bool mResolved GUARDED_BY(mLock) = false;
|
||||
nsTArray<void*> mBlockers MOZ_GUARDED_BY(mLock);
|
||||
bool mResolved MOZ_GUARDED_BY(mLock) = false;
|
||||
const RefPtr<GenericPromise::Private> mPromise;
|
||||
};
|
||||
|
||||
|
|
|
@ -51,7 +51,8 @@ class BrowserProcessSubThread : public base::Thread {
|
|||
// 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] GUARDED_BY(sLock);
|
||||
static BrowserProcessSubThread* sBrowserThreads[ID_COUNT] MOZ_GUARDED_BY(
|
||||
sLock);
|
||||
};
|
||||
|
||||
inline void AssertIOThread() {
|
||||
|
|
|
@ -41,7 +41,8 @@ class CrashReporterClient {
|
|||
|
||||
private:
|
||||
static StaticMutex sLock;
|
||||
static StaticRefPtr<CrashReporterClient> sClientSingleton GUARDED_BY(sLock);
|
||||
static StaticRefPtr<CrashReporterClient> sClientSingleton
|
||||
MOZ_GUARDED_BY(sLock);
|
||||
};
|
||||
|
||||
} // namespace ipc
|
||||
|
|
|
@ -25,9 +25,9 @@ namespace data_pipe_detail {
|
|||
|
||||
// Helper for queueing up actions to be run once the mutex has been unlocked.
|
||||
// Actions will be run in-order.
|
||||
class SCOPED_CAPABILITY DataPipeAutoLock {
|
||||
class MOZ_SCOPED_CAPABILITY DataPipeAutoLock {
|
||||
public:
|
||||
explicit DataPipeAutoLock(Mutex& aMutex) CAPABILITY_ACQUIRE(aMutex)
|
||||
explicit DataPipeAutoLock(Mutex& aMutex) MOZ_CAPABILITY_ACQUIRE(aMutex)
|
||||
: mMutex(aMutex) {
|
||||
mMutex.Lock();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class SCOPED_CAPABILITY DataPipeAutoLock {
|
|||
mActions.AppendElement(std::move(aAction));
|
||||
}
|
||||
|
||||
~DataPipeAutoLock() CAPABILITY_RELEASE() {
|
||||
~DataPipeAutoLock() MOZ_CAPABILITY_RELEASE() {
|
||||
mMutex.Unlock();
|
||||
for (auto& action : mActions) {
|
||||
action();
|
||||
|
@ -82,7 +82,7 @@ class DataPipeLink : public NodeController::PortObserver {
|
|||
mOffset(aOffset),
|
||||
mAvailable(aAvailable) {}
|
||||
|
||||
void Init() EXCLUDES(*mMutex) {
|
||||
void Init() MOZ_EXCLUDES(*mMutex) {
|
||||
{
|
||||
DataPipeAutoLock lock(*mMutex);
|
||||
if (NS_FAILED(mPeerStatus)) {
|
||||
|
@ -94,18 +94,18 @@ class DataPipeLink : public NodeController::PortObserver {
|
|||
OnPortStatusChanged();
|
||||
}
|
||||
|
||||
void OnPortStatusChanged() final EXCLUDES(*mMutex);
|
||||
void OnPortStatusChanged() final MOZ_EXCLUDES(*mMutex);
|
||||
|
||||
// Add a task to notify the callback after `aLock` is unlocked.
|
||||
//
|
||||
// This method is safe to call multiple times, as after the first time it is
|
||||
// called, `mCallback` will be cleared.
|
||||
void NotifyOnUnlock(DataPipeAutoLock& aLock) REQUIRES(*mMutex) {
|
||||
void NotifyOnUnlock(DataPipeAutoLock& aLock) MOZ_REQUIRES(*mMutex) {
|
||||
DoNotifyOnUnlock(aLock, mCallback.forget(), mCallbackTarget.forget());
|
||||
}
|
||||
|
||||
void SendBytesConsumedOnUnlock(DataPipeAutoLock& aLock, uint32_t aBytes)
|
||||
REQUIRES(*mMutex) {
|
||||
MOZ_REQUIRES(*mMutex) {
|
||||
MOZ_LOG(gDataPipeLog, LogLevel::Verbose,
|
||||
("SendOnUnlock CONSUMED(%u) %s", aBytes, Describe(aLock).get()));
|
||||
if (NS_FAILED(mPeerStatus)) {
|
||||
|
@ -128,7 +128,7 @@ class DataPipeLink : public NodeController::PortObserver {
|
|||
}
|
||||
|
||||
void SetPeerError(DataPipeAutoLock& aLock, nsresult aStatus,
|
||||
bool aSendClosed = false) REQUIRES(*mMutex) {
|
||||
bool aSendClosed = false) MOZ_REQUIRES(*mMutex) {
|
||||
MOZ_LOG(gDataPipeLog, LogLevel::Debug,
|
||||
("SetPeerError(%s%s) %s", GetStaticErrorName(aStatus),
|
||||
aSendClosed ? ", send" : "", Describe(aLock).get()));
|
||||
|
@ -150,7 +150,7 @@ class DataPipeLink : public NodeController::PortObserver {
|
|||
NotifyOnUnlock(aLock);
|
||||
}
|
||||
|
||||
nsCString Describe(DataPipeAutoLock& aLock) const REQUIRES(*mMutex) {
|
||||
nsCString Describe(DataPipeAutoLock& aLock) const MOZ_REQUIRES(*mMutex) {
|
||||
return nsPrintfCString(
|
||||
"[%s(%p) c=%u e=%s o=%u a=%u, cb=%s]",
|
||||
mReceiverSide ? "Receiver" : "Sender", this, mCapacity,
|
||||
|
@ -162,20 +162,20 @@ class DataPipeLink : public NodeController::PortObserver {
|
|||
// `DataPipeLink`.
|
||||
std::shared_ptr<Mutex> mMutex;
|
||||
|
||||
ScopedPort mPort GUARDED_BY(*mMutex);
|
||||
ScopedPort mPort MOZ_GUARDED_BY(*mMutex);
|
||||
const RefPtr<SharedMemory> mShmem;
|
||||
const uint32_t mCapacity;
|
||||
const bool mReceiverSide;
|
||||
|
||||
bool mProcessingSegment GUARDED_BY(*mMutex) = false;
|
||||
bool mProcessingSegment MOZ_GUARDED_BY(*mMutex) = false;
|
||||
|
||||
nsresult mPeerStatus GUARDED_BY(*mMutex) = NS_OK;
|
||||
uint32_t mOffset GUARDED_BY(*mMutex) = 0;
|
||||
uint32_t mAvailable GUARDED_BY(*mMutex) = 0;
|
||||
nsresult mPeerStatus MOZ_GUARDED_BY(*mMutex) = NS_OK;
|
||||
uint32_t mOffset MOZ_GUARDED_BY(*mMutex) = 0;
|
||||
uint32_t mAvailable MOZ_GUARDED_BY(*mMutex) = 0;
|
||||
|
||||
bool mCallbackClosureOnly GUARDED_BY(*mMutex) = false;
|
||||
nsCOMPtr<nsIRunnable> mCallback GUARDED_BY(*mMutex);
|
||||
nsCOMPtr<nsIEventTarget> mCallbackTarget GUARDED_BY(*mMutex);
|
||||
bool mCallbackClosureOnly MOZ_GUARDED_BY(*mMutex) = false;
|
||||
nsCOMPtr<nsIRunnable> mCallback MOZ_GUARDED_BY(*mMutex);
|
||||
nsCOMPtr<nsIEventTarget> mCallbackTarget MOZ_GUARDED_BY(*mMutex);
|
||||
};
|
||||
|
||||
void DataPipeLink::OnPortStatusChanged() {
|
||||
|
|
|
@ -33,11 +33,11 @@ class DataPipeBase {
|
|||
uint32_t aCapacity, nsresult aPeerStatus, uint32_t aOffset,
|
||||
uint32_t aAvailable);
|
||||
|
||||
void CloseInternal(DataPipeAutoLock&, nsresult aStatus) REQUIRES(*mMutex);
|
||||
void CloseInternal(DataPipeAutoLock&, nsresult aStatus) MOZ_REQUIRES(*mMutex);
|
||||
|
||||
void AsyncWaitInternal(already_AddRefed<nsIRunnable> aCallback,
|
||||
already_AddRefed<nsIEventTarget> aTarget,
|
||||
bool aClosureOnly) EXCLUDES(*mMutex);
|
||||
bool aClosureOnly) MOZ_EXCLUDES(*mMutex);
|
||||
|
||||
// Like `nsWriteSegmentFun` or `nsReadSegmentFun`.
|
||||
using ProcessSegmentFun =
|
||||
|
@ -45,24 +45,25 @@ class DataPipeBase {
|
|||
uint32_t* aProcessedCount)>;
|
||||
nsresult ProcessSegmentsInternal(uint32_t aCount,
|
||||
ProcessSegmentFun aProcessSegment,
|
||||
uint32_t* aProcessedCount) EXCLUDES(*mMutex);
|
||||
uint32_t* aProcessedCount)
|
||||
MOZ_EXCLUDES(*mMutex);
|
||||
|
||||
nsresult CheckStatus(DataPipeAutoLock&) REQUIRES(*mMutex);
|
||||
nsresult CheckStatus(DataPipeAutoLock&) MOZ_REQUIRES(*mMutex);
|
||||
|
||||
nsCString Describe(DataPipeAutoLock&) REQUIRES(*mMutex);
|
||||
nsCString Describe(DataPipeAutoLock&) MOZ_REQUIRES(*mMutex);
|
||||
|
||||
// Thread safety helper to tell the analysis that `mLink->mMutex` is held when
|
||||
// `mMutex` is held.
|
||||
void AssertSameMutex(const std::shared_ptr<Mutex>& aMutex) REQUIRES(*mMutex)
|
||||
ASSERT_CAPABILITY(*aMutex) {
|
||||
void AssertSameMutex(const std::shared_ptr<Mutex>& aMutex)
|
||||
MOZ_REQUIRES(*mMutex) MOZ_ASSERT_CAPABILITY(*aMutex) {
|
||||
MOZ_ASSERT(mMutex == aMutex);
|
||||
}
|
||||
|
||||
virtual ~DataPipeBase();
|
||||
|
||||
const std::shared_ptr<Mutex> mMutex;
|
||||
nsresult mStatus GUARDED_BY(*mMutex) = NS_OK;
|
||||
RefPtr<DataPipeLink> mLink GUARDED_BY(*mMutex);
|
||||
nsresult mStatus MOZ_GUARDED_BY(*mMutex) = NS_OK;
|
||||
RefPtr<DataPipeLink> mLink MOZ_GUARDED_BY(*mMutex);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -898,7 +898,7 @@ void BaseProcessLauncher::GetChildLogName(const char* origLogName,
|
|||
|
||||
static mozilla::StaticMutex gIPCLaunchThreadMutex;
|
||||
static mozilla::StaticRefPtr<nsIThread> gIPCLaunchThread
|
||||
GUARDED_BY(gIPCLaunchThreadMutex);
|
||||
MOZ_GUARDED_BY(gIPCLaunchThreadMutex);
|
||||
|
||||
class IPCLaunchThreadObserver final : public nsIObserver {
|
||||
public:
|
||||
|
|
|
@ -216,7 +216,7 @@ class GeckoChildProcessHost : public ChildProcessHost,
|
|||
// is well.
|
||||
PROCESS_CONNECTED,
|
||||
PROCESS_ERROR
|
||||
} mProcessState GUARDED_BY(mMonitor);
|
||||
} mProcessState MOZ_GUARDED_BY(mMonitor);
|
||||
|
||||
void PrepareLaunch();
|
||||
|
||||
|
@ -287,7 +287,7 @@ class GeckoChildProcessHost : public ChildProcessHost,
|
|||
|
||||
static uint32_t sNextUniqueID;
|
||||
static StaticAutoPtr<LinkedList<GeckoChildProcessHost>>
|
||||
sGeckoChildProcessHosts GUARDED_BY(sMutex);
|
||||
sGeckoChildProcessHosts MOZ_GUARDED_BY(sMutex);
|
||||
static StaticMutex sMutex;
|
||||
};
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ class AutoEnterTransaction {
|
|||
public:
|
||||
explicit AutoEnterTransaction(MessageChannel* aChan, int32_t aMsgSeqno,
|
||||
int32_t aTransactionID, int aNestedLevel)
|
||||
REQUIRES(*aChan->mMonitor)
|
||||
MOZ_REQUIRES(*aChan->mMonitor)
|
||||
: mChan(aChan),
|
||||
mActive(true),
|
||||
mOutgoing(true),
|
||||
|
@ -154,7 +154,7 @@ class AutoEnterTransaction {
|
|||
|
||||
explicit AutoEnterTransaction(MessageChannel* aChan,
|
||||
const IPC::Message& aMessage)
|
||||
REQUIRES(*aChan->mMonitor)
|
||||
MOZ_REQUIRES(*aChan->mMonitor)
|
||||
: mChan(aChan),
|
||||
mActive(true),
|
||||
mOutgoing(false),
|
||||
|
@ -356,7 +356,7 @@ class ChannelCountReporter final : public nsIMemoryReporter {
|
|||
using CountTable = nsTHashMap<nsDepCharHashKey, ChannelCounts>;
|
||||
|
||||
static StaticMutex sChannelCountMutex;
|
||||
static CountTable* sChannelCounts GUARDED_BY(sChannelCountMutex);
|
||||
static CountTable* sChannelCounts MOZ_GUARDED_BY(sChannelCountMutex);
|
||||
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
|
|
@ -48,8 +48,8 @@ class RefCountedMonitor : public Monitor {
|
|||
public:
|
||||
RefCountedMonitor() : Monitor("mozilla.ipc.MessageChannel.mMonitor") {}
|
||||
|
||||
void AssertSameMonitor(const RefCountedMonitor& aOther) const REQUIRES(*this)
|
||||
ASSERT_CAPABILITY(aOther) {
|
||||
void AssertSameMonitor(const RefCountedMonitor& aOther) const
|
||||
MOZ_REQUIRES(*this) MOZ_ASSERT_CAPABILITY(aOther) {
|
||||
MOZ_ASSERT(this == &aOther);
|
||||
}
|
||||
|
||||
|
@ -196,18 +196,18 @@ class MessageChannel : HasResultCodes {
|
|||
* This sends a special message that is processed on the IO thread, so that
|
||||
* other actors can know that the process will soon shutdown.
|
||||
*/
|
||||
void NotifyImpendingShutdown() EXCLUDES(*mMonitor);
|
||||
void NotifyImpendingShutdown() MOZ_EXCLUDES(*mMonitor);
|
||||
|
||||
// Close the underlying transport channel.
|
||||
void Close() EXCLUDES(*mMonitor);
|
||||
void Close() MOZ_EXCLUDES(*mMonitor);
|
||||
|
||||
// Force the channel to behave as if a channel error occurred. Valid
|
||||
// for process links only, not thread links.
|
||||
void CloseWithError() EXCLUDES(*mMonitor);
|
||||
void CloseWithError() MOZ_EXCLUDES(*mMonitor);
|
||||
|
||||
void CloseWithTimeout() EXCLUDES(*mMonitor);
|
||||
void CloseWithTimeout() MOZ_EXCLUDES(*mMonitor);
|
||||
|
||||
void SetAbortOnError(bool abort) EXCLUDES(*mMonitor) {
|
||||
void SetAbortOnError(bool abort) MOZ_EXCLUDES(*mMonitor) {
|
||||
MonitorAutoLock lock(*mMonitor);
|
||||
mAbortOnError = abort;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ class MessageChannel : HasResultCodes {
|
|||
// XXX: You must get permission from an IPC peer to use this function
|
||||
// since it requires custom deserialization and re-orders events.
|
||||
void PeekMessages(const std::function<bool(const Message& aMsg)>& aInvoke)
|
||||
EXCLUDES(*mMonitor);
|
||||
MOZ_EXCLUDES(*mMonitor);
|
||||
|
||||
// Misc. behavioral traits consumers can request for this channel
|
||||
enum ChannelFlags {
|
||||
|
@ -237,14 +237,14 @@ class MessageChannel : HasResultCodes {
|
|||
ChannelFlags GetChannelFlags() { return mFlags; }
|
||||
|
||||
// Asynchronously send a message to the other side of the channel
|
||||
bool Send(UniquePtr<Message> aMsg) EXCLUDES(*mMonitor);
|
||||
bool Send(UniquePtr<Message> aMsg) MOZ_EXCLUDES(*mMonitor);
|
||||
|
||||
// Asynchronously send a message to the other side of the channel
|
||||
// and wait for asynchronous reply.
|
||||
template <typename Value>
|
||||
void Send(UniquePtr<Message> aMsg, ActorIdType aActorId,
|
||||
ResolveCallback<Value>&& aResolve, RejectCallback&& aReject)
|
||||
EXCLUDES(*mMonitor) {
|
||||
MOZ_EXCLUDES(*mMonitor) {
|
||||
int32_t seqno = NextSeqno();
|
||||
aMsg->set_seqno(seqno);
|
||||
if (!Send(std::move(aMsg))) {
|
||||
|
@ -259,17 +259,18 @@ class MessageChannel : HasResultCodes {
|
|||
gUnresolvedResponses++;
|
||||
}
|
||||
|
||||
bool SendBuildIDsMatchMessage(const char* aParentBuildID) EXCLUDES(*mMonitor);
|
||||
bool DoBuildIDsMatch() EXCLUDES(*mMonitor) {
|
||||
bool SendBuildIDsMatchMessage(const char* aParentBuildID)
|
||||
MOZ_EXCLUDES(*mMonitor);
|
||||
bool DoBuildIDsMatch() MOZ_EXCLUDES(*mMonitor) {
|
||||
MonitorAutoLock lock(*mMonitor);
|
||||
return mBuildIDsConfirmedMatch;
|
||||
}
|
||||
|
||||
// Synchronously send |aMsg| (i.e., wait for |aReply|)
|
||||
bool Send(UniquePtr<Message> aMsg, UniquePtr<Message>* aReply)
|
||||
EXCLUDES(*mMonitor);
|
||||
MOZ_EXCLUDES(*mMonitor);
|
||||
|
||||
bool CanSend() const EXCLUDES(*mMonitor);
|
||||
bool CanSend() const MOZ_EXCLUDES(*mMonitor);
|
||||
|
||||
// Remove and return a callback that needs reply
|
||||
UniquePtr<UntypedCallbackHolder> PopCallback(const Message& aMsg);
|
||||
|
@ -289,15 +290,15 @@ class MessageChannel : HasResultCodes {
|
|||
|
||||
bool IsOnCxxStack() const { return mOnCxxStack; }
|
||||
|
||||
void CancelCurrentTransaction() EXCLUDES(*mMonitor);
|
||||
void CancelCurrentTransaction() MOZ_EXCLUDES(*mMonitor);
|
||||
|
||||
// IsClosed and NumQueuedMessages are safe to call from any thread, but
|
||||
// may provide an out-of-date value.
|
||||
bool IsClosed() EXCLUDES(*mMonitor) {
|
||||
bool IsClosed() MOZ_EXCLUDES(*mMonitor) {
|
||||
MonitorAutoLock lock(*mMonitor);
|
||||
return IsClosedLocked();
|
||||
}
|
||||
bool IsClosedLocked() const REQUIRES(*mMonitor) {
|
||||
bool IsClosedLocked() const MOZ_REQUIRES(*mMonitor) {
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
return mLink ? mLink->IsClosed() : true;
|
||||
}
|
||||
|
@ -310,8 +311,8 @@ class MessageChannel : HasResultCodes {
|
|||
/**
|
||||
* Does this MessageChannel currently cross process boundaries?
|
||||
*/
|
||||
bool IsCrossProcess() const REQUIRES(*mMonitor);
|
||||
void SetIsCrossProcess(bool aIsCrossProcess) REQUIRES(*mMonitor);
|
||||
bool IsCrossProcess() const MOZ_REQUIRES(*mMonitor);
|
||||
void SetIsCrossProcess(bool aIsCrossProcess) MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
#ifdef FUZZING_SNAPSHOT
|
||||
Maybe<mojo::core::ports::PortName> GetPortName() {
|
||||
|
@ -365,37 +366,39 @@ class MessageChannel : HasResultCodes {
|
|||
#endif // defined(OS_WIN)
|
||||
|
||||
private:
|
||||
void PostErrorNotifyTask() REQUIRES(*mMonitor);
|
||||
void OnNotifyMaybeChannelError() EXCLUDES(*mMonitor);
|
||||
void PostErrorNotifyTask() MOZ_REQUIRES(*mMonitor);
|
||||
void OnNotifyMaybeChannelError() MOZ_EXCLUDES(*mMonitor);
|
||||
void ReportConnectionError(const char* aFunctionName,
|
||||
const uint32_t aMsgTyp) const REQUIRES(*mMonitor);
|
||||
const uint32_t aMsgTyp) const
|
||||
MOZ_REQUIRES(*mMonitor);
|
||||
void ReportMessageRouteError(const char* channelName) const
|
||||
EXCLUDES(*mMonitor);
|
||||
MOZ_EXCLUDES(*mMonitor);
|
||||
bool MaybeHandleError(Result code, const Message& aMsg,
|
||||
const char* channelName) EXCLUDES(*mMonitor);
|
||||
const char* channelName) MOZ_EXCLUDES(*mMonitor);
|
||||
|
||||
void Clear() REQUIRES(*mMonitor);
|
||||
void Clear() MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
bool HasPendingEvents() REQUIRES(*mMonitor);
|
||||
bool HasPendingEvents() MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
void ProcessPendingRequests(ActorLifecycleProxy* aProxy,
|
||||
AutoEnterTransaction& aTransaction)
|
||||
REQUIRES(*mMonitor);
|
||||
MOZ_REQUIRES(*mMonitor);
|
||||
bool ProcessPendingRequest(ActorLifecycleProxy* aProxy,
|
||||
UniquePtr<Message> aUrgent) REQUIRES(*mMonitor);
|
||||
UniquePtr<Message> aUrgent)
|
||||
MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
void EnqueuePendingMessages() REQUIRES(*mMonitor);
|
||||
void EnqueuePendingMessages() MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
// Dispatches an incoming message to its appropriate handler.
|
||||
void DispatchMessage(ActorLifecycleProxy* aProxy, UniquePtr<Message> aMsg)
|
||||
REQUIRES(*mMonitor);
|
||||
MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
// DispatchMessage will route to one of these functions depending on the
|
||||
// protocol type of the message.
|
||||
void DispatchSyncMessage(ActorLifecycleProxy* aProxy, const Message& aMsg,
|
||||
UniquePtr<Message>& aReply) EXCLUDES(*mMonitor);
|
||||
UniquePtr<Message>& aReply) MOZ_EXCLUDES(*mMonitor);
|
||||
void DispatchAsyncMessage(ActorLifecycleProxy* aProxy, const Message& aMsg)
|
||||
EXCLUDES(*mMonitor);
|
||||
MOZ_EXCLUDES(*mMonitor);
|
||||
|
||||
// Return true if the wait ended because a notification was received.
|
||||
//
|
||||
|
@ -407,16 +410,16 @@ class MessageChannel : HasResultCodes {
|
|||
//
|
||||
// So in sum: true is a meaningful return value; false isn't,
|
||||
// necessarily.
|
||||
bool WaitForSyncNotify(bool aHandleWindowsMessages) REQUIRES(*mMonitor);
|
||||
bool WaitForSyncNotify(bool aHandleWindowsMessages) MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
bool WaitResponse(bool aWaitTimedOut);
|
||||
|
||||
bool ShouldContinueFromTimeout() REQUIRES(*mMonitor);
|
||||
bool ShouldContinueFromTimeout() MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
void EndTimeout() REQUIRES(*mMonitor);
|
||||
void CancelTransaction(int transaction) REQUIRES(*mMonitor);
|
||||
void EndTimeout() MOZ_REQUIRES(*mMonitor);
|
||||
void CancelTransaction(int transaction) MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
void RepostAllMessages() REQUIRES(*mMonitor);
|
||||
void RepostAllMessages() MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
int32_t NextSeqno() {
|
||||
AssertWorkerThread();
|
||||
|
@ -424,10 +427,10 @@ class MessageChannel : HasResultCodes {
|
|||
}
|
||||
|
||||
void DebugAbort(const char* file, int line, const char* cond, const char* why,
|
||||
bool reply = false) REQUIRES(*mMonitor);
|
||||
bool reply = false) MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
void AddProfilerMarker(const IPC::Message& aMessage,
|
||||
MessageDirection aDirection) REQUIRES(*mMonitor);
|
||||
MessageDirection aDirection) MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
private:
|
||||
// Returns true if we're dispatching an async message's callback.
|
||||
|
@ -441,18 +444,19 @@ class MessageChannel : HasResultCodes {
|
|||
return mDispatchingAsyncMessageNestedLevel;
|
||||
}
|
||||
|
||||
bool Connected() const REQUIRES(*mMonitor);
|
||||
bool Connected() const MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
private:
|
||||
// Executed on the IO thread.
|
||||
void NotifyWorkerThread() REQUIRES(*mMonitor);
|
||||
void NotifyWorkerThread() MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
// Return true if |aMsg| is a special message targeted at the IO
|
||||
// thread, in which case it shouldn't be delivered to the worker.
|
||||
bool MaybeInterceptSpecialIOMessage(const Message& aMsg) REQUIRES(*mMonitor);
|
||||
bool MaybeInterceptSpecialIOMessage(const Message& aMsg)
|
||||
MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
// Tell the IO thread to close the channel and wait for it to ACK.
|
||||
void SynchronouslyClose() REQUIRES(*mMonitor);
|
||||
void SynchronouslyClose() MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
// Returns true if ShouldDeferMessage(aMsg) is guaranteed to return true.
|
||||
// Otherwise, the result of ShouldDeferMessage(aMsg) may be true or false,
|
||||
|
@ -461,12 +465,13 @@ class MessageChannel : HasResultCodes {
|
|||
|
||||
// Helper for sending a message via the link. This should only be used for
|
||||
// non-special messages that might have to be postponed.
|
||||
void SendMessageToLink(UniquePtr<Message> aMsg) REQUIRES(*mMonitor);
|
||||
void SendMessageToLink(UniquePtr<Message> aMsg) MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
bool WasTransactionCanceled(int transaction);
|
||||
bool ShouldDeferMessage(const Message& aMsg) REQUIRES(*mMonitor);
|
||||
void OnMessageReceivedFromLink(UniquePtr<Message> aMsg) REQUIRES(*mMonitor);
|
||||
void OnChannelErrorFromLink() REQUIRES(*mMonitor);
|
||||
bool ShouldDeferMessage(const Message& aMsg) MOZ_REQUIRES(*mMonitor);
|
||||
void OnMessageReceivedFromLink(UniquePtr<Message> aMsg)
|
||||
MOZ_REQUIRES(*mMonitor);
|
||||
void OnChannelErrorFromLink() MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
private:
|
||||
// Clear this channel, and notify the listener that the channel has either
|
||||
|
@ -477,9 +482,9 @@ class MessageChannel : HasResultCodes {
|
|||
// listener is called, allowing for the monitor to be unlocked before the
|
||||
// MessageChannel is potentially destroyed.
|
||||
void NotifyChannelClosed(ReleasableMonitorAutoLock& aLock)
|
||||
REQUIRES(*mMonitor);
|
||||
MOZ_REQUIRES(*mMonitor);
|
||||
void NotifyMaybeChannelError(ReleasableMonitorAutoLock& aLock)
|
||||
REQUIRES(*mMonitor);
|
||||
MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
private:
|
||||
void AssertWorkerThread() const {
|
||||
|
@ -504,31 +509,31 @@ class MessageChannel : HasResultCodes {
|
|||
nsresult Cancel() override;
|
||||
NS_IMETHOD GetPriority(uint32_t* aPriority) override;
|
||||
NS_DECL_NSIRUNNABLEIPCMESSAGETYPE
|
||||
void Post() REQUIRES(*mMonitor);
|
||||
void Post() MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
bool IsScheduled() const REQUIRES(*mMonitor) {
|
||||
bool IsScheduled() const MOZ_REQUIRES(*mMonitor) {
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
return mScheduled;
|
||||
}
|
||||
|
||||
UniquePtr<Message>& Msg() REQUIRES(*mMonitor) {
|
||||
UniquePtr<Message>& Msg() MOZ_REQUIRES(*mMonitor) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(mMessage, "message was moved");
|
||||
return mMessage;
|
||||
}
|
||||
const UniquePtr<Message>& Msg() const REQUIRES(*mMonitor) {
|
||||
const UniquePtr<Message>& Msg() const MOZ_REQUIRES(*mMonitor) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(mMessage, "message was moved");
|
||||
return mMessage;
|
||||
}
|
||||
|
||||
void AssertMonitorHeld(const RefCountedMonitor& aMonitor) REQUIRES(aMonitor)
|
||||
ASSERT_CAPABILITY(*mMonitor) {
|
||||
void AssertMonitorHeld(const RefCountedMonitor& aMonitor)
|
||||
MOZ_REQUIRES(aMonitor) MOZ_ASSERT_CAPABILITY(*mMonitor) {
|
||||
aMonitor.AssertSameMonitor(*mMonitor);
|
||||
}
|
||||
|
||||
private:
|
||||
~MessageTask();
|
||||
|
||||
MessageChannel* Channel() REQUIRES(*mMonitor) {
|
||||
MessageChannel* Channel() MOZ_REQUIRES(*mMonitor) {
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
MOZ_RELEASE_ASSERT(isInList());
|
||||
return mChannel;
|
||||
|
@ -540,18 +545,18 @@ class MessageChannel : HasResultCodes {
|
|||
// The channel which this MessageTask is associated with. Only valid while
|
||||
// `mMonitor` is held, and this MessageTask `isInList()`.
|
||||
MessageChannel* const mChannel;
|
||||
UniquePtr<Message> mMessage GUARDED_BY(*mMonitor);
|
||||
UniquePtr<Message> mMessage MOZ_GUARDED_BY(*mMonitor);
|
||||
uint32_t const mPriority;
|
||||
bool mScheduled : 1 GUARDED_BY(*mMonitor);
|
||||
bool mScheduled : 1 MOZ_GUARDED_BY(*mMonitor);
|
||||
#ifdef FUZZING_SNAPSHOT
|
||||
const bool mIsFuzzMsg;
|
||||
bool mFuzzStopped GUARDED_BY(*mMonitor);
|
||||
bool mFuzzStopped MOZ_GUARDED_BY(*mMonitor);
|
||||
#endif
|
||||
};
|
||||
|
||||
bool ShouldRunMessage(const Message& aMsg) REQUIRES(*mMonitor);
|
||||
bool ShouldRunMessage(const Message& aMsg) MOZ_REQUIRES(*mMonitor);
|
||||
void RunMessage(ActorLifecycleProxy* aProxy, MessageTask& aTask)
|
||||
REQUIRES(*mMonitor);
|
||||
MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
class WorkerTargetShutdownTask final : public nsITargetShutdownTask {
|
||||
public:
|
||||
|
@ -589,13 +594,13 @@ class MessageChannel : HasResultCodes {
|
|||
// `MessageChannel`.
|
||||
RefPtr<RefCountedMonitor> const mMonitor;
|
||||
|
||||
ChannelState mChannelState GUARDED_BY(*mMonitor) = ChannelClosed;
|
||||
ChannelState mChannelState MOZ_GUARDED_BY(*mMonitor) = ChannelClosed;
|
||||
Side mSide = UnknownSide;
|
||||
bool mIsCrossProcess GUARDED_BY(*mMonitor) = false;
|
||||
UniquePtr<MessageLink> mLink GUARDED_BY(*mMonitor);
|
||||
bool mIsCrossProcess MOZ_GUARDED_BY(*mMonitor) = false;
|
||||
UniquePtr<MessageLink> mLink MOZ_GUARDED_BY(*mMonitor);
|
||||
|
||||
// NotifyMaybeChannelError runnable
|
||||
RefPtr<CancelableRunnable> mChannelErrorTask GUARDED_BY(*mMonitor);
|
||||
RefPtr<CancelableRunnable> mChannelErrorTask MOZ_GUARDED_BY(*mMonitor);
|
||||
|
||||
// Thread we are allowed to send and receive on. Set in Open(); never
|
||||
// changed, and we can only call Open() once. We shouldn't be accessing
|
||||
|
@ -603,7 +608,7 @@ class MessageChannel : HasResultCodes {
|
|||
nsCOMPtr<nsISerialEventTarget> mWorkerThread;
|
||||
|
||||
// Shutdown task to close the channel before mWorkerThread goes away.
|
||||
RefPtr<WorkerTargetShutdownTask> mShutdownTask GUARDED_BY(*mMonitor);
|
||||
RefPtr<WorkerTargetShutdownTask> mShutdownTask MOZ_GUARDED_BY(*mMonitor);
|
||||
|
||||
// Timeout periods are broken up in two to prevent system suspension from
|
||||
// triggering an abort. This method (called by WaitForEvent with a 'did
|
||||
|
@ -666,20 +671,20 @@ class MessageChannel : HasResultCodes {
|
|||
// which grow in opposite directions from child to parent.
|
||||
|
||||
friend class AutoEnterTransaction;
|
||||
AutoEnterTransaction* mTransactionStack GUARDED_BY(*mMonitor) = nullptr;
|
||||
AutoEnterTransaction* mTransactionStack MOZ_GUARDED_BY(*mMonitor) = nullptr;
|
||||
|
||||
int32_t CurrentNestedInsideSyncTransaction() const REQUIRES(*mMonitor);
|
||||
int32_t CurrentNestedInsideSyncTransaction() const MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
bool AwaitingSyncReply() const REQUIRES(*mMonitor);
|
||||
int AwaitingSyncReplyNestedLevel() const REQUIRES(*mMonitor);
|
||||
bool AwaitingSyncReply() const MOZ_REQUIRES(*mMonitor);
|
||||
int AwaitingSyncReplyNestedLevel() const MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
bool DispatchingSyncMessage() const REQUIRES(*mMonitor);
|
||||
int DispatchingSyncMessageNestedLevel() const REQUIRES(*mMonitor);
|
||||
bool DispatchingSyncMessage() const MOZ_REQUIRES(*mMonitor);
|
||||
int DispatchingSyncMessageNestedLevel() const MOZ_REQUIRES(*mMonitor);
|
||||
|
||||
#ifdef DEBUG
|
||||
void AssertMaybeDeferredCountCorrect() REQUIRES(*mMonitor);
|
||||
void AssertMaybeDeferredCountCorrect() MOZ_REQUIRES(*mMonitor);
|
||||
#else
|
||||
void AssertMaybeDeferredCountCorrect() REQUIRES(*mMonitor) {}
|
||||
void AssertMaybeDeferredCountCorrect() MOZ_REQUIRES(*mMonitor) {}
|
||||
#endif
|
||||
|
||||
// If a sync message times out, we store its sequence number here. Any
|
||||
|
@ -695,8 +700,8 @@ class MessageChannel : HasResultCodes {
|
|||
// A message is only timed out if it initiated a transaction. This avoids
|
||||
// hitting a lot of corner cases with message nesting that we don't really
|
||||
// care about.
|
||||
int32_t mTimedOutMessageSeqno GUARDED_BY(*mMonitor) = 0;
|
||||
int mTimedOutMessageNestedLevel GUARDED_BY(*mMonitor) = 0;
|
||||
int32_t mTimedOutMessageSeqno MOZ_GUARDED_BY(*mMonitor) = 0;
|
||||
int mTimedOutMessageNestedLevel MOZ_GUARDED_BY(*mMonitor) = 0;
|
||||
|
||||
// Queue of all incoming messages.
|
||||
//
|
||||
|
@ -706,12 +711,12 @@ class MessageChannel : HasResultCodes {
|
|||
// blocked, and thus can't send us any more messages until we process the sync
|
||||
// in-msg.
|
||||
//
|
||||
MessageQueue mPending GUARDED_BY(*mMonitor);
|
||||
MessageQueue mPending MOZ_GUARDED_BY(*mMonitor);
|
||||
|
||||
// The number of messages in mPending for which IsAlwaysDeferred is false
|
||||
// (i.e., the number of messages that might not be deferred, depending on
|
||||
// context).
|
||||
size_t mMaybeDeferredPendingCount GUARDED_BY(*mMonitor) = 0;
|
||||
size_t mMaybeDeferredPendingCount MOZ_GUARDED_BY(*mMonitor) = 0;
|
||||
|
||||
// Is there currently MessageChannel logic for this channel on the C++ stack?
|
||||
// This member is only accessed on the worker thread, and so is not protected
|
||||
|
@ -727,16 +732,16 @@ class MessageChannel : HasResultCodes {
|
|||
|
||||
// Should the channel abort the process from the I/O thread when
|
||||
// a channel error occurs?
|
||||
bool mAbortOnError GUARDED_BY(*mMonitor) = false;
|
||||
bool mAbortOnError MOZ_GUARDED_BY(*mMonitor) = false;
|
||||
|
||||
// True if the listener has already been notified of a channel close or
|
||||
// error.
|
||||
bool mNotifiedChannelDone GUARDED_BY(*mMonitor) = false;
|
||||
bool mNotifiedChannelDone MOZ_GUARDED_BY(*mMonitor) = false;
|
||||
|
||||
// See SetChannelFlags
|
||||
ChannelFlags mFlags = REQUIRE_DEFAULT;
|
||||
|
||||
bool mBuildIDsConfirmedMatch GUARDED_BY(*mMonitor) = false;
|
||||
bool mBuildIDsConfirmedMatch MOZ_GUARDED_BY(*mMonitor) = false;
|
||||
|
||||
// If this is true, both ends of this message channel have event targets
|
||||
// on the same thread.
|
||||
|
|
|
@ -133,7 +133,7 @@ class MessagePumpForNonMainUIThreads final : public base::MessagePumpForUI,
|
|||
private:
|
||||
~MessagePumpForNonMainUIThreads() {}
|
||||
|
||||
bool mInWait GUARDED_BY(mWaitLock);
|
||||
bool mInWait MOZ_GUARDED_BY(mWaitLock);
|
||||
mozilla::Mutex mWaitLock;
|
||||
};
|
||||
#endif // defined(XP_WIN)
|
||||
|
|
|
@ -42,9 +42,9 @@ class CAPABILITY LiveSet final {
|
|||
public:
|
||||
LiveSet() : mMutex("mozilla::mscom::LiveSet::mMutex") {}
|
||||
|
||||
void Lock() CAPABILITY_ACQUIRE(mMutex) { mMutex.Lock(); }
|
||||
void Lock() MOZ_CAPABILITY_ACQUIRE(mMutex) { mMutex.Lock(); }
|
||||
|
||||
void Unlock() CAPABILITY_RELEASE(mMutex) { mMutex.Unlock(); }
|
||||
void Unlock() MOZ_CAPABILITY_RELEASE(mMutex) { mMutex.Unlock(); }
|
||||
|
||||
void Put(IUnknown* aKey, already_AddRefed<IWeakReference> aValue) {
|
||||
mMutex.AssertCurrentThreadOwns();
|
||||
|
@ -72,20 +72,20 @@ class CAPABILITY LiveSet final {
|
|||
* We don't use the normal XPCOM BaseAutoLock because we need the ability
|
||||
* to explicitly Unlock.
|
||||
*/
|
||||
class MOZ_RAII SCOPED_CAPABILITY LiveSetAutoLock final {
|
||||
class MOZ_RAII MOZ_SCOPED_CAPABILITY LiveSetAutoLock final {
|
||||
public:
|
||||
explicit LiveSetAutoLock(LiveSet& aLiveSet) CAPABILITY_ACQUIRE(aLiveSet)
|
||||
explicit LiveSetAutoLock(LiveSet& aLiveSet) MOZ_CAPABILITY_ACQUIRE(aLiveSet)
|
||||
: mLiveSet(&aLiveSet) {
|
||||
aLiveSet.Lock();
|
||||
}
|
||||
|
||||
~LiveSetAutoLock() CAPABILITY_RELEASE() {
|
||||
~LiveSetAutoLock() MOZ_CAPABILITY_RELEASE() {
|
||||
if (mLiveSet) {
|
||||
mLiveSet->Unlock();
|
||||
}
|
||||
}
|
||||
|
||||
void Unlock() CAPABILITY_RELEASE() {
|
||||
void Unlock() MOZ_CAPABILITY_RELEASE() {
|
||||
MOZ_ASSERT(mLiveSet);
|
||||
if (mLiveSet) {
|
||||
mLiveSet->Unlock();
|
||||
|
@ -466,7 +466,7 @@ HRESULT
|
|||
Interceptor::PublishTarget(detail::LiveSetAutoLock& aLiveSetLock,
|
||||
RefPtr<IUnknown> aInterceptor, REFIID aTargetIid,
|
||||
STAUniquePtr<IUnknown> aTarget)
|
||||
NO_THREAD_SAFETY_ANALYSIS {
|
||||
MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
// Suppress thread safety analysis as this conditionally releases locks.
|
||||
RefPtr<IWeakReference> weakRef;
|
||||
HRESULT hr = GetWeakReference(getter_AddRefs(weakRef));
|
||||
|
@ -494,7 +494,7 @@ HRESULT
|
|||
Interceptor::GetInitialInterceptorForIID(
|
||||
detail::LiveSetAutoLock& aLiveSetLock, REFIID aTargetIid,
|
||||
STAUniquePtr<IUnknown> aTarget,
|
||||
void** aOutInterceptor) NO_THREAD_SAFETY_ANALYSIS {
|
||||
void** aOutInterceptor) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
// Suppress thread safety analysis as this conditionally releases locks.
|
||||
MOZ_ASSERT(aOutInterceptor);
|
||||
MOZ_ASSERT(aTargetIid != IID_IMarshal);
|
||||
|
@ -504,9 +504,9 @@ Interceptor::GetInitialInterceptorForIID(
|
|||
|
||||
auto hasFailed = [&hr]() -> bool { return FAILED(hr); };
|
||||
|
||||
PUSH_IGNORE_THREAD_SAFETY // Avoid the lambda upsetting analysis.
|
||||
MOZ_PUSH_IGNORE_THREAD_SAFETY // Avoid the lambda upsetting analysis.
|
||||
auto cleanup = [&aLiveSetLock]() -> void { aLiveSetLock.Unlock(); };
|
||||
POP_THREAD_SAFETY
|
||||
MOZ_POP_THREAD_SAFETY
|
||||
|
||||
ExecuteWhen<decltype(hasFailed), decltype(cleanup)> onFail(hasFailed,
|
||||
cleanup);
|
||||
|
|
|
@ -423,7 +423,7 @@ class ScriptPreloader : public nsIObserver,
|
|||
Result<Ok, nsresult> OpenCache();
|
||||
|
||||
// Writes a new cache file to disk. Must not be called on the main thread.
|
||||
Result<Ok, nsresult> WriteCache() REQUIRES(mSaveMonitor);
|
||||
Result<Ok, nsresult> WriteCache() MOZ_REQUIRES(mSaveMonitor);
|
||||
|
||||
void StartCacheWrite();
|
||||
|
||||
|
@ -488,7 +488,7 @@ class ScriptPreloader : public nsIObserver,
|
|||
bool mSaveComplete = false;
|
||||
bool mDataPrepared = false;
|
||||
// May only be changed on the main thread, while `mSaveMonitor` is held.
|
||||
bool mCacheInvalidated GUARDED_BY(mSaveMonitor) = false;
|
||||
bool mCacheInvalidated MOZ_GUARDED_BY(mSaveMonitor) = false;
|
||||
|
||||
// The list of scripts that we read from the initial startup cache file,
|
||||
// but have yet to initiate a decode task for.
|
||||
|
@ -504,11 +504,11 @@ class ScriptPreloader : public nsIObserver,
|
|||
|
||||
// True if a runnable has been dispatched to the main thread to finish an
|
||||
// off-thread decode operation. Access only while 'mMonitor' is held.
|
||||
bool mFinishDecodeRunnablePending GUARDED_BY(mMonitor) = false;
|
||||
bool mFinishDecodeRunnablePending MOZ_GUARDED_BY(mMonitor) = false;
|
||||
|
||||
// True is main-thread is blocked and we should notify with Monitor. Access
|
||||
// only while `mMonitor` is held.
|
||||
bool mWaitingForDecode GUARDED_BY(mMonitor) = false;
|
||||
bool mWaitingForDecode MOZ_GUARDED_BY(mMonitor) = false;
|
||||
|
||||
// The process type of the current process.
|
||||
static ProcessType sProcessType;
|
||||
|
@ -534,7 +534,7 @@ class ScriptPreloader : public nsIObserver,
|
|||
AutoMemMap* mCacheData;
|
||||
|
||||
Monitor mMonitor;
|
||||
MonitorSingleWriter mSaveMonitor ACQUIRED_BEFORE(mMonitor);
|
||||
MonitorSingleWriter mSaveMonitor MOZ_ACQUIRED_BEFORE(mMonitor);
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -241,7 +241,7 @@ class FontFaceSetImpl : public nsISupports, public gfxUserFontSet {
|
|||
|
||||
mutable RecursiveMutex mMutex;
|
||||
|
||||
FontFaceSet* MOZ_NON_OWNING_REF mOwner GUARDED_BY(mMutex);
|
||||
FontFaceSet* MOZ_NON_OWNING_REF mOwner MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// The document's node principal, which is the principal font loads for
|
||||
// this FontFaceSet will generally use. (This principal is not used for
|
||||
|
@ -255,19 +255,19 @@ class FontFaceSetImpl : public nsISupports, public gfxUserFontSet {
|
|||
// Because mDocument's principal can change over time,
|
||||
// its value must be updated by a call to ResetStandardFontLoadPrincipal.
|
||||
mutable RefPtr<gfxFontSrcPrincipal> mStandardFontLoadPrincipal
|
||||
GUARDED_BY(mMutex);
|
||||
MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// Set of all loaders pointing to us. These are not strong pointers,
|
||||
// but that's OK because nsFontFaceLoader always calls RemoveLoader on
|
||||
// us before it dies (unless we die first).
|
||||
nsTHashtable<nsPtrHashKey<nsFontFaceLoader>> mLoaders GUARDED_BY(mMutex);
|
||||
nsTHashtable<nsPtrHashKey<nsFontFaceLoader>> mLoaders MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// The non rule backed FontFace objects that have been added to this
|
||||
// FontFaceSet.
|
||||
nsTArray<FontFaceRecord> mNonRuleFaces GUARDED_BY(mMutex);
|
||||
nsTArray<FontFaceRecord> mNonRuleFaces MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// The overall status of the loading or loaded fonts in the FontFaceSet.
|
||||
dom::FontFaceSetLoadStatus mStatus GUARDED_BY(mMutex);
|
||||
dom::FontFaceSetLoadStatus mStatus MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// A map from gfxFontFaceSrc pointer identity to whether the load is allowed
|
||||
// by CSP or other checks. We store this here because querying CSP off the
|
||||
|
@ -276,22 +276,22 @@ class FontFaceSetImpl : public nsISupports, public gfxUserFontSet {
|
|||
// We could use just the pointer and use this as a hash set, but then we'd
|
||||
// have no way to verify that we've checked all the loads we should.
|
||||
nsTHashMap<nsPtrHashKey<const gfxFontFaceSrc>, bool> mAllowedFontLoads
|
||||
GUARDED_BY(mMutex);
|
||||
MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// Whether mNonRuleFaces has changed since last time UpdateRules ran.
|
||||
bool mNonRuleFacesDirty GUARDED_BY(mMutex);
|
||||
bool mNonRuleFacesDirty MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// Whether any FontFace objects in mRuleFaces or mNonRuleFaces are
|
||||
// loading. Only valid when mHasLoadingFontFacesIsDirty is false. Don't use
|
||||
// this variable directly; call the HasLoadingFontFaces method instead.
|
||||
bool mHasLoadingFontFaces GUARDED_BY(mMutex);
|
||||
bool mHasLoadingFontFaces MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// This variable is only valid when mLoadingDirty is false.
|
||||
bool mHasLoadingFontFacesIsDirty GUARDED_BY(mMutex);
|
||||
bool mHasLoadingFontFacesIsDirty MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// Whether CheckLoadingFinished calls should be ignored. See comment in
|
||||
// OnFontFaceStatusChanged.
|
||||
bool mDelayedLoadCheck GUARDED_BY(mMutex);
|
||||
bool mDelayedLoadCheck MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
// Whether the docshell for our document indicated that loads should
|
||||
// bypass the cache.
|
||||
|
|
|
@ -52,9 +52,9 @@ class FontFaceSetWorkerImpl final : public FontFaceSetImpl {
|
|||
|
||||
TimeStamp GetNavigationStartTimeStamp() override;
|
||||
|
||||
RefPtr<ThreadSafeWorkerRef> mWorkerRef GUARDED_BY(mMutex);
|
||||
RefPtr<ThreadSafeWorkerRef> mWorkerRef MOZ_GUARDED_BY(mMutex);
|
||||
|
||||
RefPtr<URLExtraData> mURLExtraData GUARDED_BY(mMutex);
|
||||
RefPtr<URLExtraData> mURLExtraData MOZ_GUARDED_BY(mMutex);
|
||||
};
|
||||
|
||||
} // namespace mozilla::dom
|
||||
|
|
|
@ -44,7 +44,7 @@ static_assert(sizeof(os_unfair_lock) == sizeof(OSSpinLock),
|
|||
// places, because they require malloc()ed memory, which causes bootstrapping
|
||||
// issues in some cases. We also can't use constructors, because for statics,
|
||||
// they would fire after the first use of malloc, resetting the locks.
|
||||
struct CAPABILITY Mutex {
|
||||
struct MOZ_CAPABILITY Mutex {
|
||||
#if defined(XP_WIN)
|
||||
CRITICAL_SECTION mMutex;
|
||||
#elif defined(XP_DARWIN)
|
||||
|
@ -86,7 +86,7 @@ struct CAPABILITY Mutex {
|
|||
return true;
|
||||
}
|
||||
|
||||
inline void Lock() CAPABILITY_ACQUIRE() {
|
||||
inline void Lock() MOZ_CAPABILITY_ACQUIRE() {
|
||||
#if defined(XP_WIN)
|
||||
EnterCriticalSection(&mMutex);
|
||||
#elif defined(XP_DARWIN)
|
||||
|
@ -109,7 +109,7 @@ struct CAPABILITY Mutex {
|
|||
#endif
|
||||
}
|
||||
|
||||
inline void Unlock() CAPABILITY_RELEASE() {
|
||||
inline void Unlock() MOZ_CAPABILITY_RELEASE() {
|
||||
#if defined(XP_WIN)
|
||||
LeaveCriticalSection(&mMutex);
|
||||
#elif defined(XP_DARWIN)
|
||||
|
@ -140,9 +140,11 @@ struct CAPABILITY Mutex {
|
|||
struct CAPABILITY StaticMutex {
|
||||
SRWLOCK mMutex;
|
||||
|
||||
inline void Lock() CAPABILITY_ACQUIRE() { AcquireSRWLockExclusive(&mMutex); }
|
||||
inline void Lock() MOZ_CAPABILITY_ACQUIRE() {
|
||||
AcquireSRWLockExclusive(&mMutex);
|
||||
}
|
||||
|
||||
inline void Unlock() CAPABILITY_RELEASE() {
|
||||
inline void Unlock() MOZ_CAPABILITY_RELEASE() {
|
||||
ReleaseSRWLockExclusive(&mMutex);
|
||||
}
|
||||
};
|
||||
|
@ -168,12 +170,12 @@ typedef Mutex StaticMutex;
|
|||
#endif
|
||||
|
||||
template <typename T>
|
||||
struct SCOPED_CAPABILITY MOZ_RAII AutoLock {
|
||||
explicit AutoLock(T& aMutex) CAPABILITY_ACQUIRE(aMutex) : mMutex(aMutex) {
|
||||
struct MOZ_SCOPED_CAPABILITY MOZ_RAII AutoLock {
|
||||
explicit AutoLock(T& aMutex) MOZ_CAPABILITY_ACQUIRE(aMutex) : mMutex(aMutex) {
|
||||
mMutex.Lock();
|
||||
}
|
||||
|
||||
~AutoLock() CAPABILITY_RELEASE() { mMutex.Unlock(); }
|
||||
~AutoLock() MOZ_CAPABILITY_RELEASE() { mMutex.Unlock(); }
|
||||
|
||||
AutoLock(const AutoLock&) = delete;
|
||||
AutoLock(AutoLock&&) = delete;
|
||||
|
|
|
@ -4730,7 +4730,7 @@ inline void MozJemalloc::moz_dispose_arena(arena_id_t aArenaId) {
|
|||
// running in threaded mode, so there is no need to check whether the program
|
||||
// is threaded here.
|
||||
FORK_HOOK
|
||||
void _malloc_prefork(void) NO_THREAD_SAFETY_ANALYSIS {
|
||||
void _malloc_prefork(void) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
// Acquire all mutexes in a safe order.
|
||||
gArenas.mLock.Lock();
|
||||
|
||||
|
@ -4744,7 +4744,7 @@ void _malloc_prefork(void) NO_THREAD_SAFETY_ANALYSIS {
|
|||
}
|
||||
|
||||
FORK_HOOK
|
||||
void _malloc_postfork_parent(void) NO_THREAD_SAFETY_ANALYSIS {
|
||||
void _malloc_postfork_parent(void) MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
// Release all mutexes, now that fork() has completed.
|
||||
huge_mtx.Unlock();
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ static bool sStdoutOrStderr = false;
|
|||
static Mutex sMutex MOZ_UNANNOTATED;
|
||||
|
||||
#ifndef _WIN32
|
||||
static void prefork() NO_THREAD_SAFETY_ANALYSIS { sMutex.Lock(); }
|
||||
static void postfork_parent() NO_THREAD_SAFETY_ANALYSIS { sMutex.Unlock(); }
|
||||
static void prefork() MOZ_NO_THREAD_SAFETY_ANALYSIS { sMutex.Lock(); }
|
||||
static void postfork_parent() MOZ_NO_THREAD_SAFETY_ANALYSIS { sMutex.Unlock(); }
|
||||
static void postfork_child() { sMutex.Init(); }
|
||||
#endif
|
||||
|
||||
|
|
|
@ -800,9 +800,9 @@ class GMut {
|
|||
// first, because that self-same PHC machinery needs to re-lock it, and
|
||||
// the crash causes non-local control flow so sMutex won't be unlocked
|
||||
// the normal way in the caller.
|
||||
PUSH_IGNORE_THREAD_SAFETY
|
||||
MOZ_PUSH_IGNORE_THREAD_SAFETY
|
||||
sMutex.Unlock();
|
||||
POP_THREAD_SAFETY
|
||||
MOZ_POP_THREAD_SAFETY
|
||||
*static_cast<uint8_t*>(aPtr) = 0;
|
||||
MOZ_CRASH("unreachable");
|
||||
}
|
||||
|
@ -880,8 +880,10 @@ class GMut {
|
|||
}
|
||||
|
||||
#ifndef XP_WIN
|
||||
static void prefork() NO_THREAD_SAFETY_ANALYSIS { sMutex.Lock(); }
|
||||
static void postfork_parent() NO_THREAD_SAFETY_ANALYSIS { sMutex.Unlock(); }
|
||||
static void prefork() MOZ_NO_THREAD_SAFETY_ANALYSIS { sMutex.Lock(); }
|
||||
static void postfork_parent() MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
sMutex.Unlock();
|
||||
}
|
||||
static void postfork_child() { sMutex.Init(); }
|
||||
#endif
|
||||
|
||||
|
|
|
@ -686,10 +686,10 @@
|
|||
* 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
|
||||
* MOZ_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)
|
||||
* MOZ_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
|
||||
|
|
|
@ -641,9 +641,9 @@ class MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS Maybe
|
|||
* Static analyzer gets confused if we have Maybe<MutexAutoLock>,
|
||||
* so we suppress thread-safety warnings here
|
||||
*/
|
||||
PUSH_IGNORE_THREAD_SAFETY
|
||||
MOZ_PUSH_IGNORE_THREAD_SAFETY
|
||||
ref().T::~T();
|
||||
POP_THREAD_SAFETY
|
||||
MOZ_POP_THREAD_SAFETY
|
||||
poisonData();
|
||||
}
|
||||
mIsSome = false;
|
||||
|
|
|
@ -23,116 +23,118 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
|
||||
#if defined(__clang__) && (__clang_major__ >= 8) && !defined(SWIG)
|
||||
# define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x))
|
||||
# define MOZ_THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x))
|
||||
// Allow for localized suppression of thread-safety warnings; finer-grained
|
||||
// than NO_THREAD_SAFETY_ANALYSIS
|
||||
# define PUSH_IGNORE_THREAD_SAFETY \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
// than MOZ_NO_THREAD_SAFETY_ANALYSIS
|
||||
# define MOZ_PUSH_IGNORE_THREAD_SAFETY \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wthread-safety\"")
|
||||
# define POP_THREAD_SAFETY _Pragma("GCC diagnostic pop")
|
||||
# define MOZ_POP_THREAD_SAFETY _Pragma("GCC diagnostic pop")
|
||||
|
||||
#else
|
||||
# define THREAD_ANNOTATION_ATTRIBUTE__(x) // no-op
|
||||
# define PUSH_IGNORE_THREAD_SAFETY
|
||||
# define POP_THREAD_SAFETY
|
||||
# define MOZ_THREAD_ANNOTATION_ATTRIBUTE__(x) // no-op
|
||||
# define MOZ_PUSH_IGNORE_THREAD_SAFETY
|
||||
# define MOZ_POP_THREAD_SAFETY
|
||||
#endif
|
||||
|
||||
// Document if a shared variable/field needs to be protected by a lock.
|
||||
// GUARDED_BY allows the user to specify a particular lock that should be
|
||||
// held when accessing the annotated variable, while GUARDED_VAR only
|
||||
// indicates a shared variable should be guarded (by any lock). GUARDED_VAR
|
||||
// MOZ_GUARDED_BY allows the user to specify a particular lock that should be
|
||||
// held when accessing the annotated variable, while MOZ_GUARDED_VAR only
|
||||
// indicates a shared variable should be guarded (by any lock). MOZ_GUARDED_VAR
|
||||
// is primarily used when the client cannot express the name of the lock.
|
||||
#define GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x))
|
||||
#define GUARDED_VAR THREAD_ANNOTATION_ATTRIBUTE__(guarded_var)
|
||||
#define MOZ_GUARDED_BY(x) MOZ_THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x))
|
||||
#define MOZ_GUARDED_VAR MOZ_THREAD_ANNOTATION_ATTRIBUTE__(guarded_var)
|
||||
|
||||
// Document if the memory location pointed to by a pointer should be guarded
|
||||
// by a lock when dereferencing the pointer. Similar to GUARDED_VAR,
|
||||
// PT_GUARDED_VAR is primarily used when the client cannot express the name
|
||||
// of the lock. Note that a pointer variable to a shared memory location
|
||||
// by a lock when dereferencing the pointer. Similar to MOZ_GUARDED_VAR,
|
||||
// MOZ_PT_GUARDED_VAR is primarily used when the client cannot express the
|
||||
// name of the lock. Note that a pointer variable to a shared memory location
|
||||
// could itself be a shared variable. For example, if a shared global pointer
|
||||
// q, which is guarded by mu1, points to a shared memory location that is
|
||||
// guarded by mu2, q should be annotated as follows:
|
||||
// int *q GUARDED_BY(mu1) PT_GUARDED_BY(mu2);
|
||||
#define PT_GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x))
|
||||
#define PT_GUARDED_VAR THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_var)
|
||||
// int *q MOZ_GUARDED_BY(mu1) MOZ_PT_GUARDED_BY(mu2);
|
||||
#define MOZ_PT_GUARDED_BY(x) MOZ_THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x))
|
||||
#define MOZ_PT_GUARDED_VAR MOZ_THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_var)
|
||||
|
||||
// Document the acquisition order between locks that can be held
|
||||
// simultaneously by a thread. For any two locks that need to be annotated
|
||||
// to establish an acquisition order, only one of them needs the annotation.
|
||||
// (i.e. You don't have to annotate both locks with both ACQUIRED_AFTER
|
||||
// and ACQUIRED_BEFORE.)
|
||||
#define ACQUIRED_AFTER(...) \
|
||||
THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(__VA_ARGS__))
|
||||
#define ACQUIRED_BEFORE(...) \
|
||||
THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__))
|
||||
// (i.e. You don't have to annotate both locks with both MOZ_ACQUIRED_AFTER
|
||||
// and MOZ_ACQUIRED_BEFORE.)
|
||||
#define MOZ_ACQUIRED_AFTER(...) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(__VA_ARGS__))
|
||||
#define MOZ_ACQUIRED_BEFORE(...) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__))
|
||||
|
||||
// The following three annotations document the lock requirements for
|
||||
// functions/methods.
|
||||
|
||||
// Document if a function expects certain locks to be held before it is called
|
||||
#define REQUIRES(...) \
|
||||
THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__))
|
||||
#define MOZ_REQUIRES(...) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__))
|
||||
|
||||
#define REQUIRES_SHARED(...) \
|
||||
THREAD_ANNOTATION_ATTRIBUTE__(shared_locks_required(__VA_ARGS__))
|
||||
#define MOZ_REQUIRES_SHARED(...) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(shared_locks_required(__VA_ARGS__))
|
||||
|
||||
// Document the locks acquired in the body of the function. These locks
|
||||
// cannot be held when calling this function (as google3's Mutex locks are
|
||||
// non-reentrant).
|
||||
#define EXCLUDES(x) THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(x))
|
||||
#define MOZ_EXCLUDES(x) MOZ_THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(x))
|
||||
|
||||
// Document the lock the annotated function returns without acquiring it.
|
||||
#define RETURN_CAPABILITY(x) THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x))
|
||||
#define MOZ_RETURN_CAPABILITY(x) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x))
|
||||
|
||||
// Document if a class/type is a lockable type (such as the Mutex class).
|
||||
#define CAPABILITY THREAD_ANNOTATION_ATTRIBUTE__(lockable)
|
||||
#define MOZ_CAPABILITY MOZ_THREAD_ANNOTATION_ATTRIBUTE__(lockable)
|
||||
|
||||
// Document if a class is a scoped lockable type (such as the MutexLock class).
|
||||
#define SCOPED_CAPABILITY THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable)
|
||||
#define MOZ_SCOPED_CAPABILITY MOZ_THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable)
|
||||
|
||||
// The following annotations specify lock and unlock primitives.
|
||||
#define CAPABILITY_ACQUIRE(...) \
|
||||
THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock_function(__VA_ARGS__))
|
||||
#define MOZ_CAPABILITY_ACQUIRE(...) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock_function(__VA_ARGS__))
|
||||
|
||||
#define EXCLUSIVE_RELEASE(...) \
|
||||
THREAD_ANNOTATION_ATTRIBUTE__(release_capability(__VA_ARGS__))
|
||||
#define MOZ_EXCLUSIVE_RELEASE(...) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(release_capability(__VA_ARGS__))
|
||||
|
||||
#define ACQUIRE_SHARED(...) \
|
||||
THREAD_ANNOTATION_ATTRIBUTE__(shared_lock_function(__VA_ARGS__))
|
||||
#define MOZ_ACQUIRE_SHARED(...) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(shared_lock_function(__VA_ARGS__))
|
||||
|
||||
#define TRY_ACQUIRE(...) \
|
||||
THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock_function(__VA_ARGS__))
|
||||
#define MOZ_TRY_ACQUIRE(...) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock_function(__VA_ARGS__))
|
||||
|
||||
#define SHARED_TRYLOCK_FUNCTION(...) \
|
||||
THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock_function(__VA_ARGS__))
|
||||
#define MOZ_SHARED_TRYLOCK_FUNCTION(...) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock_function(__VA_ARGS__))
|
||||
|
||||
#define CAPABILITY_RELEASE(...) \
|
||||
THREAD_ANNOTATION_ATTRIBUTE__(unlock_function(__VA_ARGS__))
|
||||
#define MOZ_CAPABILITY_RELEASE(...) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(unlock_function(__VA_ARGS__))
|
||||
|
||||
// An escape hatch for thread safety analysis to ignore the annotated function.
|
||||
#define NO_THREAD_SAFETY_ANALYSIS \
|
||||
THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis)
|
||||
#define MOZ_NO_THREAD_SAFETY_ANALYSIS \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis)
|
||||
|
||||
// Newer capabilities
|
||||
#define ASSERT_CAPABILITY(x) THREAD_ANNOTATION_ATTRIBUTE__(assert_capability(x))
|
||||
#define MOZ_ASSERT_CAPABILITY(x) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(assert_capability(x))
|
||||
|
||||
#define ASSERT_SHARED_CAPABILITY(x) \
|
||||
THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_capability(x))
|
||||
#define MOZ_ASSERT_SHARED_CAPABILITY(x) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_capability(x))
|
||||
|
||||
// Additions from current clang assertions.
|
||||
// Note: new-style definitions, since these didn't exist in the old style
|
||||
#define RELEASE_SHARED(...) \
|
||||
THREAD_ANNOTATION_ATTRIBUTE__(release_shared_capability(__VA_ARGS__))
|
||||
#define MOZ_RELEASE_SHARED(...) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(release_shared_capability(__VA_ARGS__))
|
||||
|
||||
#define RELEASE_GENERIC(...) \
|
||||
THREAD_ANNOTATION_ATTRIBUTE__(release_generic_capability(__VA_ARGS__))
|
||||
#define MOZ_RELEASE_GENERIC(...) \
|
||||
MOZ_THREAD_ANNOTATION_ATTRIBUTE__(release_generic_capability(__VA_ARGS__))
|
||||
|
||||
// Mozilla additions:
|
||||
|
||||
// AutoUnlock is supported by clang currently, but oddly you must use
|
||||
// EXCLUSIVE_RELEASE() for both the RAII constructor *and* the destructor.
|
||||
// MOZ_EXCLUSIVE_RELEASE() for both the RAII constructor *and* the destructor.
|
||||
// This hides the ugliness until they fix it upstream.
|
||||
#define SCOPED_UNLOCK_RELEASE(...) EXCLUSIVE_RELEASE(__VA_ARGS__)
|
||||
#define SCOPED_UNLOCK_REACQUIRE(...) EXCLUSIVE_RELEASE(__VA_ARGS__)
|
||||
#define MOZ_SCOPED_UNLOCK_RELEASE(...) MOZ_EXCLUSIVE_RELEASE(__VA_ARGS__)
|
||||
#define MOZ_SCOPED_UNLOCK_REACQUIRE(...) MOZ_EXCLUSIVE_RELEASE(__VA_ARGS__)
|
||||
|
||||
#endif /* mozilla_ThreadSafety_h */
|
||||
|
|
|
@ -83,13 +83,13 @@ class nsJAR final : public nsIZipReader {
|
|||
//-- Private data members, protected by mLock
|
||||
mozilla::RecursiveMutex mLock;
|
||||
// The entry in the zip this zip is reading from
|
||||
nsCString mOuterZipEntry GUARDED_BY(mLock);
|
||||
nsCString mOuterZipEntry MOZ_GUARDED_BY(mLock);
|
||||
// The zip/jar file on disk
|
||||
nsCOMPtr<nsIFile> mZipFile GUARDED_BY(mLock);
|
||||
nsCOMPtr<nsIFile> mZipFile MOZ_GUARDED_BY(mLock);
|
||||
// The underlying zip archive
|
||||
RefPtr<nsZipArchive> mZip GUARDED_BY(mLock);
|
||||
RefPtr<nsZipArchive> mZip MOZ_GUARDED_BY(mLock);
|
||||
// if cached, this points to the cache it's contained in
|
||||
nsZipReaderCache* mCache GUARDED_BY(mLock);
|
||||
nsZipReaderCache* mCache MOZ_GUARDED_BY(mLock);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -172,14 +172,14 @@ class nsZipReaderCache : public nsIZipReaderCache,
|
|||
virtual ~nsZipReaderCache();
|
||||
|
||||
mozilla::Mutex mLock;
|
||||
uint32_t mCacheSize GUARDED_BY(mLock);
|
||||
ZipsHashtable mZips GUARDED_BY(mLock);
|
||||
uint32_t mCacheSize MOZ_GUARDED_BY(mLock);
|
||||
ZipsHashtable mZips MOZ_GUARDED_BY(mLock);
|
||||
|
||||
#ifdef ZIP_CACHE_HIT_RATE
|
||||
uint32_t mZipCacheLookups GUARDED_BY(mLock);
|
||||
uint32_t mZipCacheHits GUARDED_BY(mLock);
|
||||
uint32_t mZipCacheFlushes GUARDED_BY(mLock);
|
||||
uint32_t mZipSyncMisses GUARDED_BY(mLock);
|
||||
uint32_t mZipCacheLookups MOZ_GUARDED_BY(mLock);
|
||||
uint32_t mZipCacheHits MOZ_GUARDED_BY(mLock);
|
||||
uint32_t mZipCacheFlushes MOZ_GUARDED_BY(mLock);
|
||||
uint32_t mZipSyncMisses MOZ_GUARDED_BY(mLock);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче