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. * 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 * 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 * The number of events that are pending on mThread. A nonzero value means
* that the thread cannot be cleaned up. * 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 * 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 * timer that fires while this count is nonzero can safely be ignored as
* another timer will be on the way. * 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 * 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 * Set from CleanupThread and lasting until the thread has shut down. Prevents
* further idle notifications during the shutdown process. * further idle notifications during the shutdown process.
*/ */
bool mThreadIsShuttingDown; bool mThreadIsShuttingDown GUARDED_BY(mMutex);
/** /**
* Whether or not the idle timeout is enabled. * Whether or not the idle timeout is enabled.

View file

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

View file

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

View file

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

View file

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