Bug 1207753 - Smaller xpcom/threads & xpfe thread-safety annotations r=nika

Differential Revision: https://phabricator.services.mozilla.com/D130575
This commit is contained in:
Randell Jesup 2022-03-21 23:04:07 +00:00
parent b18c3e4ebb
commit 6779a7c1c2
5 changed files with 17 additions and 17 deletions

View file

@ -131,7 +131,7 @@ class LazyIdleThread final : public nsIThread,
/**
* Protects data that is accessed on both threads.
*/
mozilla::Mutex mMutex MOZ_UNANNOTATED;
mozilla::Mutex mMutex;
/**
* Touched on both threads but set before mThread is created. Used to direct
@ -176,14 +176,14 @@ class LazyIdleThread final : public nsIThread,
* The number of events that are pending on mThread. A nonzero value means
* that the thread cannot be cleaned up.
*/
uint32_t mPendingEventCount;
uint32_t mPendingEventCount GUARDED_BY(mMutex);
/**
* The number of times that mThread has dispatched an idle notification. Any
* timer that fires while this count is nonzero can safely be ignored as
* another timer will be on the way.
*/
uint32_t mIdleNotificationCount;
uint32_t mIdleNotificationCount GUARDED_BY(mMutex);
/**
* Whether or not the thread should automatically shutdown. If the owner
@ -202,7 +202,7 @@ class LazyIdleThread final : public nsIThread,
* Set from CleanupThread and lasting until the thread has shut down. Prevents
* further idle notifications during the shutdown process.
*/
bool mThreadIsShuttingDown;
bool mThreadIsShuttingDown GUARDED_BY(mMutex);
/**
* Whether or not the idle timeout is enabled.

View file

@ -130,16 +130,16 @@ struct MOZ_STACK_CLASS AutoNestedEventLoopAnnotation {
const AutoNestedEventLoopAnnotation&) = delete;
// The declarations of these statics live in nsThreadManager.cpp.
static AutoNestedEventLoopAnnotation* sCurrent;
static StaticMutex sStackMutex MOZ_UNANNOTATED;
static AutoNestedEventLoopAnnotation* sCurrent GUARDED_BY(sStackMutex);
static StaticMutex sStackMutex;
// We need this to avoid the inclusion of nsExceptionHandler.h here
// which can include windows.h which disturbs some dom/media/gtest.
// The implementation lives in nsThreadManager.cpp.
static void AnnotateXPCOMSpinEventLoopStack(const nsACString& aStack);
AutoNestedEventLoopAnnotation* mPrev;
nsCString mStack;
AutoNestedEventLoopAnnotation* mPrev GUARDED_BY(sStackMutex);
nsCString mStack GUARDED_BY(sStackMutex);
};
// Please see the above notes for the Behavior template parameter.

View file

@ -124,8 +124,8 @@ class SyncRunnable : public Runnable {
private:
nsCOMPtr<nsIRunnable> mRunnable;
mozilla::Monitor mMonitor MOZ_UNANNOTATED;
bool mDone;
mozilla::Monitor mMonitor;
bool mDone GUARDED_BY(mMonitor);
};
} // namespace mozilla

View file

@ -58,8 +58,8 @@ class nsProcess final : public nsIProcess, public nsIObserver {
bool aHoldWeak, bool aArgsUTF8);
PRThread* mThread;
mozilla::Mutex mLock MOZ_UNANNOTATED;
bool mShutdown;
mozilla::Mutex mLock;
bool mShutdown GUARDED_BY(mLock);
bool mBlocking;
bool mStartHidden;
bool mNoShell;
@ -71,11 +71,11 @@ class nsProcess final : public nsIProcess, public nsIObserver {
// These members are modified by multiple threads, any accesses should be
// protected with mLock.
int32_t mExitValue;
int32_t mExitValue GUARDED_BY(mLock);
#if defined(PROCESSMODEL_WINAPI)
HANDLE mProcess;
HANDLE mProcess GUARDED_BY(mLock);
#elif !defined(XP_UNIX)
PRProcess* mProcess;
PRProcess* mProcess GUARDED_BY(mLock);
#endif
};

View file

@ -343,8 +343,8 @@ class AppWindow final : public nsIBaseWindow,
nsCOMPtr<nsIRemoteTab> mPrimaryBrowserParent;
nsCOMPtr<nsITimer> mSPTimer;
mozilla::Mutex mSPTimerLock MOZ_UNANNOTATED;
nsCOMPtr<nsITimer> mSPTimer GUARDED_BY(mSPTimerLock);
mozilla::Mutex mSPTimerLock;
WidgetListenerDelegate mWidgetListenerDelegate;
private: