mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1098202 (Part 2) - Rename Progress flags to be consistent with the corresponding notifications. r=tn
--HG-- extra : rebase_source : 9a8c0c3efe55a459c5a9a687e94a7861eb44bc35
This commit is contained in:
parent
8272e602b4
commit
a5a4994677
@ -177,7 +177,7 @@ Decoder::Finish(RasterImage::eShutdownIntent aShutdownIntent)
|
||||
PostDecodeDone();
|
||||
} else {
|
||||
if (!IsSizeDecode()) {
|
||||
mProgress |= FLAG_DECODE_STOPPED | FLAG_ONLOAD_UNBLOCKED;
|
||||
mProgress |= FLAG_DECODE_COMPLETE | FLAG_ONLOAD_UNBLOCKED;
|
||||
}
|
||||
mProgress |= FLAG_HAS_ERROR;
|
||||
}
|
||||
@ -281,7 +281,7 @@ Decoder::PostSize(int32_t aWidth,
|
||||
mImageMetadata.SetSize(aWidth, aHeight, aOrientation);
|
||||
|
||||
// Record this notification.
|
||||
mProgress |= FLAG_HAS_SIZE;
|
||||
mProgress |= FLAG_SIZE_AVAILABLE;
|
||||
}
|
||||
|
||||
void
|
||||
@ -336,7 +336,7 @@ Decoder::PostFrameStop(FrameBlender::FrameAlpha aFrameAlpha /* = FrameBlender::k
|
||||
mCurrentFrame->SetBlendMethod(aBlendMethod);
|
||||
mCurrentFrame->ImageUpdated(mCurrentFrame->GetRect());
|
||||
|
||||
mProgress |= FLAG_FRAME_STOPPED | FLAG_ONLOAD_UNBLOCKED;
|
||||
mProgress |= FLAG_FRAME_COMPLETE | FLAG_ONLOAD_UNBLOCKED;
|
||||
}
|
||||
|
||||
void
|
||||
@ -362,7 +362,7 @@ Decoder::PostDecodeDone(int32_t aLoopCount /* = 0 */)
|
||||
mImageMetadata.SetLoopCount(aLoopCount);
|
||||
mImageMetadata.SetIsNonPremultiplied(GetDecodeFlags() & DECODER_NO_PREMULTIPLY_ALPHA);
|
||||
|
||||
mProgress |= FLAG_DECODE_STOPPED;
|
||||
mProgress |= FLAG_DECODE_COMPLETE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -46,19 +46,19 @@ CheckProgressConsistency(Progress aProgress)
|
||||
{
|
||||
// Check preconditions for every progress bit.
|
||||
|
||||
if (aProgress & FLAG_HAS_SIZE) {
|
||||
if (aProgress & FLAG_SIZE_AVAILABLE) {
|
||||
// No preconditions.
|
||||
}
|
||||
if (aProgress & FLAG_DECODE_STARTED) {
|
||||
// No preconditions.
|
||||
}
|
||||
if (aProgress & FLAG_DECODE_STOPPED) {
|
||||
if (aProgress & FLAG_DECODE_COMPLETE) {
|
||||
MOZ_ASSERT(aProgress & FLAG_DECODE_STARTED);
|
||||
}
|
||||
if (aProgress & FLAG_FRAME_STOPPED) {
|
||||
if (aProgress & FLAG_FRAME_COMPLETE) {
|
||||
MOZ_ASSERT(aProgress & FLAG_DECODE_STARTED);
|
||||
}
|
||||
if (aProgress & FLAG_REQUEST_STOPPED) {
|
||||
if (aProgress & FLAG_LOAD_COMPLETE) {
|
||||
// No preconditions.
|
||||
}
|
||||
if (aProgress & FLAG_ONLOAD_BLOCKED) {
|
||||
@ -70,23 +70,23 @@ CheckProgressConsistency(Progress aProgress)
|
||||
}
|
||||
if (aProgress & FLAG_ONLOAD_UNBLOCKED) {
|
||||
MOZ_ASSERT(aProgress & FLAG_ONLOAD_BLOCKED);
|
||||
MOZ_ASSERT(aProgress & (FLAG_FRAME_STOPPED |
|
||||
MOZ_ASSERT(aProgress & (FLAG_FRAME_COMPLETE |
|
||||
FLAG_IS_MULTIPART |
|
||||
FLAG_HAS_ERROR));
|
||||
}
|
||||
if (aProgress & FLAG_IS_ANIMATED) {
|
||||
MOZ_ASSERT(aProgress & FLAG_DECODE_STARTED);
|
||||
MOZ_ASSERT(aProgress & FLAG_HAS_SIZE);
|
||||
MOZ_ASSERT(aProgress & FLAG_SIZE_AVAILABLE);
|
||||
}
|
||||
if (aProgress & FLAG_HAS_TRANSPARENCY) {
|
||||
MOZ_ASSERT(aProgress & FLAG_DECODE_STARTED);
|
||||
MOZ_ASSERT(aProgress & FLAG_HAS_SIZE);
|
||||
MOZ_ASSERT(aProgress & FLAG_SIZE_AVAILABLE);
|
||||
}
|
||||
if (aProgress & FLAG_IS_MULTIPART) {
|
||||
// No preconditions.
|
||||
}
|
||||
if (aProgress & FLAG_MULTIPART_STOPPED) {
|
||||
MOZ_ASSERT(aProgress & FLAG_REQUEST_STOPPED);
|
||||
if (aProgress & FLAG_LAST_PART_COMPLETE) {
|
||||
MOZ_ASSERT(aProgress & FLAG_LOAD_COMPLETE);
|
||||
}
|
||||
if (aProgress & FLAG_HAS_ERROR) {
|
||||
// No preconditions.
|
||||
@ -129,7 +129,7 @@ ProgressTracker::IsLoading() const
|
||||
// Checking for whether OnStopRequest has fired allows us to say we're
|
||||
// loading before OnStartRequest gets called, letting the request properly
|
||||
// get removed from the cache in certain cases.
|
||||
return !(mProgress & FLAG_REQUEST_STOPPED);
|
||||
return !(mProgress & FLAG_LOAD_COMPLETE);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
@ -138,19 +138,19 @@ ProgressTracker::GetImageStatus() const
|
||||
uint32_t status = imgIRequest::STATUS_NONE;
|
||||
|
||||
// Translate our current state to a set of imgIRequest::STATE_* flags.
|
||||
if (mProgress & FLAG_HAS_SIZE) {
|
||||
if (mProgress & FLAG_SIZE_AVAILABLE) {
|
||||
status |= imgIRequest::STATUS_SIZE_AVAILABLE;
|
||||
}
|
||||
if (mProgress & FLAG_DECODE_STARTED) {
|
||||
status |= imgIRequest::STATUS_DECODE_STARTED;
|
||||
}
|
||||
if (mProgress & FLAG_DECODE_STOPPED) {
|
||||
if (mProgress & FLAG_DECODE_COMPLETE) {
|
||||
status |= imgIRequest::STATUS_DECODE_COMPLETE;
|
||||
}
|
||||
if (mProgress & FLAG_FRAME_STOPPED) {
|
||||
if (mProgress & FLAG_FRAME_COMPLETE) {
|
||||
status |= imgIRequest::STATUS_FRAME_COMPLETE;
|
||||
}
|
||||
if (mProgress & FLAG_REQUEST_STOPPED) {
|
||||
if (mProgress & FLAG_LOAD_COMPLETE) {
|
||||
status |= imgIRequest::STATUS_LOAD_COMPLETE;
|
||||
}
|
||||
if (mProgress & FLAG_HAS_ERROR) {
|
||||
@ -306,7 +306,7 @@ ProgressTracker::SyncNotifyInternal(ProxyArray& aProxies,
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (aProgress & FLAG_HAS_SIZE)
|
||||
if (aProgress & FLAG_SIZE_AVAILABLE)
|
||||
NOTIFY_IMAGE_OBSERVERS(aProxies, OnSizeAvailable());
|
||||
|
||||
if (aProgress & FLAG_DECODE_STARTED)
|
||||
@ -323,7 +323,7 @@ ProgressTracker::SyncNotifyInternal(ProxyArray& aProxies,
|
||||
if (!aDirtyRect.IsEmpty())
|
||||
NOTIFY_IMAGE_OBSERVERS(aProxies, OnFrameUpdate(&aDirtyRect));
|
||||
|
||||
if (aProgress & FLAG_FRAME_STOPPED)
|
||||
if (aProgress & FLAG_FRAME_COMPLETE)
|
||||
NOTIFY_IMAGE_OBSERVERS(aProxies, OnFrameComplete());
|
||||
|
||||
if (aProgress & FLAG_HAS_TRANSPARENCY)
|
||||
@ -340,14 +340,14 @@ ProgressTracker::SyncNotifyInternal(ProxyArray& aProxies,
|
||||
NOTIFY_IMAGE_OBSERVERS(aProxies, UnblockOnload());
|
||||
}
|
||||
|
||||
if (aProgress & FLAG_DECODE_STOPPED) {
|
||||
if (aProgress & FLAG_DECODE_COMPLETE) {
|
||||
MOZ_ASSERT(aHasImage, "Stopped decoding without ever having an image?");
|
||||
NOTIFY_IMAGE_OBSERVERS(aProxies, OnDecodeComplete());
|
||||
}
|
||||
|
||||
if (aProgress & FLAG_REQUEST_STOPPED) {
|
||||
if (aProgress & FLAG_LOAD_COMPLETE) {
|
||||
NOTIFY_IMAGE_OBSERVERS(aProxies,
|
||||
OnLoadComplete(aProgress & FLAG_MULTIPART_STOPPED));
|
||||
OnLoadComplete(aProgress & FLAG_LAST_PART_COMPLETE));
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ ProgressTracker::EmulateRequestFinished(imgRequestProxy* aProxy,
|
||||
aProxy->UnblockOnload();
|
||||
}
|
||||
|
||||
if (!(mProgress & FLAG_REQUEST_STOPPED)) {
|
||||
if (!(mProgress & FLAG_LOAD_COMPLETE)) {
|
||||
aProxy->OnLoadComplete(true);
|
||||
}
|
||||
}
|
||||
|
@ -27,17 +27,17 @@ class Image;
|
||||
|
||||
// Image progress bitflags.
|
||||
enum {
|
||||
FLAG_HAS_SIZE = 1u << 0, // STATUS_SIZE_AVAILABLE
|
||||
FLAG_SIZE_AVAILABLE = 1u << 0, // STATUS_SIZE_AVAILABLE
|
||||
FLAG_DECODE_STARTED = 1u << 1, // STATUS_DECODE_STARTED
|
||||
FLAG_DECODE_STOPPED = 1u << 2, // STATUS_DECODE_COMPLETE
|
||||
FLAG_FRAME_STOPPED = 1u << 3, // STATUS_FRAME_COMPLETE
|
||||
FLAG_REQUEST_STOPPED = 1u << 4, // STATUS_LOAD_COMPLETE
|
||||
FLAG_DECODE_COMPLETE = 1u << 2, // STATUS_DECODE_COMPLETE
|
||||
FLAG_FRAME_COMPLETE = 1u << 3, // STATUS_FRAME_COMPLETE
|
||||
FLAG_LOAD_COMPLETE = 1u << 4, // STATUS_LOAD_COMPLETE
|
||||
FLAG_ONLOAD_BLOCKED = 1u << 5,
|
||||
FLAG_ONLOAD_UNBLOCKED = 1u << 6,
|
||||
FLAG_IS_ANIMATED = 1u << 7,
|
||||
FLAG_HAS_TRANSPARENCY = 1u << 8,
|
||||
FLAG_IS_MULTIPART = 1u << 9,
|
||||
FLAG_MULTIPART_STOPPED = 1u << 10,
|
||||
FLAG_LAST_PART_COMPLETE = 1u << 10,
|
||||
FLAG_HAS_ERROR = 1u << 11 // STATUS_ERROR
|
||||
};
|
||||
|
||||
@ -45,13 +45,13 @@ typedef uint32_t Progress;
|
||||
|
||||
const uint32_t NoProgress = 0;
|
||||
|
||||
inline Progress OnStopRequestProgress(bool aLastPart,
|
||||
bool aError,
|
||||
nsresult aStatus)
|
||||
inline Progress LoadCompleteProgress(bool aLastPart,
|
||||
bool aError,
|
||||
nsresult aStatus)
|
||||
{
|
||||
Progress progress = FLAG_REQUEST_STOPPED;
|
||||
Progress progress = FLAG_LOAD_COMPLETE;
|
||||
if (aLastPart) {
|
||||
progress |= FLAG_MULTIPART_STOPPED;
|
||||
progress |= FLAG_LAST_PART_COMPLETE;
|
||||
}
|
||||
if (NS_FAILED(aStatus) || aError) {
|
||||
progress |= FLAG_HAS_ERROR;
|
||||
|
@ -1679,7 +1679,7 @@ RasterImage::OnImageDataComplete(nsIRequest*, nsISupports*, nsresult aStatus, bo
|
||||
ReentrantMonitorAutoEnter lock(mDecodingMonitor);
|
||||
FinishedSomeDecoding(eShutdownIntent_Done,
|
||||
nullptr,
|
||||
OnStopRequestProgress(aLastPart, mError, finalStatus));
|
||||
LoadCompleteProgress(aLastPart, mError, finalStatus));
|
||||
}
|
||||
|
||||
return finalStatus;
|
||||
|
@ -442,9 +442,9 @@ VectorImage::OnImageDataComplete(nsIRequest* aRequest,
|
||||
|
||||
// Actually fire OnStopRequest.
|
||||
if (mProgressTracker) {
|
||||
mProgressTracker->SyncNotifyProgress(OnStopRequestProgress(aLastPart,
|
||||
mError,
|
||||
finalStatus));
|
||||
mProgressTracker->SyncNotifyProgress(LoadCompleteProgress(aLastPart,
|
||||
mError,
|
||||
finalStatus));
|
||||
}
|
||||
return finalStatus;
|
||||
}
|
||||
@ -566,7 +566,7 @@ VectorImage::SendInvalidationNotifications()
|
||||
|
||||
if (mProgressTracker) {
|
||||
SurfaceCache::Discard(this);
|
||||
mProgressTracker->SyncNotifyProgress(FLAG_FRAME_STOPPED,
|
||||
mProgressTracker->SyncNotifyProgress(FLAG_FRAME_COMPLETE,
|
||||
nsIntRect::GetMaxSizedIntRect());
|
||||
}
|
||||
}
|
||||
@ -1110,10 +1110,10 @@ VectorImage::OnSVGDocumentLoaded()
|
||||
|
||||
// Tell *our* observers that we're done loading.
|
||||
if (mProgressTracker) {
|
||||
mProgressTracker->SyncNotifyProgress(FLAG_HAS_SIZE |
|
||||
mProgressTracker->SyncNotifyProgress(FLAG_SIZE_AVAILABLE |
|
||||
FLAG_HAS_TRANSPARENCY |
|
||||
FLAG_FRAME_STOPPED |
|
||||
FLAG_DECODE_STOPPED |
|
||||
FLAG_FRAME_COMPLETE |
|
||||
FLAG_DECODE_COMPLETE |
|
||||
FLAG_ONLOAD_UNBLOCKED,
|
||||
nsIntRect::GetMaxSizedIntRect());
|
||||
}
|
||||
@ -1133,7 +1133,7 @@ VectorImage::OnSVGDocumentError()
|
||||
|
||||
if (mProgressTracker) {
|
||||
// Unblock page load.
|
||||
mProgressTracker->SyncNotifyProgress(FLAG_DECODE_STOPPED |
|
||||
mProgressTracker->SyncNotifyProgress(FLAG_DECODE_COMPLETE |
|
||||
FLAG_ONLOAD_UNBLOCKED |
|
||||
FLAG_HAS_ERROR);
|
||||
}
|
||||
|
@ -792,7 +792,7 @@ NS_IMETHODIMP imgRequest::OnStopRequest(nsIRequest *aRequest, nsISupports *ctxt,
|
||||
// We have to fire the OnStopRequest notifications ourselves because there's
|
||||
// no image capable of doing so.
|
||||
Progress progress =
|
||||
OnStopRequestProgress(lastPart, /* aError = */ false, status);
|
||||
LoadCompleteProgress(lastPart, /* aError = */ false, status);
|
||||
|
||||
nsRefPtr<ProgressTracker> progressTracker = GetProgressTracker();
|
||||
progressTracker->SyncNotifyProgress(progress);
|
||||
|
@ -92,7 +92,7 @@ NS_IMETHODIMP imgTools::DecodeImage(nsIInputStream* aInStr,
|
||||
|
||||
// Let the Image know we've sent all the data.
|
||||
rv = image->OnImageDataComplete(nullptr, nullptr, NS_OK, true);
|
||||
tracker->SyncNotifyProgress(FLAG_REQUEST_STOPPED);
|
||||
tracker->SyncNotifyProgress(FLAG_LOAD_COMPLETE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// All done.
|
||||
|
Loading…
Reference in New Issue
Block a user