Open Bug 827428 Opened 7 years ago Updated 7 years ago

Clicking "Show all downloads" can cause main-thread IO while loading icons

Categories

(Firefox :: Downloads Panel, defect)

x86_64
Windows 7
defect
Not set

Tracking

()

People

(Reporter: ted, Unassigned)

References

(Depends on 1 open bug)

Details

(Whiteboard: [Snappy][sps])

I noticed that clicking "Show all Downloads" on my Windows Nightly hangs my browser for several seconds. Here's a profile:
http://people.mozilla.com/~bgirard/cleopatra/#report=9521fcdcca20db06eaad44eda0a179e9b472ee4b

You can see the giant red area on the right where the UI is hung. Looking at the profile, this appears to be mostly under nsIconChannel::GetHIconFromFile. My downloads are on a network share, so presumably we're loading icons from all my downloaded files over the network synchronously on the UI thread. :-/
Hmm, ShGetFileInfo doesn't have an async version AFAIK <http://mxr.mozilla.org/mozilla-central/source/image/decoders/icon/win/nsIconChannel.cpp#335>, but perhaps we can avoid trying to show all the icons in one shot?
Blocks: 827245
This could get morphed into an imglib bug. It looks like the reason this sucks so much is that nsIconChannel (on Windows) does all the work of looking up the file icon directly from its AsyncOpen method, and these calls can block quite a bit. If it did the hard work on a background thread this would probably work fine.
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #3)
> This could get morphed into an imglib bug.

I'd prefer if this would depend on an imglib bug, since regardless what we do in platform we need a fix in Aurora and ensure what we have doesn't suck too much.
If you look at the profile, you can see that about 51% of the time is under GetSpecialFolderIcon, 35% under SHGetFileInfoW, and 11% under nsLocalFile::Exists.
Depends on: 827440
Whiteboard: [Snappy][sps]
The current code in Inbound (bug 827405) should limit the icons loading to the visible items, it's still bad main-thread but quite limited on opening the view. Let us know when you have a chance to test that.
Regardless, loading an icon from the network can take a while due to network problems even for a single item.

I wonder if we could identify the network case, and in that situation use the "generic" icon for the file extension, provided by the OS (e.g. moz-icon://.png)
no more blocking the hang bug due to the new lazy behavior and I don't think we can fix platform in time, this remains open as future improvement but won't block the feature.
No longer blocks: 827245
Summary: Clicking "Show all downloads" can cause UI to hang while loading icons → Clicking "Show all downloads" can cause main-thread IO while loading icons
You need to log in before you can comment on or make changes to this bug.