Closed Bug 293995 Opened 19 years ago Closed 19 years ago

Download status repaints every second even when downloads are done

Categories

(Camino Graveyard :: Downloading, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Camino1.0

People

(Reporter: lernean.hydra, Assigned: nick.kreeger)

References

Details

(Keywords: perf)

Attachments

(1 file, 4 obsolete files)

Doing a download with flash repaint on shows dowloads repaint every second even when none of the downloads are active. The update should only happen for downloads that are still going.
The downloads window isn't very efficient. It also seems to suck up unecessary amounts of CPU when it's in the background.
Erm, I should say "when it's open".
Status: NEW → ASSIGNED
Keywords: perf
Target Milestone: --- → Camino1.0
Attached patch Completly untested patch (obsolete) — Splinter Review
IIRC the icon for the downloads will be updated infintely until it's removed from the download manager. The easy solution would probably be to add a check for wheter the download is done and stop updating the icon then. I'll try to get time to test how this works later today.
Oops, attached the wrong file.
Attachment #183722 - Attachment is obsolete: true
Attached patch Working patch (obsolete) — Splinter Review
> The easy solution would probably be to add a check for wheter the > download is done and stop updating the icon then. That didn't work very well. Made changes to ProgressDlgController so it only refreshes the download info for active downloads. This seems to work well.
Attachment #183723 - Attachment is obsolete: true
Attachment #183736 - Flags: review?
Attached patch Josh's patch, v1.0 (obsolete) — Splinter Review
I made this patch on an airplane, did't see the other guy's. Mine sets a flag whenever a download never needs to be repainted again. That solves the problem that this bug is about. Furthermore, my patch kills the timer when no downloads are active, even if some are in the list.
Assignee: pinkerton → joshmoz
Attachment #185843 - Flags: superreview?(pinkerton)
Attachment #185843 - Flags: review?(sfraser_bugs)
Comment on attachment 185843 [details] [diff] [review] Josh's patch, v1.0 There is a typo in the patch I posted that will do bad things with the timer. I probably should have said: if ([self numDownloadsInProgress] == 0)
Attachment #185843 - Attachment is obsolete: true
Attachment #185843 - Flags: superreview?(pinkerton)
Attachment #185843 - Flags: review?(sfraser_bugs)
yeah, was gonna say that about the == 0 issue. you going to post a new patch? which patch do we want to use here? torben? how does yours compare to the one josh put up?
Here is what I think should happen after looking at both patches... - use Torben's approach, but modify it to only examine visible items - no need up update things in the list that aren't visible. - also my fix for not running the timer all the time.
This combines Torben's patch with mine for the best solution.
Attachment #183736 - Attachment is obsolete: true
Attachment #185861 - Flags: superreview?(pinkerton)
Attachment #185861 - Flags: review?(sfraser_bugs)
Attachment #183736 - Flags: review?
FWIW, I agree with Josh that the combined patch is the best.
Attachment #185861 - Flags: review?(sfraser_bugs) → review+
- [mProgressViewControllers makeObjectsPerformSelector:@selector(refreshDownloadInfo)]; + for (unsigned i = 0; i < [mProgressViewControllers count]; i++) { + if ([[mProgressViewControllers objectAtIndex:i] isActive]) + [[mProgressViewControllers objectAtIndex:i] refreshDownloadInfo]; + } why not just have |-refreshDownloadInfo| check if it's active before it redraws? Then you can leave this code out. Seems like a normal thing for a refresh routine to check regardless.
(In reply to comment #12) > why not just have |-refreshDownloadInfo| check if it's active before it redraws? AFAIK we need to do the last update after the download is finnished (and thus not active): + // force final redraw on recently completed download + // then kill the timer if there are no active downloads + [(ProgressViewController*)progressDisplay refreshDownloadInfo]; + if ([self numDownloadsInProgress] == 0) + [self killDownloadTimer];
You have to keep the timer alive even when there are no active downloads, because we keep the file's icon (and maybe other stuff) up-to-date.
Comment on attachment 185861 [details] [diff] [review] combination of the two patches, v3.0 This breaks updating of icons of downloaded files.
Attachment #185861 - Flags: superreview?(pinkerton) → superreview-
> This breaks updating of icons of downloaded files. Why do we care about this? (IIRC, we don't track moving of downloaded files, nor will deleted files be removed (or grayed out) from the window.)
(In reply to comment #16) > > This breaks updating of icons of downloaded files. > > (IIRC, we don't track moving of downloaded files, nor will deleted files be > removed (or grayed out) from the window.) We do change the icon of a file that has disappeared to a generic icon, and ideally we'd then disable the Show button (we don't now, which is a bug).
I made the text strings not redraw if they don't have to. It's harder to tell if the image changed, so that still redraws (and we hit the disk every time to see if the icon changed). To be more performance here, we could maybe use file system notifications.
Taking
Assignee: joshmoz → nick.kreeger
Status: ASSIGNED → NEW
I have a patch that is part of a fix for bug 187619 (saving download instances). We know only set the icon on start up, and when a download starts and ends. Upon adding 150 downloads in the manager, Camino idles where its supposed to (near 0% cpu load) Also when downloading mulitple downloads (3-4) while having those 150 in the manager, Camino's cpu load holds below 50%. https://bugzilla.mozilla.org/show_bug.cgi?id=187619
Fixed with bug 187619's checkin.
Status: NEW → RESOLVED
Closed: 19 years ago
Depends on: 187619
Resolution: --- → FIXED
Although the painting issue should be cleaned up, the timer might be running when it's no longer needed.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: