void ProgressTracker::ResetForNewRequest() { MOZ_ASSERT(NS_IsMainThread()); mProgress = NoProgress; CheckProgressConsistency(mProgress); }
void ProgressTracker::SyncNotifyProgress(Progress aProgress, const nsIntRect& aInvalidRect /* = nsIntRect() */) { MOZ_ASSERT(NS_IsMainThread(), "Use mObservers on main thread only"); // Don't unblock onload if we're not blocked. Progress progress = Difference(aProgress); if (!((mProgress | progress) & FLAG_ONLOAD_BLOCKED)) { progress &= ~FLAG_ONLOAD_UNBLOCKED; } // XXX(seth): Hack to work around the fact that some observers have bugs and // need to get onload blocking notifications multiple times. We should fix // those observers and remove this. if ((aProgress & FLAG_DECODE_COMPLETE) && (mProgress & FLAG_ONLOAD_BLOCKED) && (mProgress & FLAG_ONLOAD_UNBLOCKED)) { progress |= FLAG_ONLOAD_BLOCKED | FLAG_ONLOAD_UNBLOCKED; } // Apply the changes. mProgress |= progress; CheckProgressConsistency(mProgress); // Send notifications. SyncNotifyInternal(mObservers, HasImage(), progress, aInvalidRect); if (progress & FLAG_HAS_ERROR) { FireFailureNotification(); } }
void ProgressTracker::ResetForNewRequest() { MOZ_ASSERT(NS_IsMainThread()); // We're starting a new load (and if this is called more than once, this is a // multipart request) so keep only the bits that carry over between loads. mProgress &= FLAG_IS_MULTIPART | FLAG_HAS_ERROR | FLAG_ONLOAD_BLOCKED | FLAG_ONLOAD_UNBLOCKED; CheckProgressConsistency(mProgress); }
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); }
void ProgressTracker::SyncNotifyProgress(Progress aProgress, const nsIntRect& aInvalidRect /* = nsIntRect() */) { MOZ_ASSERT(NS_IsMainThread(), "Use mConsumers on main thread only"); // Don't unblock onload if we're not blocked. Progress progress = Difference(aProgress); if (!((mProgress | progress) & FLAG_ONLOAD_BLOCKED)) { progress &= ~FLAG_ONLOAD_UNBLOCKED; } // Apply the changes. mProgress |= progress; CheckProgressConsistency(mProgress); // Send notifications. SyncNotifyInternal(mConsumers, !!mImage, progress, aInvalidRect); if (progress & FLAG_HAS_ERROR) { FireFailureNotification(); } }