Bug 799791: Remove unused boolean parameters and dead branches. r=jlebar

This commit is contained in:
Kyle Huey 2012-10-11 09:35:43 -07:00
Родитель f2a9cebf92
Коммит 27f7c5c4e0
5 изменённых файлов: 17 добавлений и 38 удалений

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

@ -200,7 +200,7 @@ void imgRequest::AddProxy(imgRequestProxy *proxy)
mObservers.AppendElementUnlessExists(proxy);
}
nsresult imgRequest::RemoveProxy(imgRequestProxy *proxy, nsresult aStatus, bool aNotify)
nsresult imgRequest::RemoveProxy(imgRequestProxy *proxy, nsresult aStatus)
{
LOG_SCOPE_WITH_PARAM(gImgLog, "imgRequest::RemoveProxy", "proxy", proxy);
@ -220,7 +220,7 @@ nsresult imgRequest::RemoveProxy(imgRequestProxy *proxy, nsresult aStatus, bool
// one it was in at this point.
imgStatusTracker& statusTracker = GetStatusTracker();
statusTracker.EmulateRequestFinished(proxy, aStatus, !aNotify);
statusTracker.EmulateRequestFinished(proxy, aStatus);
if (mObservers.IsEmpty()) {
// If we have no observers, there's nothing holding us alive. If we haven't

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

@ -67,8 +67,7 @@ public:
// Callers must call imgRequestProxy::Notify later.
void AddProxy(imgRequestProxy *proxy);
// aNotify==false still sends OnStopRequest.
nsresult RemoveProxy(imgRequestProxy *proxy, nsresult aStatus, bool aNotify);
nsresult RemoveProxy(imgRequestProxy *proxy, nsresult aStatus);
void SniffMimeType(const char *buf, uint32_t len, nsACString& newType);

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

@ -83,11 +83,8 @@ imgRequestProxy::~imgRequestProxy()
channel, if still downloading data, from being canceled if 'this' is
the last observer. This allows the image to continue to download and
be cached even if no one is using it currently.
Passing false to aNotify means that we will still get
OnStopRequest, if needed.
*/
mOwner->RemoveProxy(this, NS_OK, false);
mOwner->RemoveProxy(this, NS_OK);
}
}
}
@ -160,9 +157,7 @@ nsresult imgRequestProxy::ChangeOwner(imgRequest *aNewOwner)
wasDecoded = true;
}
// Passing false to aNotify means that mListener will still get
// OnStopRequest, if needed.
mOwner->RemoveProxy(this, NS_IMAGELIB_CHANGING_OWNER, false);
mOwner->RemoveProxy(this, NS_IMAGELIB_CHANGING_OWNER);
// If we had animation requests, restore them here. Note that we
// do this *after* RemoveProxy, which clears out animation consumers
@ -256,10 +251,9 @@ NS_IMETHODIMP imgRequestProxy::Cancel(nsresult status)
void
imgRequestProxy::DoCancel(nsresult status)
{
// Passing false to aNotify means that mListener will still get
// OnStopRequest, if needed.
if (mOwner)
mOwner->RemoveProxy(this, status, false);
if (mOwner) {
mOwner->RemoveProxy(this, status);
}
NullOutListener();
}
@ -284,10 +278,9 @@ NS_IMETHODIMP imgRequestProxy::CancelAndForgetObserver(nsresult aStatus)
bool oldIsInLoadGroup = mIsInLoadGroup;
mIsInLoadGroup = false;
// Passing false to aNotify means that mListener will still get
// OnStopRequest, if needed.
if (mOwner)
mOwner->RemoveProxy(this, aStatus, false);
if (mOwner) {
mOwner->RemoveProxy(this, aStatus);
}
mIsInLoadGroup = oldIsInLoadGroup;

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

@ -250,22 +250,11 @@ imgStatusTracker::SyncNotify(imgRequestProxy* proxy)
}
void
imgStatusTracker::EmulateRequestFinished(imgRequestProxy* aProxy, nsresult aStatus,
bool aOnlySendStopRequest)
imgStatusTracker::EmulateRequestFinished(imgRequestProxy* aProxy,
nsresult aStatus)
{
nsCOMPtr<imgIRequest> kungFuDeathGrip(aProxy);
if (!aOnlySendStopRequest) {
// The "real" OnStopDecode - fix this with bug 505385.
if (!(mState & stateDecodeStopped)) {
aProxy->OnStopContainer(mImage);
}
if (!(mState & stateRequestStopped)) {
aProxy->OnStopDecode(aStatus, nullptr);
}
}
if (mState & stateBlockingOnload) {
aProxy->UnblockOnload();
}

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

@ -80,12 +80,10 @@ public:
// OnStartRequest).
void SyncNotify(imgRequestProxy* proxy);
// Send all notifications that would be necessary to make |proxy| believe the
// request is finished downloading and decoding.
// If aOnlySendStopRequest is true, we will only send OnStopRequest, and then
// only if that is necessary.
void EmulateRequestFinished(imgRequestProxy* proxy, nsresult aStatus,
bool aOnlySendStopRequest);
// Send some notifications that would be necessary to make |proxy| believe
// the request is finished downloading and decoding. We only send
// OnStopRequest and UnblockOnload, and only if necessary.
void EmulateRequestFinished(imgRequestProxy* proxy, nsresult aStatus);
// Returns whether we are in the process of loading; that is, whether we have
// not received OnStopRequest.