This addresses an issue with the download manager that can cause high CPU usage
when there is an active download. The underlying issue is the frequency of
updates that the download progress listener receives.
Things changed:
- reduced the number of null checks in DownloadUtils.jsm's getDownloadStatus
function by one (down to two from three).
- obtain and format strings from the nsIStringBundle. This removes all the
calls to String.replace in DownloadUtils.jsm.
- modifies the download manager back-end to update the percentComplete and size
property on downloads before dispatching a state changed notification for
downloads entering the DOWNLOAD_DOWNLOADING state. This saves us two calls to
setAttribute on downloads that we know how big they are, and saves us the same
two calls to setAttribute for indeterminate downloads as well as not
dispatching a ValueChange event on the progressmeter every time
onProgressChange is called on the DownloadProgressListener.
- has nsDownload implement nsIClassInfo so we do not need to QueryInterface when
going through the list of active downloads in both the download manager's UI
and the browser's taskbar UI.