Fix bug 832571 by backing out 4d95a6900a4f:304ee1c25362 (bug 784591) for frequent Android crashtest-3 failures in ownerdiscard.html

This commit is contained in:
Phil Ringnalda 2013-01-18 20:08:06 -08:00
parent f390dd132a
commit 0a7f936a63
2 changed files with 27 additions and 76 deletions

View File

@ -379,21 +379,6 @@ nsImageLoadingContent::FrameCreated(nsIFrame* aFrame)
// be registered.
nsPresContext* presContext = aFrame->PresContext();
if (mCurrentRequest && !(mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
nsIDocument* doc = GetOurCurrentDoc();
if (doc) {
mCurrentRequestFlags |= REQUEST_IS_TRACKED;
doc->AddImage(mCurrentRequest);
}
}
if (mPendingRequest && !(mPendingRequestFlags & REQUEST_IS_TRACKED)) {
nsIDocument* doc = GetOurCurrentDoc();
if (doc) {
mPendingRequestFlags |= REQUEST_IS_TRACKED;
doc->AddImage(mPendingRequest);
}
}
if (mCurrentRequest) {
nsLayoutUtils::RegisterImageRequestIfAnimated(presContext, mCurrentRequest,
&mCurrentRequestRegistered);
@ -422,21 +407,6 @@ nsImageLoadingContent::FrameDestroyed(nsIFrame* aFrame)
mPendingRequest,
&mPendingRequestRegistered);
}
if (mCurrentRequest && (mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
nsIDocument* doc = GetOurCurrentDoc();
if (doc) {
mCurrentRequestFlags &= ~REQUEST_IS_TRACKED;
doc->RemoveImage(mCurrentRequest);
}
}
if (mPendingRequest && (mPendingRequestFlags & REQUEST_IS_TRACKED)) {
nsIDocument* doc = GetOurCurrentDoc();
if (doc) {
mPendingRequestFlags &= ~REQUEST_IS_TRACKED;
doc->RemoveImage(mPendingRequest);
}
}
}
int32_t
@ -528,7 +498,6 @@ nsImageLoadingContent::LoadImageWithChannel(nsIChannel* aChannel,
TrackImage(req);
ResetAnimationIfNeeded();
} else {
MOZ_ASSERT(!req, "Shouldn't have non-null request here");
// If we don't have a current URI, we might as well store this URI so people
// know what we tried (and failed) to load.
if (!mCurrentRequest)
@ -766,7 +735,6 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI,
}
}
} else {
MOZ_ASSERT(!req, "Shouldn't have non-null request here");
// If we don't have a current URI, we might as well store this URI so people
// know what we tried (and failed) to load.
if (!mCurrentRequest)
@ -879,12 +847,10 @@ nsImageLoadingContent::UseAsPrimaryRequest(imgRequestProxy* aRequest,
// Clone the request we were given.
nsRefPtr<imgRequestProxy>& req = PrepareNextRequest();
nsresult rv = aRequest->Clone(this, getter_AddRefs(req));
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv))
TrackImage(req);
} else {
MOZ_ASSERT(!req, "Shouldn't have non-null request here");
else
return rv;
}
return NS_OK;
}
@ -1183,16 +1149,10 @@ nsImageLoadingContent::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsCxPusher pusher;
pusher.PushNull();
if (GetOurPrimaryFrame()) {
if (mCurrentRequest && !(mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
mCurrentRequestFlags |= REQUEST_IS_TRACKED;
aDocument->AddImage(mCurrentRequest);
}
if (mPendingRequest && !(mPendingRequestFlags & REQUEST_IS_TRACKED)) {
mPendingRequestFlags |= REQUEST_IS_TRACKED;
aDocument->AddImage(mPendingRequest);
}
}
if (mCurrentRequestFlags & REQUEST_SHOULD_BE_TRACKED)
aDocument->AddImage(mCurrentRequest);
if (mPendingRequestFlags & REQUEST_SHOULD_BE_TRACKED)
aDocument->AddImage(mPendingRequest);
if (mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD)
aDocument->BlockOnload();
@ -1211,14 +1171,10 @@ nsImageLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
nsCxPusher pusher;
pusher.PushNull();
if (mCurrentRequest && (mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
mCurrentRequestFlags &= ~REQUEST_IS_TRACKED;
if (mCurrentRequestFlags & REQUEST_SHOULD_BE_TRACKED)
doc->RemoveImage(mCurrentRequest);
}
if (mPendingRequest && (mPendingRequestFlags & REQUEST_IS_TRACKED)) {
mPendingRequestFlags &= ~REQUEST_IS_TRACKED;
if (mPendingRequestFlags & REQUEST_SHOULD_BE_TRACKED)
doc->RemoveImage(mPendingRequest);
}
if (mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD)
doc->UnblockOnload(false);
@ -1232,18 +1188,15 @@ nsImageLoadingContent::TrackImage(imgIRequest* aImage)
MOZ_ASSERT(aImage == mCurrentRequest || aImage == mPendingRequest,
"Why haven't we heard of this request?");
if (aImage == mCurrentRequest) {
mCurrentRequestFlags |= REQUEST_SHOULD_BE_TRACKED;
} else {
mPendingRequestFlags |= REQUEST_SHOULD_BE_TRACKED;
}
nsIDocument* doc = GetOurCurrentDoc();
if (doc && GetOurPrimaryFrame()) {
if (aImage == mCurrentRequest && !(mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
mCurrentRequestFlags |= REQUEST_IS_TRACKED;
doc->AddImage(mCurrentRequest);
}
if (aImage == mPendingRequest && !(mPendingRequestFlags & REQUEST_IS_TRACKED)) {
mPendingRequestFlags |= REQUEST_IS_TRACKED;
doc->AddImage(mPendingRequest);
}
}
if (doc)
return doc->AddImage(aImage);
return NS_OK;
}
@ -1255,21 +1208,18 @@ nsImageLoadingContent::UntrackImage(imgIRequest* aImage)
MOZ_ASSERT(aImage == mCurrentRequest || aImage == mPendingRequest,
"Why haven't we heard of this request?");
if (aImage == mCurrentRequest) {
mCurrentRequestFlags &= ~REQUEST_SHOULD_BE_TRACKED;
} else {
mPendingRequestFlags &= ~REQUEST_SHOULD_BE_TRACKED;
}
// If GetOurDocument() returns null here, we've outlived our document.
// That's fine, because the document empties out the tracker and unlocks
// all locked images on destruction.
nsIDocument* doc = GetOurCurrentDoc();
if (doc) {
if (aImage == mCurrentRequest && (mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
mCurrentRequestFlags &= ~REQUEST_IS_TRACKED;
doc->RemoveImage(mCurrentRequest, nsIDocument::REQUEST_DISCARD);
}
if (aImage == mPendingRequest && (mPendingRequestFlags & REQUEST_IS_TRACKED)) {
mPendingRequestFlags &= ~REQUEST_IS_TRACKED;
doc->RemoveImage(mPendingRequest, nsIDocument::REQUEST_DISCARD);
}
}
if (doc)
return doc->RemoveImage(aImage, nsIDocument::REQUEST_DISCARD);
return NS_OK;
}

View File

@ -342,12 +342,13 @@ protected:
uint32_t mPendingRequestFlags;
enum {
// Set if the request needs ResetAnimation called on it.
// Set if the request needs
REQUEST_NEEDS_ANIMATION_RESET = 0x00000001U,
// Set if the request should be tracked. This is true if the request is
// not tracked iff this node is not in the document.
REQUEST_SHOULD_BE_TRACKED = 0x00000002U,
// Set if the request is blocking onload.
REQUEST_BLOCKS_ONLOAD = 0x00000002U,
// Set if the request is currently tracked with the document.
REQUEST_IS_TRACKED = 0x00000004U
REQUEST_BLOCKS_ONLOAD = 0x00000004U
};
// If the image was blocked or if there was an error loading, it's nice to