Closed Bug 228388 Opened 21 years ago Closed 21 years ago

nsDownloadManager cleanup

Categories

(SeaMonkey :: Download & File Handling, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.7alpha

People

(Reporter: Biesinger, Assigned: Biesinger)

References

Details

Attachments

(1 file, 4 obsolete files)

avoid some QIs; don't use Exists on a hashtable when we will call Get anyway (if
the entry exists)
Attached patch patch (obsolete) — Splinter Review
Attachment #137367 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 137367 [details] [diff] [review]
patch

>+  *aDownloadItem = NS_STATIC_CAST(nsIDownload*, mCurrDownloads.Get(&key));
Should be nsDownload*

>-  nsDownload* internalDownload = NS_STATIC_CAST(nsDownload*, mCurrDownloads.Get(&key));
>+  nsDownload* download = NS_STATIC_CAST(nsDownload*, mCurrDownloads.Get(&key));
Why the rename? You didn't rename it above.

>-nsDownloadManager::OpenProgressDialogFor(const nsACString & aTargetPath, nsIDOMWindow* aParent, PRBool aCancelDownloadOnClose)
>+nsDownloadManager::OpenProgressDialogFor(nsIDownload* aDownload, nsIDOMWindow* aParent, PRBool aCancelDownloadOnClose)
This change makes the patch incomplete.

>+  nsDownload* internalDownload = NS_STATIC_CAST(nsDownload*, aDownload);
Null check please.
Attachment #137367 - Flags: review?(neil.parkwaycc.co.uk) → review-
Status: NEW → ASSIGNED
new version of the patch requires nsInterfaceHashtable::GetWeak, marking dependency
Depends on: 228794
Target Milestone: --- → mozilla1.7alpha
Attached patch patch v2 (obsolete) — Splinter Review
Attachment #137367 - Attachment is obsolete: true
Attachment #138079 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 138079 [details] [diff] [review]
patch v2

oops, the point of nsInterfaceHashtable was to avoid manual refcounting. I
forgot to remove the manual refcounting in this patch though...
Attachment #138079 - Flags: review?(neil.parkwaycc.co.uk) → review-
Attached patch patch v3 (obsolete) — Splinter Review
let the hashtable do the refcounting
Attachment #138079 - Attachment is obsolete: true
Attachment #138083 - Flags: review?(neil.parkwaycc.co.uk)
*** Bug 228825 has been marked as a duplicate of this bug. ***
Depends on: 230707
Comment on attachment 138083 [details] [diff] [review]
patch v3

I'll make this use the new nsReferenceHashtable
Attachment #138083 - Flags: review?(neil.parkwaycc.co.uk) → review-
Attached patch patch v4 (obsolete) — Splinter Review
Attachment #138083 - Attachment is obsolete: true
Attachment #140308 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 140308 [details] [diff] [review]
patch v4

>+#include "nsAutoPtr.h"
The code compiles without this...

> /* Outstanding issues/todo:
>  * 1. Implement pause/resume.
>  */
Is this still true?

>+  mCurrDownloads.Remove(utf8Path);
I don't think this is necessary, in fact I think it hurts (but double-check
with bsmedberg or alecf just to be sure).
>+  mCurrDownloads.Put(utf8Path, internalDownload);
Attachment #140308 - Flags: review?(neil.parkwaycc.co.uk) → review+
(In reply to comment #10)
> (From update of attachment 140308 [details] [diff] [review])
> >+#include "nsAutoPtr.h"
> The code compiles without this...

Ah yeah... it gets nsRefPtr via nsRefPtrHashtable.h. I'll remove this line

> > /* Outstanding issues/todo:
> >  * 1. Implement pause/resume.
> >  */
> Is this still true?

it is...

> >+  mCurrDownloads.Remove(utf8Path);
> I don't think this is necessary, in fact I think it hurts (but double-check
> with bsmedberg or alecf just to be sure).

yes, bsmedberg confirmed this is not necessary. I'll remove this line.

Attachment #140311 - Flags: superreview?(bz-vacation)
Comment on attachment 140311 [details] [diff] [review]
v4 with neil's comments

sr=bzbarsky
Attachment #140311 - Flags: superreview?(bzbarsky) → superreview+
Checking in xpfe/components/download-manager/src/nsDownloadManager.cpp;
/cvsroot/mozilla/xpfe/components/download-manager/src/nsDownloadManager.cpp,v 
<--  nsDownloadManager.cpp
new revision: 1.90; previous revision: 1.89
done
Checking in xpfe/components/download-manager/src/nsDownloadManager.h;
/cvsroot/mozilla/xpfe/components/download-manager/src/nsDownloadManager.h,v  <--
 nsDownloadManager.h
new revision: 1.30; previous revision: 1.29
done
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: