mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 784591. Add an optional argument to the unlock image api on documents so that we can request that the image be discarded only in some situations. r=khuey
This commit is contained in:
parent
8e6438cbf2
commit
e597215240
@ -79,8 +79,8 @@ class Element;
|
||||
} // namespace mozilla
|
||||
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x57fe44ae, 0x6656, 0x44b8, \
|
||||
{ 0x8d, 0xc0, 0xfc, 0xa7, 0x43, 0x28, 0xbe, 0x86 } }
|
||||
{ 0x0e1324c9, 0xc997, 0x447e, \
|
||||
{ 0xbc, 0xd9, 0xa6, 0x57, 0x80, 0x29, 0x91, 0xe4 } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
@ -1621,7 +1621,10 @@ public:
|
||||
|
||||
// Add/Remove images from the document image tracker
|
||||
virtual nsresult AddImage(imgIRequest* aImage) = 0;
|
||||
virtual nsresult RemoveImage(imgIRequest* aImage) = 0;
|
||||
// If the REQUEST_DISCARD flag is passed then if the lock count is zero we
|
||||
// will request the image be discarded now (instead of waiting).
|
||||
enum { REQUEST_DISCARD = 0x1 };
|
||||
virtual nsresult RemoveImage(imgIRequest* aImage, uint32_t aFlags = 0) = 0;
|
||||
|
||||
// Makes the images on this document locked/unlocked. By default, the locking
|
||||
// state is unlocked/false.
|
||||
|
@ -8424,7 +8424,7 @@ nsDocument::NotifyAudioAvailableListener()
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDocument::RemoveImage(imgIRequest* aImage)
|
||||
nsDocument::RemoveImage(imgIRequest* aImage, uint32_t aFlags)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aImage);
|
||||
|
||||
@ -8460,10 +8460,12 @@ nsDocument::RemoveImage(imgIRequest* aImage)
|
||||
rv = NS_SUCCEEDED(rv) ? rv2 : rv;
|
||||
}
|
||||
|
||||
// Request that the image be discarded if nobody else holds a lock on it.
|
||||
// Do this even if !mLockingImages, because even if we didn't just unlock
|
||||
// this image, it might still be a candidate for discarding.
|
||||
aImage->RequestDiscard();
|
||||
if (aFlags & REQUEST_DISCARD) {
|
||||
// Request that the image be discarded if nobody else holds a lock on it.
|
||||
// Do this even if !mLockingImages, because even if we didn't just unlock
|
||||
// this image, it might still be a candidate for discarding.
|
||||
aImage->RequestDiscard();
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -915,7 +915,7 @@ public:
|
||||
virtual Element *LookupImageElement(const nsAString& aElementId);
|
||||
|
||||
virtual NS_HIDDEN_(nsresult) AddImage(imgIRequest* aImage);
|
||||
virtual NS_HIDDEN_(nsresult) RemoveImage(imgIRequest* aImage);
|
||||
virtual NS_HIDDEN_(nsresult) RemoveImage(imgIRequest* aImage, uint32_t aFlags);
|
||||
virtual NS_HIDDEN_(nsresult) SetImageLockingState(bool aLocked);
|
||||
|
||||
// AddPlugin adds a plugin-related element to mPlugins when the element is
|
||||
|
@ -1183,9 +1183,9 @@ nsImageLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
pusher.PushNull();
|
||||
|
||||
if (mCurrentRequestFlags & REQUEST_SHOULD_BE_TRACKED)
|
||||
doc->RemoveImage(mCurrentRequest);
|
||||
doc->RemoveImage(mCurrentRequest, nsIDocument::REQUEST_DISCARD);
|
||||
if (mPendingRequestFlags & REQUEST_SHOULD_BE_TRACKED)
|
||||
doc->RemoveImage(mPendingRequest);
|
||||
doc->RemoveImage(mPendingRequest, nsIDocument::REQUEST_DISCARD);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -1227,7 +1227,7 @@ nsImageLoadingContent::UntrackImage(imgIRequest* aImage)
|
||||
// all locked images on destruction.
|
||||
nsIDocument* doc = GetOurCurrentDoc();
|
||||
if (doc)
|
||||
return doc->RemoveImage(aImage);
|
||||
return doc->RemoveImage(aImage, nsIDocument::REQUEST_DISCARD);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -580,7 +580,7 @@ nsStyleBorder::UntrackImage(nsPresContext* aContext)
|
||||
// Unregister the image with the document
|
||||
nsIDocument* doc = aContext->Document();
|
||||
if (doc)
|
||||
doc->RemoveImage(mBorderImageSource);
|
||||
doc->RemoveImage(mBorderImageSource, nsIDocument::REQUEST_DISCARD);
|
||||
|
||||
// Mark state
|
||||
#ifdef DEBUG
|
||||
@ -1507,7 +1507,7 @@ nsStyleImage::UntrackImage(nsPresContext* aContext)
|
||||
// Unregister the image with the document
|
||||
nsIDocument* doc = aContext->Document();
|
||||
if (doc)
|
||||
doc->RemoveImage(mImage);
|
||||
doc->RemoveImage(mImage, nsIDocument::REQUEST_DISCARD);
|
||||
|
||||
// Mark state
|
||||
#ifdef DEBUG
|
||||
@ -2408,7 +2408,7 @@ nsStyleContentData::UntrackImage(nsPresContext* aContext)
|
||||
// Unregister the image with the document
|
||||
nsIDocument* doc = aContext->Document();
|
||||
if (doc)
|
||||
doc->RemoveImage(mContent.mImage);
|
||||
doc->RemoveImage(mContent.mImage, nsIDocument::REQUEST_DISCARD);
|
||||
|
||||
// Mark state
|
||||
#ifdef DEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user