From fcda375530ac167ff6e17911374e22461ab53843 Mon Sep 17 00:00:00 2001 From: Joe Drew Date: Thu, 7 Feb 2013 17:22:38 -0500 Subject: [PATCH] Bug 716140 - Handle discarding specially so it gets notified synchronously. r=seth --HG-- extra : rebase_source : 1bd66dcec4925b486af0905dbd07286bb3ae729e --- image/src/RasterImage.cpp | 2 +- image/src/imgStatusTracker.cpp | 12 ++++++++++++ image/src/imgStatusTracker.h | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index 04f3175a30f7..8097cc0e874b 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -2504,7 +2504,7 @@ RasterImage::Discard(bool force) // Notify that we discarded if (mStatusTracker) - mStatusTracker->GetDecoderObserver()->OnDiscard(); + mStatusTracker->OnDiscard(); if (force) DiscardTracker::Remove(&mDiscardTrackerNode); diff --git a/image/src/imgStatusTracker.cpp b/image/src/imgStatusTracker.cpp index 7f4b377c0c8b..41e6d16608f3 100644 --- a/image/src/imgStatusTracker.cpp +++ b/image/src/imgStatusTracker.cpp @@ -849,6 +849,18 @@ imgStatusTracker::OnStopRequest(bool aLastPart, } } +void +imgStatusTracker::OnDiscard() +{ + RecordDiscard(); + + /* notify the kids */ + nsTObserverArray::ForwardIterator iter(mConsumers); + while (iter.HasMore()) { + SendDiscard(iter.GetNext()); + } +} + void imgStatusTracker::OnDataAvailable() { diff --git a/image/src/imgStatusTracker.h b/image/src/imgStatusTracker.h index cce494a9e391..10c0f80d858a 100644 --- a/image/src/imgStatusTracker.h +++ b/image/src/imgStatusTracker.h @@ -160,6 +160,7 @@ public: void OnStartRequest(); void OnDataAvailable(); void OnStopRequest(bool aLastPart, nsresult aStatus); + void OnDiscard(); /* non-virtual imgIOnloadBlocker methods */ // NB: If UnblockOnload is sent, and then we are asked to replay the