зеркало из https://github.com/mozilla/gecko-dev.git
Bug 799791: Remove unused boolean parameters and dead branches. r=jlebar
This commit is contained in:
Родитель
f2a9cebf92
Коммит
27f7c5c4e0
|
@ -200,7 +200,7 @@ void imgRequest::AddProxy(imgRequestProxy *proxy)
|
||||||
mObservers.AppendElementUnlessExists(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);
|
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.
|
// one it was in at this point.
|
||||||
|
|
||||||
imgStatusTracker& statusTracker = GetStatusTracker();
|
imgStatusTracker& statusTracker = GetStatusTracker();
|
||||||
statusTracker.EmulateRequestFinished(proxy, aStatus, !aNotify);
|
statusTracker.EmulateRequestFinished(proxy, aStatus);
|
||||||
|
|
||||||
if (mObservers.IsEmpty()) {
|
if (mObservers.IsEmpty()) {
|
||||||
// If we have no observers, there's nothing holding us alive. If we haven't
|
// 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.
|
// Callers must call imgRequestProxy::Notify later.
|
||||||
void AddProxy(imgRequestProxy *proxy);
|
void AddProxy(imgRequestProxy *proxy);
|
||||||
|
|
||||||
// aNotify==false still sends OnStopRequest.
|
nsresult RemoveProxy(imgRequestProxy *proxy, nsresult aStatus);
|
||||||
nsresult RemoveProxy(imgRequestProxy *proxy, nsresult aStatus, bool aNotify);
|
|
||||||
|
|
||||||
void SniffMimeType(const char *buf, uint32_t len, nsACString& newType);
|
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
|
channel, if still downloading data, from being canceled if 'this' is
|
||||||
the last observer. This allows the image to continue to download and
|
the last observer. This allows the image to continue to download and
|
||||||
be cached even if no one is using it currently.
|
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;
|
wasDecoded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Passing false to aNotify means that mListener will still get
|
mOwner->RemoveProxy(this, NS_IMAGELIB_CHANGING_OWNER);
|
||||||
// OnStopRequest, if needed.
|
|
||||||
mOwner->RemoveProxy(this, NS_IMAGELIB_CHANGING_OWNER, false);
|
|
||||||
|
|
||||||
// If we had animation requests, restore them here. Note that we
|
// If we had animation requests, restore them here. Note that we
|
||||||
// do this *after* RemoveProxy, which clears out animation consumers
|
// do this *after* RemoveProxy, which clears out animation consumers
|
||||||
|
@ -256,10 +251,9 @@ NS_IMETHODIMP imgRequestProxy::Cancel(nsresult status)
|
||||||
void
|
void
|
||||||
imgRequestProxy::DoCancel(nsresult status)
|
imgRequestProxy::DoCancel(nsresult status)
|
||||||
{
|
{
|
||||||
// Passing false to aNotify means that mListener will still get
|
if (mOwner) {
|
||||||
// OnStopRequest, if needed.
|
mOwner->RemoveProxy(this, status);
|
||||||
if (mOwner)
|
}
|
||||||
mOwner->RemoveProxy(this, status, false);
|
|
||||||
|
|
||||||
NullOutListener();
|
NullOutListener();
|
||||||
}
|
}
|
||||||
|
@ -284,10 +278,9 @@ NS_IMETHODIMP imgRequestProxy::CancelAndForgetObserver(nsresult aStatus)
|
||||||
bool oldIsInLoadGroup = mIsInLoadGroup;
|
bool oldIsInLoadGroup = mIsInLoadGroup;
|
||||||
mIsInLoadGroup = false;
|
mIsInLoadGroup = false;
|
||||||
|
|
||||||
// Passing false to aNotify means that mListener will still get
|
if (mOwner) {
|
||||||
// OnStopRequest, if needed.
|
mOwner->RemoveProxy(this, aStatus);
|
||||||
if (mOwner)
|
}
|
||||||
mOwner->RemoveProxy(this, aStatus, false);
|
|
||||||
|
|
||||||
mIsInLoadGroup = oldIsInLoadGroup;
|
mIsInLoadGroup = oldIsInLoadGroup;
|
||||||
|
|
||||||
|
|
|
@ -250,22 +250,11 @@ imgStatusTracker::SyncNotify(imgRequestProxy* proxy)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
imgStatusTracker::EmulateRequestFinished(imgRequestProxy* aProxy, nsresult aStatus,
|
imgStatusTracker::EmulateRequestFinished(imgRequestProxy* aProxy,
|
||||||
bool aOnlySendStopRequest)
|
nsresult aStatus)
|
||||||
{
|
{
|
||||||
nsCOMPtr<imgIRequest> kungFuDeathGrip(aProxy);
|
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) {
|
if (mState & stateBlockingOnload) {
|
||||||
aProxy->UnblockOnload();
|
aProxy->UnblockOnload();
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,12 +80,10 @@ public:
|
||||||
// OnStartRequest).
|
// OnStartRequest).
|
||||||
void SyncNotify(imgRequestProxy* proxy);
|
void SyncNotify(imgRequestProxy* proxy);
|
||||||
|
|
||||||
// Send all notifications that would be necessary to make |proxy| believe the
|
// Send some notifications that would be necessary to make |proxy| believe
|
||||||
// request is finished downloading and decoding.
|
// the request is finished downloading and decoding. We only send
|
||||||
// If aOnlySendStopRequest is true, we will only send OnStopRequest, and then
|
// OnStopRequest and UnblockOnload, and only if necessary.
|
||||||
// only if that is necessary.
|
void EmulateRequestFinished(imgRequestProxy* proxy, nsresult aStatus);
|
||||||
void EmulateRequestFinished(imgRequestProxy* proxy, nsresult aStatus,
|
|
||||||
bool aOnlySendStopRequest);
|
|
||||||
|
|
||||||
// Returns whether we are in the process of loading; that is, whether we have
|
// Returns whether we are in the process of loading; that is, whether we have
|
||||||
// not received OnStopRequest.
|
// not received OnStopRequest.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче