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