Bug 1112972 (Part 5) - Remove almost all special handling of multipart images in ProgressTracker. r=tn

This commit is contained in:
Seth Fowler 2015-01-07 01:37:20 -08:00
Родитель fa7dbd3ca8
Коммит e77448413c
2 изменённых файлов: 4 добавлений и 39 удалений

Просмотреть файл

@ -63,17 +63,11 @@ CheckProgressConsistency(Progress aProgress)
// No preconditions.
}
if (aProgress & FLAG_ONLOAD_BLOCKED) {
if (aProgress & FLAG_IS_MULTIPART) {
MOZ_ASSERT(aProgress & FLAG_ONLOAD_UNBLOCKED);
} else {
MOZ_ASSERT(aProgress & FLAG_DECODE_STARTED);
}
MOZ_ASSERT(aProgress & FLAG_DECODE_STARTED);
}
if (aProgress & FLAG_ONLOAD_UNBLOCKED) {
MOZ_ASSERT(aProgress & FLAG_ONLOAD_BLOCKED);
MOZ_ASSERT(aProgress & (FLAG_FRAME_COMPLETE |
FLAG_IS_MULTIPART |
FLAG_HAS_ERROR));
MOZ_ASSERT(aProgress & (FLAG_FRAME_COMPLETE | FLAG_HAS_ERROR));
}
if (aProgress & FLAG_IS_ANIMATED) {
MOZ_ASSERT(aProgress & FLAG_DECODE_STARTED);
@ -82,9 +76,6 @@ CheckProgressConsistency(Progress aProgress)
if (aProgress & FLAG_HAS_TRANSPARENCY) {
MOZ_ASSERT(aProgress & FLAG_SIZE_AVAILABLE);
}
if (aProgress & FLAG_IS_MULTIPART) {
// No preconditions.
}
if (aProgress & FLAG_LAST_PART_COMPLETE) {
MOZ_ASSERT(aProgress & FLAG_LOAD_COMPLETE);
}
@ -108,22 +99,6 @@ ProgressTracker::ResetImage()
mImage = nullptr;
}
void
ProgressTracker::SetIsMultipart()
{
if (mProgress & FLAG_IS_MULTIPART) {
return;
}
MOZ_ASSERT(!(mProgress & FLAG_ONLOAD_BLOCKED),
"Blocked onload before we knew we were multipart?");
// Set the MULTIPART flag and ensure that we never block onload.
mProgress |= FLAG_IS_MULTIPART | FLAG_ONLOAD_BLOCKED | FLAG_ONLOAD_UNBLOCKED;
CheckProgressConsistency(mProgress);
}
bool
ProgressTracker::IsLoading() const
{

Просмотреть файл

@ -36,9 +36,8 @@ enum {
FLAG_ONLOAD_UNBLOCKED = 1u << 6,
FLAG_IS_ANIMATED = 1u << 7, // STATUS_IS_ANIMATED
FLAG_HAS_TRANSPARENCY = 1u << 8, // STATUS_HAS_TRANSPARENCY
FLAG_IS_MULTIPART = 1u << 9,
FLAG_LAST_PART_COMPLETE = 1u << 10,
FLAG_HAS_ERROR = 1u << 11 // STATUS_ERROR
FLAG_LAST_PART_COMPLETE = 1u << 9,
FLAG_HAS_ERROR = 1u << 10 // STATUS_ERROR
};
typedef uint32_t Progress;
@ -89,9 +88,6 @@ public:
return image.forget();
}
// Informs this ProgressTracker that it's associated with a multipart image.
void SetIsMultipart();
// Returns whether we are in the process of loading; that is, whether we have
// not received OnStopRequest from Necko.
bool IsLoading() const;
@ -167,12 +163,6 @@ public:
// probably be improved, but it's too scary to mess with at the moment.
bool FirstObserverIs(IProgressObserver* aObserver);
void AdoptObservers(ProgressTracker* aTracker) {
MOZ_ASSERT(NS_IsMainThread(), "Use mObservers on main thread only");
MOZ_ASSERT(aTracker);
mObservers = aTracker->mObservers;
}
private:
typedef nsTObserverArray<mozilla::WeakPtr<IProgressObserver>> ObserverArray;
friend class AsyncNotifyRunnable;