Closed Bug 683290 Opened 13 years ago Closed 12 years ago

We won't discard any images on the current tab even if they are not in the DOM

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla17
blocking-kilimanjaro ?

People

(Reporter: jrmuizel, Assigned: khuey)

References

(Blocks 1 open bug)

Details

(Whiteboard: [MemShrink:P2])

Attachments

(2 files, 4 obsolete files)

Chrome and Safari will discard in this case. We should too. This situation can occur on things like facebook slideshows.
Blocks: image-suck
Assignee: nobody → khuey
Attached patch Patch (obsolete) — Splinter Review
This builds on the patch in Bug 684919 which adds COMPtrWithFlag<T>, which acts mostly like nsCOMPtr<T> with a flag bit.  The API might change in that bug, so this may end up looking a bit different.

The flag bit is used to store whether or not the image should be tracked.  Then we add a BindToTree/UnbindFromTree implementation that registers/unregisters the image with the document depending on the value of that flag.
Attachment #558801 - Flags: review?
Attachment #558801 - Flags: review? → review?(jmuizelaar)
Comment on attachment 558801 [details] [diff] [review]
Patch

Joe says this should be reviewed by a content person.
Attachment #558801 - Flags: review?(jmuizelaar) → review?(bzbarsky)
Comment on attachment 558801 [details] [diff] [review]
Patch

Review of attachment 558801 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/base/src/nsImageLoadingContent.cpp
@@ +329,5 @@
>  
>    // We can only do this if we have a presshell
> +  // XXXkhuey should this be GetOurCurrentDocument?  Decoding if we're not in
> +  // the document seems silly.
> +  nsIDocument* doc = GetOurOwnerDocument();

When do we have an owner document but not a current document? (This is one of the reasons I want a content person to review this. ;) )

@@ +845,5 @@
> +  // XXXkhuey this is an incredibly nasty hack, but because cloning notifies
> +  // synchronously, we can't use a temporary nsCOMPtr here (we'll assert to
> +  // death in OnStopDecode).  Note that the reference on the outparameter
> +  // is owned by the RequestWithState, so this is not leaky, even though it
> +  // looks like it might be.  Bug 580466 shall save us!

Can you note in that bug so whoever fixes it knows to fix this too?
Comment on attachment 558801 [details] [diff] [review]
Patch

Canceling review request for now per irc discussion.  Specifically:

1)  We're going to add a getter_AddRefs that takes a RequestWithState (or
    generally a COMPtrAndFlag, I would think).
2)  Kyle will test whether this gets us flicker on image-swapping tests and if so
    how to deal with that.
Attachment #558801 - Flags: review?(bzbarsky)
Attached patch Patch (obsolete) — Splinter Review
Attachment #558801 - Attachment is obsolete: true
The attached patch addresses point #1 from comment 4.  I've verified that we can get flicker (asynchronous decoding) with this patch, so that remains an issue.
Comment on attachment 558922 [details] [diff] [review]
Patch

We discussed a possible bandaid for flickering issues on IRC, which is to do some amount of decoding synchronously in RasterImage::RequestDecode, and then do the rest (if any is left) asynchronously on the event loop.  I'm going to file a separate bug for addressing that.
Attachment #558922 - Flags: review?(bzbarsky)
Note that with the attached patch (and without Bug 685516) we will always do a decode when <img>.src is set and we will always decode synchronously when inserting an image that has a compressed size of less than 150K into the DOM, so the potential for flicker is fairly low to begin with.
Comment on attachment 558922 [details] [diff] [review]
Patch

> nsImageLoadingContent::ClearCurrentRequest(nsresult aReason)
>+  mCurrentRequest.Set(nsnull, false);

Why not Clear()?

Similar in ClearPendingRequest.

The comment about why GetOurDocument is not called GetDocument should now explain why the methods are not GetOwnerDoc and GetCurrentDoc.

Speaking of which, probably better to call the new methods GetOurOwnerDoc and GetOurCurrentDoc.  But either way.

You need to add BindToTree and UnbindFromTree calling up into nsImageLoadingContent to nsSVGImageElement.  r- for this part to make sure it happens.
Attachment #558922 - Flags: review?(bzbarsky) → review-
Attached patch Patch (obsolete) — Splinter Review
Not sure if you wanted to look at this again ...
Attachment #558922 - Attachment is obsolete: true
Attachment #562417 - Flags: review?(bzbarsky)
Attached patch Patch (now with hg qref) (obsolete) — Splinter Review
Attachment #562417 - Attachment is obsolete: true
Attachment #562418 - Flags: review?(bzbarsky)
Attachment #562417 - Flags: review?(bzbarsky)
> Not sure if you wanted to look at this again ...

I did.  Hence the r- vs "r+ if you change this".
Comment on attachment 562418 [details] [diff] [review]
Patch (now with hg qref)

r=me
Attachment #562418 - Flags: review?(bzbarsky) → review+
(In reply to Boris Zbarsky (:bz) from comment #12)
> > Not sure if you wanted to look at this again ...
> 
> I did.  Hence the r- vs "r+ if you change this".

It felt more like an "r- so you pay attention" ;-)

Thanks for the review.
Kyle, 

Has this bug landed? It appears to be finished, but isn't closed.
There are some test failures I need to sort through before landing.
Attachment #565836 - Attachment is patch: true
Attachment #565836 - Flags: review?(jmuizelaar)
The test failures are because RasterImage::GetFrame ignores the flags it's given if it doesn't already have a decoder.
Comment on attachment 565836 [details] [diff] [review]
Make RasterImage::GetFrame honor the flags it

r=bholley contingent on that followup bug discussed on IRC (factoring out the 3 copy-pasted instances of the 'screwed' code into a helper method).
Attachment #565836 - Flags: review?(jmuizelaar) → review+
https://hg.mozilla.org/mozilla-central/rev/701372c96a92
https://hg.mozilla.org/mozilla-central/rev/d3b8c0394c5e

Huzzah!
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
Whiteboard: [MemShrink]
Backed out for Android reftest failures:
https://hg.mozilla.org/mozilla-central/rev/29c1738d7e27
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: mozilla10 → ---
The test failures are caused by the patch in bug 685516.
Whiteboard: [MemShrink] → [MemShrink:P2]
Since I can't manage to get the tests running on android under a debugger, we have the following options:

1. Land this without Bug 685516.
2. Scope Bug 685516 to affect desktop only (in other words, keep synchronously decoding small images on mobile).
3. Find someone who can actually debug on android to debug the test failures in Bug 685516.
On behalf of Facebook Inc, let me just say that we are prepared to give over one thousand free "pokes" to anyone who fixes this bug or alternatively https://bugzilla.mozilla.org/show_bug.cgi?id=689623. I will also gladly show you Mark Zuckerberg's desk and give you free dinner and cookies as part of a complementary tour of Facebook HQ in Menlo Park.
This is one of two worst image-related bugs that we're aware of (the other is bug 689623).  Tons of slideshows on the web hit this.  On a memory-constrained mobile device, this is a particularly bad bug, so k90?.
blocking-kilimanjaro: --- → ?
Attached patch Patch, againSplinter Review
Unbitrotted.  The patch is mostly the same.
Attachment #562418 - Attachment is obsolete: true
Attachment #644367 - Flags: review?(bzbarsky)
Comment on attachment 644367 [details] [diff] [review]
Patch, again

The indentation in nsNodeUtils.cpp is off, unless this is a diff -w.

It might make sense to put the flags next to mImageBlockingStatus and make the PRUin16 or even PRUint8 to make them pack better.

r=me with that.
Attachment #644367 - Flags: review?(bzbarsky) → review+
Is this patch for FF14?

Can I get this patch for FF11?

Thanks,
(In reply to HyungGon Baek from comment #30)
> Is this patch for FF14?

This patch is for trunk, more or less.

> Can I get this patch for FF11?

If you do the work, yes.  Otherwise, no.  It's not a good use of my time to backport this to an unsupported version.
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #31)
> > Can I get this patch for FF11?
> 
> If you do the work, yes.  Otherwise, no.  It's not a good use of my time to
> backport this to an unsupported version.

Not to mention entirely insecure. Please upgrade to the latest version of Firefox!
Kyle, is something holding back the landing of the reviewed patch?
IIRC, there's some work that needs to be done to update the tests that fail for bogus reasons.
Appears to me its re-landed just today on m-i, should be coming to m-c next merge hopefully, unless it backed out again:

m-i cset: https://hg.mozilla.org/integration/mozilla-inbound/rev/adf31747cf5e
https://hg.mozilla.org/integration/mozilla-inbound/rev/92727400355a

merged to m-c in cset: https://hg.mozilla.org/mozilla-central/rev/a0bddf5fcb91
with followup fix: https://hg.mozilla.org/mozilla-central/rev/d67c02074ced

No idea why the bug has not been updated...
(In reply to Jim Jeffery not reading bug-mail 1/2/11 from comment #35)
> Appears to me its re-landed just today on m-i, should be coming to m-c next
> merge hopefully, unless it backed out again:

It originated from the build-system repo and was merged to m-c first, then inbound.
I was waiting to make sure it stuck before updating the bug.  I've already landed and backed out twice.

https://hg.mozilla.org/mozilla-central/rev/92727400355a
https://hg.mozilla.org/mozilla-central/rev/adf31747cf5e

And two followups to deal with johns's nsObjectLoadingContent refactoring.

https://hg.mozilla.org/mozilla-central/rev/30ce9f55180f
https://hg.mozilla.org/mozilla-central/rev/91711277a553
Status: REOPENED → RESOLVED
Closed: 13 years ago12 years ago
OS: Mac OS X → All
Hardware: x86 → All
Resolution: --- → FIXED
Version: unspecified → 17 Branch
Depends on: 783379
Target Milestone: --- → mozilla17
Version: 17 Branch → Trunk
Depends on: 784481
Depends on: 789800
You need to log in before you can comment on or make changes to this bug.