mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 942164 - Refcount imgRequest consumers. r=seth
This commit is contained in:
parent
3b392e4a53
commit
6a2d35f8af
@ -637,7 +637,7 @@ NS_IMETHODIMP imgRequest::OnStartRequest(nsIRequest *aRequest, nsISupports *ctxt
|
|||||||
PR_LOG(GetImgLog(), PR_LOG_WARNING,
|
PR_LOG(GetImgLog(), PR_LOG_WARNING,
|
||||||
("[this=%p] imgRequest::OnStartRequest -- "
|
("[this=%p] imgRequest::OnStartRequest -- "
|
||||||
"RetargetDeliveryTo rv %d=%s\n",
|
"RetargetDeliveryTo rv %d=%s\n",
|
||||||
this, NS_SUCCEEDED(rv) ? "succeeded" : "failed", rv));
|
this, rv, NS_SUCCEEDED(rv) ? "succeeded" : "failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -357,7 +357,7 @@ imgStatusTracker::NotifyCurrentState(imgRequestProxy* proxy)
|
|||||||
|
|
||||||
#define NOTIFY_IMAGE_OBSERVERS(func) \
|
#define NOTIFY_IMAGE_OBSERVERS(func) \
|
||||||
do { \
|
do { \
|
||||||
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(proxies); \
|
nsTObserverArray<nsRefPtr<imgRequestProxy> >::ForwardIterator iter(proxies); \
|
||||||
while (iter.HasMore()) { \
|
while (iter.HasMore()) { \
|
||||||
nsRefPtr<imgRequestProxy> proxy = iter.GetNext(); \
|
nsRefPtr<imgRequestProxy> proxy = iter.GetNext(); \
|
||||||
if (!proxy->NotificationsDeferred()) { \
|
if (!proxy->NotificationsDeferred()) { \
|
||||||
@ -367,7 +367,7 @@ imgStatusTracker::NotifyCurrentState(imgRequestProxy* proxy)
|
|||||||
} while (false);
|
} while (false);
|
||||||
|
|
||||||
/* static */ void
|
/* static */ void
|
||||||
imgStatusTracker::SyncNotifyState(nsTObserverArray<imgRequestProxy*>& proxies,
|
imgStatusTracker::SyncNotifyState(nsTObserverArray<nsRefPtr<imgRequestProxy> >& proxies,
|
||||||
bool hasImage, uint32_t state,
|
bool hasImage, uint32_t state,
|
||||||
nsIntRect& dirtyRect, bool hadLastPart)
|
nsIntRect& dirtyRect, bool hadLastPart)
|
||||||
{
|
{
|
||||||
@ -505,7 +505,7 @@ imgStatusTracker::SyncNotifyDifference(const ImageStatusDiff& diff)
|
|||||||
mInvalidRect.SetEmpty();
|
mInvalidRect.SetEmpty();
|
||||||
|
|
||||||
if (diff.unblockedOnload) {
|
if (diff.unblockedOnload) {
|
||||||
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mConsumers);
|
nsTObserverArray<nsRefPtr<imgRequestProxy> >::ForwardIterator iter(mConsumers);
|
||||||
while (iter.HasMore()) {
|
while (iter.HasMore()) {
|
||||||
// Hold on to a reference to this proxy, since notifying the state can
|
// Hold on to a reference to this proxy, since notifying the state can
|
||||||
// cause it to disappear.
|
// cause it to disappear.
|
||||||
@ -550,7 +550,7 @@ imgStatusTracker::SyncNotify(imgRequestProxy* proxy)
|
|||||||
r = mImage->FrameRect(imgIContainer::FRAME_CURRENT);
|
r = mImage->FrameRect(imgIContainer::FRAME_CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsTObserverArray<imgRequestProxy*> array;
|
nsTObserverArray<nsRefPtr<imgRequestProxy> > array;
|
||||||
array.AppendElement(proxy);
|
array.AppendElement(proxy);
|
||||||
SyncNotifyState(array, !!mImage, mState, r, mHadLastPart);
|
SyncNotifyState(array, !!mImage, mState, r, mHadLastPart);
|
||||||
}
|
}
|
||||||
@ -781,7 +781,7 @@ imgStatusTracker::OnUnlockedDraw()
|
|||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
RecordUnlockedDraw();
|
RecordUnlockedDraw();
|
||||||
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mConsumers);
|
nsTObserverArray<nsRefPtr<imgRequestProxy> >::ForwardIterator iter(mConsumers);
|
||||||
while (iter.HasMore()) {
|
while (iter.HasMore()) {
|
||||||
SendUnlockedDraw(iter.GetNext());
|
SendUnlockedDraw(iter.GetNext());
|
||||||
}
|
}
|
||||||
@ -838,7 +838,7 @@ imgStatusTracker::OnStartRequest()
|
|||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
RecordStartRequest();
|
RecordStartRequest();
|
||||||
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mConsumers);
|
nsTObserverArray<nsRefPtr<imgRequestProxy> >::ForwardIterator iter(mConsumers);
|
||||||
while (iter.HasMore()) {
|
while (iter.HasMore()) {
|
||||||
SendStartRequest(iter.GetNext());
|
SendStartRequest(iter.GetNext());
|
||||||
}
|
}
|
||||||
@ -909,7 +909,7 @@ imgStatusTracker::OnStopRequest(bool aLastPart,
|
|||||||
|
|
||||||
RecordStopRequest(aLastPart, aStatus);
|
RecordStopRequest(aLastPart, aStatus);
|
||||||
/* notify the kids */
|
/* notify the kids */
|
||||||
nsTObserverArray<imgRequestProxy*>::ForwardIterator srIter(mConsumers);
|
nsTObserverArray<nsRefPtr<imgRequestProxy> >::ForwardIterator srIter(mConsumers);
|
||||||
while (srIter.HasMore()) {
|
while (srIter.HasMore()) {
|
||||||
SendStopRequest(srIter.GetNext(), aLastPart, aStatus);
|
SendStopRequest(srIter.GetNext(), aLastPart, aStatus);
|
||||||
}
|
}
|
||||||
@ -926,7 +926,7 @@ imgStatusTracker::OnDiscard()
|
|||||||
RecordDiscard();
|
RecordDiscard();
|
||||||
|
|
||||||
/* notify the kids */
|
/* notify the kids */
|
||||||
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mConsumers);
|
nsTObserverArray<nsRefPtr<imgRequestProxy> >::ForwardIterator iter(mConsumers);
|
||||||
while (iter.HasMore()) {
|
while (iter.HasMore()) {
|
||||||
SendDiscard(iter.GetNext());
|
SendDiscard(iter.GetNext());
|
||||||
}
|
}
|
||||||
@ -939,7 +939,7 @@ imgStatusTracker::FrameChanged(const nsIntRect* aDirtyRect)
|
|||||||
RecordFrameChanged(aDirtyRect);
|
RecordFrameChanged(aDirtyRect);
|
||||||
|
|
||||||
/* notify the kids */
|
/* notify the kids */
|
||||||
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mConsumers);
|
nsTObserverArray<nsRefPtr<imgRequestProxy> >::ForwardIterator iter(mConsumers);
|
||||||
while (iter.HasMore()) {
|
while (iter.HasMore()) {
|
||||||
SendFrameChanged(iter.GetNext(), aDirtyRect);
|
SendFrameChanged(iter.GetNext(), aDirtyRect);
|
||||||
}
|
}
|
||||||
@ -952,7 +952,7 @@ imgStatusTracker::OnStopFrame()
|
|||||||
RecordStopFrame();
|
RecordStopFrame();
|
||||||
|
|
||||||
/* notify the kids */
|
/* notify the kids */
|
||||||
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mConsumers);
|
nsTObserverArray<nsRefPtr<imgRequestProxy> >::ForwardIterator iter(mConsumers);
|
||||||
while (iter.HasMore()) {
|
while (iter.HasMore()) {
|
||||||
SendStopFrame(iter.GetNext());
|
SendStopFrame(iter.GetNext());
|
||||||
}
|
}
|
||||||
@ -970,7 +970,7 @@ imgStatusTracker::OnDataAvailable()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Notify any imgRequestProxys that are observing us that we have an Image.
|
// Notify any imgRequestProxys that are observing us that we have an Image.
|
||||||
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mConsumers);
|
nsTObserverArray<nsRefPtr<imgRequestProxy> >::ForwardIterator iter(mConsumers);
|
||||||
while (iter.HasMore()) {
|
while (iter.HasMore()) {
|
||||||
iter.GetNext()->SetHasImage();
|
iter.GetNext()->SetHasImage();
|
||||||
}
|
}
|
||||||
@ -1021,7 +1021,7 @@ imgStatusTracker::MaybeUnblockOnload()
|
|||||||
|
|
||||||
RecordUnblockOnload();
|
RecordUnblockOnload();
|
||||||
|
|
||||||
nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mConsumers);
|
nsTObserverArray<nsRefPtr<imgRequestProxy> >::ForwardIterator iter(mConsumers);
|
||||||
while (iter.HasMore()) {
|
while (iter.HasMore()) {
|
||||||
SendUnblockOnload(iter.GetNext());
|
SendUnblockOnload(iter.GetNext());
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
class imgDecoderObserver;
|
class imgDecoderObserver;
|
||||||
class imgIContainer;
|
class imgIContainer;
|
||||||
class imgRequestProxy;
|
|
||||||
class imgStatusNotifyRunnable;
|
class imgStatusNotifyRunnable;
|
||||||
class imgRequestNotifyRunnable;
|
class imgRequestNotifyRunnable;
|
||||||
class imgStatusTrackerObserver;
|
class imgStatusTrackerObserver;
|
||||||
@ -21,6 +20,7 @@ class nsIRunnable;
|
|||||||
#include "nsTObserverArray.h"
|
#include "nsTObserverArray.h"
|
||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
#include "nsRect.h"
|
#include "nsRect.h"
|
||||||
|
#include "imgRequestProxy.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace image {
|
namespace image {
|
||||||
@ -306,7 +306,7 @@ private:
|
|||||||
|
|
||||||
// Main thread only, since imgRequestProxy calls are expected on the main
|
// Main thread only, since imgRequestProxy calls are expected on the main
|
||||||
// thread, and mConsumers is not threadsafe.
|
// thread, and mConsumers is not threadsafe.
|
||||||
static void SyncNotifyState(nsTObserverArray<imgRequestProxy*>& proxies,
|
static void SyncNotifyState(nsTObserverArray<nsRefPtr<imgRequestProxy> >& proxies,
|
||||||
bool hasImage, uint32_t state,
|
bool hasImage, uint32_t state,
|
||||||
nsIntRect& dirtyRect, bool hadLastPart);
|
nsIntRect& dirtyRect, bool hadLastPart);
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ private:
|
|||||||
// List of proxies attached to the image. Each proxy represents a consumer
|
// List of proxies attached to the image. Each proxy represents a consumer
|
||||||
// using the image. Array and/or individual elements should only be accessed
|
// using the image. Array and/or individual elements should only be accessed
|
||||||
// on the main thread.
|
// on the main thread.
|
||||||
nsTObserverArray<imgRequestProxy*> mConsumers;
|
nsTObserverArray<nsRefPtr<imgRequestProxy> > mConsumers;
|
||||||
|
|
||||||
mozilla::RefPtr<imgDecoderObserver> mTrackerObserver;
|
mozilla::RefPtr<imgDecoderObserver> mTrackerObserver;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user