gecko-dev/image/imgRequest.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

301 строка
10 KiB
C
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
2012-05-21 15:12:37 +04:00
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Bug 1038536 - Flatten image/src/ directory. r=seth --HG-- rename : image/src/BMPFileHeaders.h => image/BMPFileHeaders.h rename : image/src/ClippedImage.cpp => image/ClippedImage.cpp rename : image/src/ClippedImage.h => image/ClippedImage.h rename : image/src/DecodePool.cpp => image/DecodePool.cpp rename : image/src/DecodePool.h => image/DecodePool.h rename : image/src/Decoder.cpp => image/Decoder.cpp rename : image/src/Decoder.h => image/Decoder.h rename : image/src/Downscaler.cpp => image/Downscaler.cpp rename : image/src/Downscaler.h => image/Downscaler.h rename : image/src/DynamicImage.cpp => image/DynamicImage.cpp rename : image/src/DynamicImage.h => image/DynamicImage.h rename : image/src/FrameAnimator.cpp => image/FrameAnimator.cpp rename : image/src/FrameAnimator.h => image/FrameAnimator.h rename : image/src/FrozenImage.cpp => image/FrozenImage.cpp rename : image/src/FrozenImage.h => image/FrozenImage.h rename : image/src/ICOFileHeaders.h => image/ICOFileHeaders.h rename : image/src/IProgressObserver.h => image/IProgressObserver.h rename : image/src/Image.cpp => image/Image.cpp rename : image/src/Image.h => image/Image.h rename : image/src/ImageFactory.cpp => image/ImageFactory.cpp rename : image/src/ImageFactory.h => image/ImageFactory.h rename : image/src/ImageMetadata.cpp => image/ImageMetadata.cpp rename : image/src/ImageMetadata.h => image/ImageMetadata.h rename : image/src/ImageOps.cpp => image/ImageOps.cpp rename : image/src/ImageOps.h => image/ImageOps.h rename : image/src/ImageRegion.h => image/ImageRegion.h rename : image/src/ImageURL.h => image/ImageURL.h rename : image/src/ImageWrapper.cpp => image/ImageWrapper.cpp rename : image/src/ImageWrapper.h => image/ImageWrapper.h rename : image/src/MultipartImage.cpp => image/MultipartImage.cpp rename : image/src/MultipartImage.h => image/MultipartImage.h rename : image/src/Orientation.h => image/Orientation.h rename : image/src/OrientedImage.cpp => image/OrientedImage.cpp rename : image/src/OrientedImage.h => image/OrientedImage.h rename : image/src/ProgressTracker.cpp => image/ProgressTracker.cpp rename : image/src/ProgressTracker.h => image/ProgressTracker.h rename : image/src/RasterImage.cpp => image/RasterImage.cpp rename : image/src/RasterImage.h => image/RasterImage.h rename : image/src/SVGDocumentWrapper.cpp => image/SVGDocumentWrapper.cpp rename : image/src/SVGDocumentWrapper.h => image/SVGDocumentWrapper.h rename : image/src/ScriptedNotificationObserver.cpp => image/ScriptedNotificationObserver.cpp rename : image/src/ScriptedNotificationObserver.h => image/ScriptedNotificationObserver.h rename : image/src/ShutdownTracker.cpp => image/ShutdownTracker.cpp rename : image/src/ShutdownTracker.h => image/ShutdownTracker.h rename : image/src/SourceBuffer.cpp => image/SourceBuffer.cpp rename : image/src/SourceBuffer.h => image/SourceBuffer.h rename : image/src/SurfaceCache.cpp => image/SurfaceCache.cpp rename : image/src/SurfaceCache.h => image/SurfaceCache.h rename : image/src/VectorImage.cpp => image/VectorImage.cpp rename : image/src/VectorImage.h => image/VectorImage.h rename : image/src/imgFrame.cpp => image/imgFrame.cpp rename : image/src/imgFrame.h => image/imgFrame.h rename : image/src/imgLoader.cpp => image/imgLoader.cpp rename : image/src/imgLoader.h => image/imgLoader.h rename : image/src/imgRequest.cpp => image/imgRequest.cpp rename : image/src/imgRequest.h => image/imgRequest.h rename : image/src/imgRequestProxy.cpp => image/imgRequestProxy.cpp rename : image/src/imgRequestProxy.h => image/imgRequestProxy.h rename : image/src/imgTools.cpp => image/imgTools.cpp rename : image/src/imgTools.h => image/imgTools.h
2015-05-15 06:52:05 +03:00
#ifndef mozilla_image_imgRequest_h
#define mozilla_image_imgRequest_h
2001-02-21 01:43:56 +03:00
#include "nsIChannelEventSink.h"
#include "nsIInterfaceRequestor.h"
#include "nsIStreamListener.h"
#include "nsIThreadRetargetableStreamListener.h"
#include "nsIPrincipal.h"
2001-05-08 08:21:49 +04:00
#include "nsCOMPtr.h"
#include "nsProxyRelease.h"
#include "nsString.h"
#include "nsError.h"
#include "nsIAsyncVerifyRedirectCallback.h"
#include "mozilla/Mutex.h"
#include "ImageCacheKey.h"
2001-02-21 01:43:56 +03:00
class imgCacheValidator;
class imgLoader;
class imgRequestProxy;
Bug 430061: Don't use necko's memory cache in imglib; r/sr=stuart,vlad,bz ? .fast-update ? _profile ? _tests ? obj-ff-debug ? staticlib ? README/.fast-update ? browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf ? build/pgo/automation.py ? build/pgo/profileserver.py ? config/buildid ? config/system_wrappers ? content/base/test/TestNativeXMLHttpRequest ? content/base/test/TestPlainTextSerializer ? embedding/components/printingui/src/mac/printpde/build ? gfx/thebes/public/.gfxContext.h.swp ? gfx/thebes/test/gfxFontSelectionTest ? gfx/thebes/test/gfxSurfaceRefCountTest ? gfx/thebes/test/gfxTextRunPerfTest ? gfx/thebes/test/gfxWordCacheTest ? intl/uconv/tests/TestUConv ? intl/uconv/tests/nsconv ? intl/uconv/tests/plattest ? intl/unicharutil/tests/NormalizationTest ? js/src/host_jskwgen ? js/src/jsautokw.h ? layout/style/test/css_properties.js ? layout/style/test/host_ListCSSProperties ? layout/tools/reftest/autoconf.js ? modules/libpr0n/src/.imgContainer.cpp.swp ? modules/libpr0n/src/.imgLoader.cpp.swp ? modules/libpr0n/src/.imgLoader.h.swp ? modules/libpr0n/src/.imgRequestProxy.cpp.swp ? modules/libpr0n/src/check-all-at-removal-time ? modules/libpr0n/src/currpatch ? modules/libpr0n/src/update-every-time ? modules/plugin/samples/default/mac/build ? netwerk/cache/src/.nsMemoryCacheDevice.cpp.swp ? netwerk/dns/src/etld_data.inc ? netwerk/test/ReadNTLM ? netwerk/test/TestCookie ? netwerk/test/TestIncrementalDownload ? netwerk/test/TestOpen ? netwerk/test/TestServ ? netwerk/test/TestStreamLoader ? netwerk/test/TestUDPSocketProvider ? nsprpub/.fast-update ? nsprpub/unallmakefiles ? parser/htmlparser/robot/test/htmlrobot ? parser/htmlparser/tests/grabpage/grabpage ? parser/htmlparser/tests/html/TestParser ? rdf/tests/triplescat/triplescat ? storage/test/teststorage1 ? testing/mochitest/automation.py ? testing/mochitest/automation.pyc ? testing/mochitest/runtests.pl ? testing/mochitest/runtests.py ? testing/mochitest/ssltunnel/ssltunnel ? toolkit/components/url-classifier/tests/TestUrlClassifierUtils ? toolkit/crashreporter/client/crashreporter ? toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/dump_syms ? toolkit/crashreporter/test/TestCrashReporterAPI ? toolkit/library/XUL ? toolkit/mozapps/update/src/nsUpdateService.js ? toolkit/xre/platform.ini ? tools/rb ? tools/trace-malloc ? widget/src/cocoa/libwidget.rsrc ? xpcom/io/.nsStringStream.cpp.swp ? xpcom/proxy/tests/proxy-create-threadsafety ? xpcom/sample/program/nsTestSample ? xpcom/tests/TestAutoPtr ? xpcom/tests/TestExpirationTracker ? xpcom/tests/TestHashtables ? xpcom/tests/TestINIParser ? xpcom/tests/TestPipe ? xpcom/tests/TestProxies ? xpcom/tests/TestRegistrationOrder ? xpcom/tests/TestStorageStream ? xpcom/tests/TestStringAPI ? xpcom/tests/TestStrings ? xpcom/tests/TestTArray ? xpcom/tests/TestTextFormatter ? xpcom/tests/TestThreadPool ? xpcom/tests/TestVersionComparator ? xpcom/tests/external/TestMinStringAPI ? xpfe/bootstrap/appleevents/mozillaSuite.rsrc Index: modules/libpr0n/build/nsImageModule.cpp =================================================================== RCS file: /cvsroot/mozilla/modules/libpr0n/build/nsImageModule.cpp,v retrieving revision 1.20
2008-09-05 03:00:42 +04:00
class imgCacheEntry;
class nsIProperties;
class nsIRequest;
class nsITimedChannel;
class nsIURI;
class nsIReferrerInfo;
namespace mozilla {
enum CORSMode : uint8_t;
namespace image {
class Image;
class ProgressTracker;
} // namespace image
} // namespace mozilla
struct NewPartResult;
class imgRequest final : public nsIStreamListener,
public nsIThreadRetargetableStreamListener,
public nsIChannelEventSink,
public nsIInterfaceRequestor,
public nsIAsyncVerifyRedirectCallback {
typedef mozilla::image::Image Image;
typedef mozilla::image::ImageCacheKey ImageCacheKey;
typedef mozilla::image::ProgressTracker ProgressTracker;
typedef mozilla::dom::ReferrerPolicy ReferrerPolicy;
public:
imgRequest(imgLoader* aLoader, const ImageCacheKey& aCacheKey);
2001-02-21 01:43:56 +03:00
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSISTREAMLISTENER
NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSICHANNELEVENTSINK
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK
[[nodiscard]] nsresult Init(nsIURI* aURI, nsIURI* aFinalURI,
bool aHadInsecureRedirect, nsIRequest* aRequest,
nsIChannel* aChannel, imgCacheEntry* aCacheEntry,
mozilla::dom::Document* aLoadingDocument,
nsIPrincipal* aTriggeringPrincipal,
mozilla::CORSMode aCORSMode,
nsIReferrerInfo* aReferrerInfo);
void ClearLoader();
// Callers must call imgRequestProxy::Notify later.
void AddProxy(imgRequestProxy* proxy);
// Whether a given document is allowed to reuse this request without any
// revalidation.
bool CanReuseWithoutValidation(mozilla::dom::Document*) const;
nsresult RemoveProxy(imgRequestProxy* proxy, nsresult aStatus);
// Cancel, but also ensure that all work done in Init() is undone. Call this
// only when the channel has failed to open, and so calling Cancel() on it
// won't be sufficient.
void CancelAndAbort(nsresult aStatus);
// Called or dispatched by cancel for main thread only execution.
void ContinueCancel(nsresult aStatus);
// Called or dispatched by EvictFromCache for main thread only execution.
void ContinueEvict();
// Request that we start decoding the image as soon as data becomes available.
void StartDecoding();
inline uint64_t InnerWindowID() const { return mInnerWindowId; }
void SetInnerWindowID(uint64_t aInnerWindowId) {
mInnerWindowId = aInnerWindowId;
}
// Set the cache validation information (expiry time, whether we must
// validate, etc) on the cache entry based on the request information.
// If this function is called multiple times, the information set earliest
// wins.
static void SetCacheValidation(imgCacheEntry* aEntry, nsIRequest* aRequest);
bool GetMultipart() const;
// Returns whether we went through an insecure (non-HTTPS) redirect at some
// point during loading. This does not consider the final URI.
bool HadInsecureRedirect() const;
// The CORS mode for which we loaded this image.
mozilla::CORSMode GetCORSMode() const { return mCORSMode; }
// The ReferrerInfo in effect when loading this image.
nsIReferrerInfo* GetReferrerInfo() const { return mReferrerInfo; }
// The principal for the document that loaded this image. Used when trying to
// validate a CORS image load.
already_AddRefed<nsIPrincipal> GetTriggeringPrincipal() const {
nsCOMPtr<nsIPrincipal> principal = mTriggeringPrincipal;
return principal.forget();
}
// Return the ProgressTracker associated with this imgRequest. It may live
// in |mProgressTracker| or in |mImage.mProgressTracker|, depending on whether
// mImage has been instantiated yet.
already_AddRefed<ProgressTracker> GetProgressTracker() const;
/// Returns the Image associated with this imgRequest, if it's ready.
already_AddRefed<Image> GetImage() const;
// Get the current principal of the image. No AddRefing.
inline nsIPrincipal* GetPrincipal() const { return mPrincipal.get(); }
/// Get the ImageCacheKey associated with this request.
const ImageCacheKey& CacheKey() const { return mCacheKey; }
// Resize the cache entry to 0 if it exists
void ResetCacheEntry();
// OK to use on any thread.
nsresult GetURI(nsIURI** aURI);
nsresult GetFinalURI(nsIURI** aURI);
bool IsChrome() const;
bool IsData() const;
nsresult GetImageErrorCode(void);
/// Returns a non-owning pointer to this imgRequest's MIME type.
const char* GetMimeType() const { return mContentType.get(); }
/// @return the priority of the underlying network request, or
/// PRIORITY_NORMAL if it doesn't support nsISupportsPriority.
int32_t Priority() const;
/// Adjust the priority of the underlying network request by @aDelta on behalf
/// of @aProxy.
void AdjustPriority(imgRequestProxy* aProxy, int32_t aDelta);
void BoostPriority(uint32_t aCategory);
/// Returns a weak pointer to the underlying request.
nsIRequest* GetRequest() const { return mRequest; }
nsITimedChannel* GetTimedChannel() const { return mTimedChannel; }
imgCacheValidator* GetValidator() const { return mValidator; }
void SetValidator(imgCacheValidator* aValidator) { mValidator = aValidator; }
void* LoadId() const { return mLoadId; }
void SetLoadId(void* aLoadId) { mLoadId = aLoadId; }
/// Reset the cache entry after we've dropped our reference to it. Used by
/// imgLoader when our cache entry is re-requested after we've dropped our
/// reference to it.
void SetCacheEntry(imgCacheEntry* aEntry);
/// Returns whether we've got a reference to the cache entry.
bool HasCacheEntry() const;
/// Set whether this request is stored in the cache. If it isn't, regardless
/// of whether this request has a non-null mCacheEntry, this imgRequest won't
/// try to update or modify the image cache.
void SetIsInCache(bool aCacheable);
void EvictFromCache();
void RemoveFromCache();
// Sets properties for this image; will dispatch to main thread if needed.
void SetProperties(const nsACString& aContentType,
const nsACString& aContentDisposition);
nsIProperties* Properties() const { return mProperties; }
bool HasConsumers() const;
Bug 1377457. Only apply locks to the image if SetHasImage has been called. r=aosmond This was observed in an intermittent failure of image/test/mochitest/test_discardAnimatedImage.html. What happened was: 1) Document::MaybePreLoadImage was called for the images in the test. 2) imgRequest::OnDataAvailable is called on at least one of the images. This creates the RasterImage, so any proxy for this imgRequest will now return the image via GetImage(). imgRequest::OnDataAvailable also queues the FinishPreparingForNewPartRunnable back to the main thread to call OnImageAvailable on the progress tracker on the main thread. 3) We get the actual LoadImage calls for the images of the document. We create new proxies for the existing imgRequests. imgRequestProxy::Init calls mBehaviour->SetOwner(aOwner), which sets mOwnerHasImage to true because the progress tracker has an mImage (the one we created above). 4) We get a call to LockImage, this gets forwarded to the RasterImage because mOwnerHasImage is true and we can access the image. 5) The FinishPreparingForNewPartRunnable finally runs on the main thread. The OnImageAvailable notification from the progress tracker ends up in imgRequestProxy::SetHasImage. imgRequestProxy::SetHasImage applies our local count mLockCount to the RasterImage, even though we've already forwarded one of those LockImage calls to the image. LockImage calls are now unbalanced and the image will always remain locked. The fix is simple. Only apply the Lock/Unlock calls if the FinishPreparingForNewPartRunnable has hit the main thread (ie ignore an image we can access until this happens). Differential Revision: https://phabricator.services.mozilla.com/D29326 --HG-- extra : moz-landing-system : lando
2019-05-02 02:05:47 +03:00
bool ImageAvailable() const;
bool IsDeniedCrossSiteCORSRequest() const {
return mIsDeniedCrossSiteCORSRequest;
}
bool IsCrossSiteNoCORSRequest() const { return mIsCrossSiteNoCORSRequest; }
private:
friend class FinishPreparingForNewPartRunnable;
virtual ~imgRequest();
void FinishPreparingForNewPart(const NewPartResult& aResult);
void Cancel(nsresult aStatus);
// Update the cache entry size based on the image container.
void UpdateCacheEntrySize();
/// Returns true if StartDecoding() was called.
bool IsDecodeRequested() const;
void AdjustPriorityInternal(int32_t aDelta);
// Weak reference to parent loader; this request cannot outlive its owner.
imgLoader* mLoader;
nsCOMPtr<nsIRequest> mRequest;
// The original URI we were loaded with. This is the same as the URI we are
// keyed on in the cache. We store a string here to avoid off main thread
// refcounting issues with nsStandardURL.
nsCOMPtr<nsIURI> mURI;
// The URI of the resource we ended up loading after all redirects, etc.
nsCOMPtr<nsIURI> mFinalURI;
// The principal which triggered the load of this image. Generally either
// the principal of the document the image is being loaded into, or of the
// stylesheet which specified the image to load. Used when validating for
// CORS.
nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
// The principal of this image.
nsCOMPtr<nsIPrincipal> mPrincipal;
nsCOMPtr<nsIProperties> mProperties;
nsCOMPtr<nsIChannel> mChannel;
nsCOMPtr<nsIInterfaceRequestor> mPrevChannelSink;
2001-02-21 01:43:56 +03:00
nsCOMPtr<nsITimedChannel> mTimedChannel;
nsCString mContentType;
/* we hold on to this to this so long as we have observers */
Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi --HG-- rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 08:24:48 +03:00
RefPtr<imgCacheEntry> mCacheEntry;
/// The key under which this imgRequest is stored in the image cache.
ImageCacheKey mCacheKey;
void* mLoadId;
/// Raw pointer to the first proxy that was added to this imgRequest. Use only
/// pointer comparisons; there's no guarantee this will remain valid.
void* mFirstProxy;
imgCacheValidator* mValidator;
nsCOMPtr<nsIAsyncVerifyRedirectCallback> mRedirectCallback;
nsCOMPtr<nsIChannel> mNewRedirectChannel;
// The ID of the inner window origin, used for error reporting.
uint64_t mInnerWindowId;
// The CORS mode (defined in imgIRequest) this image was loaded with. By
// default, CORS_NONE.
mozilla::CORSMode mCORSMode;
// The ReferrerInfo used for this image.
nsCOMPtr<nsIReferrerInfo> mReferrerInfo;
nsresult mImageErrorCode;
// The categories of prioritization strategy that have been requested.
uint32_t mBoostCategoriesRequested = 0;
Bug 1377457. Only apply locks to the image if SetHasImage has been called. r=aosmond This was observed in an intermittent failure of image/test/mochitest/test_discardAnimatedImage.html. What happened was: 1) Document::MaybePreLoadImage was called for the images in the test. 2) imgRequest::OnDataAvailable is called on at least one of the images. This creates the RasterImage, so any proxy for this imgRequest will now return the image via GetImage(). imgRequest::OnDataAvailable also queues the FinishPreparingForNewPartRunnable back to the main thread to call OnImageAvailable on the progress tracker on the main thread. 3) We get the actual LoadImage calls for the images of the document. We create new proxies for the existing imgRequests. imgRequestProxy::Init calls mBehaviour->SetOwner(aOwner), which sets mOwnerHasImage to true because the progress tracker has an mImage (the one we created above). 4) We get a call to LockImage, this gets forwarded to the RasterImage because mOwnerHasImage is true and we can access the image. 5) The FinishPreparingForNewPartRunnable finally runs on the main thread. The OnImageAvailable notification from the progress tracker ends up in imgRequestProxy::SetHasImage. imgRequestProxy::SetHasImage applies our local count mLockCount to the RasterImage, even though we've already forwarded one of those LockImage calls to the image. LockImage calls are now unbalanced and the image will always remain locked. The fix is simple. Only apply the Lock/Unlock calls if the FinishPreparingForNewPartRunnable has hit the main thread (ie ignore an image we can access until this happens). Differential Revision: https://phabricator.services.mozilla.com/D29326 --HG-- extra : moz-landing-system : lando
2019-05-02 02:05:47 +03:00
// If we've called OnImageAvailable.
bool mImageAvailable;
bool mIsDeniedCrossSiteCORSRequest;
bool mIsCrossSiteNoCORSRequest;
Bug 1377457. Only apply locks to the image if SetHasImage has been called. r=aosmond This was observed in an intermittent failure of image/test/mochitest/test_discardAnimatedImage.html. What happened was: 1) Document::MaybePreLoadImage was called for the images in the test. 2) imgRequest::OnDataAvailable is called on at least one of the images. This creates the RasterImage, so any proxy for this imgRequest will now return the image via GetImage(). imgRequest::OnDataAvailable also queues the FinishPreparingForNewPartRunnable back to the main thread to call OnImageAvailable on the progress tracker on the main thread. 3) We get the actual LoadImage calls for the images of the document. We create new proxies for the existing imgRequests. imgRequestProxy::Init calls mBehaviour->SetOwner(aOwner), which sets mOwnerHasImage to true because the progress tracker has an mImage (the one we created above). 4) We get a call to LockImage, this gets forwarded to the RasterImage because mOwnerHasImage is true and we can access the image. 5) The FinishPreparingForNewPartRunnable finally runs on the main thread. The OnImageAvailable notification from the progress tracker ends up in imgRequestProxy::SetHasImage. imgRequestProxy::SetHasImage applies our local count mLockCount to the RasterImage, even though we've already forwarded one of those LockImage calls to the image. LockImage calls are now unbalanced and the image will always remain locked. The fix is simple. Only apply the Lock/Unlock calls if the FinishPreparingForNewPartRunnable has hit the main thread (ie ignore an image we can access until this happens). Differential Revision: https://phabricator.services.mozilla.com/D29326 --HG-- extra : moz-landing-system : lando
2019-05-02 02:05:47 +03:00
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.
Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi --HG-- rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 08:24:48 +03:00
RefPtr<ProgressTracker> mProgressTracker;
RefPtr<Image> mImage;
bool mIsMultiPartChannel : 1;
bool mIsInCache : 1;
bool mDecodeRequested : 1;
bool mNewPartPending : 1;
bool mHadInsecureRedirect : 1;
};
2001-02-21 01:43:56 +03:00
Bug 1038536 - Flatten image/src/ directory. r=seth --HG-- rename : image/src/BMPFileHeaders.h => image/BMPFileHeaders.h rename : image/src/ClippedImage.cpp => image/ClippedImage.cpp rename : image/src/ClippedImage.h => image/ClippedImage.h rename : image/src/DecodePool.cpp => image/DecodePool.cpp rename : image/src/DecodePool.h => image/DecodePool.h rename : image/src/Decoder.cpp => image/Decoder.cpp rename : image/src/Decoder.h => image/Decoder.h rename : image/src/Downscaler.cpp => image/Downscaler.cpp rename : image/src/Downscaler.h => image/Downscaler.h rename : image/src/DynamicImage.cpp => image/DynamicImage.cpp rename : image/src/DynamicImage.h => image/DynamicImage.h rename : image/src/FrameAnimator.cpp => image/FrameAnimator.cpp rename : image/src/FrameAnimator.h => image/FrameAnimator.h rename : image/src/FrozenImage.cpp => image/FrozenImage.cpp rename : image/src/FrozenImage.h => image/FrozenImage.h rename : image/src/ICOFileHeaders.h => image/ICOFileHeaders.h rename : image/src/IProgressObserver.h => image/IProgressObserver.h rename : image/src/Image.cpp => image/Image.cpp rename : image/src/Image.h => image/Image.h rename : image/src/ImageFactory.cpp => image/ImageFactory.cpp rename : image/src/ImageFactory.h => image/ImageFactory.h rename : image/src/ImageMetadata.cpp => image/ImageMetadata.cpp rename : image/src/ImageMetadata.h => image/ImageMetadata.h rename : image/src/ImageOps.cpp => image/ImageOps.cpp rename : image/src/ImageOps.h => image/ImageOps.h rename : image/src/ImageRegion.h => image/ImageRegion.h rename : image/src/ImageURL.h => image/ImageURL.h rename : image/src/ImageWrapper.cpp => image/ImageWrapper.cpp rename : image/src/ImageWrapper.h => image/ImageWrapper.h rename : image/src/MultipartImage.cpp => image/MultipartImage.cpp rename : image/src/MultipartImage.h => image/MultipartImage.h rename : image/src/Orientation.h => image/Orientation.h rename : image/src/OrientedImage.cpp => image/OrientedImage.cpp rename : image/src/OrientedImage.h => image/OrientedImage.h rename : image/src/ProgressTracker.cpp => image/ProgressTracker.cpp rename : image/src/ProgressTracker.h => image/ProgressTracker.h rename : image/src/RasterImage.cpp => image/RasterImage.cpp rename : image/src/RasterImage.h => image/RasterImage.h rename : image/src/SVGDocumentWrapper.cpp => image/SVGDocumentWrapper.cpp rename : image/src/SVGDocumentWrapper.h => image/SVGDocumentWrapper.h rename : image/src/ScriptedNotificationObserver.cpp => image/ScriptedNotificationObserver.cpp rename : image/src/ScriptedNotificationObserver.h => image/ScriptedNotificationObserver.h rename : image/src/ShutdownTracker.cpp => image/ShutdownTracker.cpp rename : image/src/ShutdownTracker.h => image/ShutdownTracker.h rename : image/src/SourceBuffer.cpp => image/SourceBuffer.cpp rename : image/src/SourceBuffer.h => image/SourceBuffer.h rename : image/src/SurfaceCache.cpp => image/SurfaceCache.cpp rename : image/src/SurfaceCache.h => image/SurfaceCache.h rename : image/src/VectorImage.cpp => image/VectorImage.cpp rename : image/src/VectorImage.h => image/VectorImage.h rename : image/src/imgFrame.cpp => image/imgFrame.cpp rename : image/src/imgFrame.h => image/imgFrame.h rename : image/src/imgLoader.cpp => image/imgLoader.cpp rename : image/src/imgLoader.h => image/imgLoader.h rename : image/src/imgRequest.cpp => image/imgRequest.cpp rename : image/src/imgRequest.h => image/imgRequest.h rename : image/src/imgRequestProxy.cpp => image/imgRequestProxy.cpp rename : image/src/imgRequestProxy.h => image/imgRequestProxy.h rename : image/src/imgTools.cpp => image/imgTools.cpp rename : image/src/imgTools.h => image/imgTools.h
2015-05-15 06:52:05 +03:00
#endif // mozilla_image_imgRequest_h