mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1207753 - image thread-safety annotations r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D132641
This commit is contained in:
parent
4228d282a7
commit
12fddc66fd
@ -98,8 +98,8 @@ class DecodePool final : public nsIObserver {
|
||||
bool mShuttingDown = false;
|
||||
|
||||
// mMutex protects mIOThread.
|
||||
Mutex mMutex MOZ_UNANNOTATED;
|
||||
nsCOMPtr<nsIThread> mIOThread;
|
||||
Mutex mMutex;
|
||||
nsCOMPtr<nsIThread> mIOThread GUARDED_BY(mMutex);
|
||||
};
|
||||
|
||||
} // namespace image
|
||||
|
@ -180,7 +180,7 @@ class imgFrame {
|
||||
private: // methods
|
||||
~imgFrame();
|
||||
|
||||
bool AreAllPixelsWritten() const;
|
||||
bool AreAllPixelsWritten() const REQUIRES(mMonitor);
|
||||
nsresult ImageUpdatedInternal(const nsIntRect& aUpdateRect);
|
||||
void GetImageDataInternal(uint8_t** aData, uint32_t* length) const;
|
||||
uint32_t GetImageBytesPerRow() const;
|
||||
@ -219,25 +219,25 @@ class imgFrame {
|
||||
// Thread-safe mutable data, protected by mMonitor.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
mutable Monitor mMonitor MOZ_UNANNOTATED;
|
||||
mutable Monitor mMonitor;
|
||||
|
||||
/**
|
||||
* Used for rasterized images, this contains the raw pixel data.
|
||||
*/
|
||||
RefPtr<SourceSurfaceSharedData> mRawSurface;
|
||||
RefPtr<SourceSurfaceSharedData> mBlankRawSurface;
|
||||
RefPtr<SourceSurfaceSharedData> mRawSurface GUARDED_BY(mMonitor);
|
||||
RefPtr<SourceSurfaceSharedData> mBlankRawSurface GUARDED_BY(mMonitor);
|
||||
|
||||
/**
|
||||
* Used for vector images that were not rasterized directly. This might be a
|
||||
* blob recording or native surface.
|
||||
*/
|
||||
RefPtr<SourceSurface> mOptSurface;
|
||||
RefPtr<SourceSurface> mOptSurface GUARDED_BY(mMonitor);
|
||||
|
||||
nsIntRect mDecoded;
|
||||
nsIntRect mDecoded GUARDED_BY(mMonitor);
|
||||
|
||||
bool mAborted;
|
||||
bool mFinished;
|
||||
bool mShouldRecycle;
|
||||
bool mAborted GUARDED_BY(mMonitor);
|
||||
bool mFinished GUARDED_BY(mMonitor);
|
||||
bool mShouldRecycle GUARDED_BY(mMonitor);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Effectively const data, only mutated in the Init methods.
|
||||
|
@ -413,11 +413,11 @@ class imgLoader final : public imgILoader,
|
||||
// mChromeCache. The union over all imgLoader's of mCache, mChromeCache, and
|
||||
// mUncachedImages should be every imgRequest that is alive. These are weak
|
||||
// pointers so we rely on the imgRequest destructor to remove itself.
|
||||
imgSet mUncachedImages;
|
||||
imgSet mUncachedImages GUARDED_BY(mUncachedImagesMutex);
|
||||
// The imgRequest can have refs to them held on non-main thread, so we need
|
||||
// a mutex because we modify the uncached images set from the imgRequest
|
||||
// destructor.
|
||||
Mutex mUncachedImagesMutex MOZ_UNANNOTATED;
|
||||
Mutex mUncachedImagesMutex;
|
||||
|
||||
static double sCacheTimeWeight;
|
||||
static uint32_t sCacheMaxSize;
|
||||
|
@ -68,7 +68,8 @@ imgRequest::imgRequest(imgLoader* aLoader, const ImageCacheKey& aCacheKey)
|
||||
mIsInCache(false),
|
||||
mDecodeRequested(false),
|
||||
mNewPartPending(false),
|
||||
mHadInsecureRedirect(false) {
|
||||
mHadInsecureRedirect(false),
|
||||
mInnerWindowId(0) {
|
||||
LOG_FUNC(gImgLog, "imgRequest::imgRequest()");
|
||||
}
|
||||
|
||||
@ -82,13 +83,12 @@ imgRequest::~imgRequest() {
|
||||
LOG_FUNC(gImgLog, "imgRequest::~imgRequest()");
|
||||
}
|
||||
|
||||
nsresult imgRequest::Init(nsIURI* aURI, nsIURI* aFinalURI,
|
||||
bool aHadInsecureRedirect, nsIRequest* aRequest,
|
||||
nsIChannel* aChannel, imgCacheEntry* aCacheEntry,
|
||||
mozilla::dom::Document* aLoadingDocument,
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
mozilla::CORSMode aCORSMode,
|
||||
nsIReferrerInfo* aReferrerInfo) {
|
||||
nsresult imgRequest::Init(
|
||||
nsIURI* aURI, nsIURI* aFinalURI, bool aHadInsecureRedirect,
|
||||
nsIRequest* aRequest, nsIChannel* aChannel, imgCacheEntry* aCacheEntry,
|
||||
mozilla::dom::Document* aLoadingDocument,
|
||||
nsIPrincipal* aTriggeringPrincipal, mozilla::CORSMode aCORSMode,
|
||||
nsIReferrerInfo* aReferrerInfo) NO_THREAD_SAFETY_ANALYSIS {
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Cannot use nsIURI off main thread!");
|
||||
// Init() can only be called once, and that's before it can be used off
|
||||
// mainthread
|
||||
|
@ -278,20 +278,20 @@ class imgRequest final : public nsIStreamListener,
|
||||
bool mIsDeniedCrossSiteCORSRequest;
|
||||
bool mIsCrossSiteNoCORSRequest;
|
||||
|
||||
mutable mozilla::Mutex mMutex MOZ_UNANNOTATED;
|
||||
mutable mozilla::Mutex mMutex;
|
||||
|
||||
// Member variables protected by mMutex. Note that *all* flags in our bitfield
|
||||
// are protected by mMutex; if you're adding a new flag that isn'protected, it
|
||||
// must not be a part of this bitfield.
|
||||
RefPtr<ProgressTracker> mProgressTracker;
|
||||
RefPtr<Image> mImage;
|
||||
// The ID of the inner window origin, used for error reporting, profiles.
|
||||
uint64_t mInnerWindowId;
|
||||
bool mIsMultiPartChannel : 1;
|
||||
bool mIsInCache : 1;
|
||||
bool mDecodeRequested : 1;
|
||||
bool mNewPartPending : 1;
|
||||
bool mHadInsecureRedirect : 1;
|
||||
RefPtr<ProgressTracker> mProgressTracker GUARDED_BY(mMutex);
|
||||
RefPtr<Image> mImage GUARDED_BY(mMutex);
|
||||
bool mIsMultiPartChannel : 1 GUARDED_BY(mMutex);
|
||||
bool mIsInCache : 1 GUARDED_BY(mMutex);
|
||||
bool mDecodeRequested : 1 GUARDED_BY(mMutex);
|
||||
bool mNewPartPending : 1 GUARDED_BY(mMutex);
|
||||
bool mHadInsecureRedirect : 1 GUARDED_BY(mMutex);
|
||||
// The ID of the inner window origin, used for error reporting.
|
||||
uint64_t mInnerWindowId GUARDED_BY(mMutex);
|
||||
};
|
||||
|
||||
#endif // mozilla_image_imgRequest_h
|
||||
|
Loading…
Reference in New Issue
Block a user