Closed Bug 273971 Opened 20 years ago Closed 19 years ago

nsIDownload should use bytes rather than kbytes

Categories

(SeaMonkey :: Download & File Handling, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: zbraniecki, Assigned: son.le0)

References

()

Details

Attachments

(1 file, 3 obsolete files)

At the moment nsIDownload after fixing bug 239006 will be using kbytes.

Biesi wants to have it in bytes.
Depends on: 239006
Blocks: 1kb
Attached patch proposed patch (obsolete) — Splinter Review
Changes pretty much localized to just nsDownloadManager.

The only place I could see that used amountTransferred and size was in downloads.js, but only as a ratio so no changes was necessary.
Attachment #201620 - Flags: superreview?(darin)
Attachment #201620 - Flags: review?(cbiesinger)
(In reply to comment #1)
>Changes pretty much localized to just nsDownloadManager.
What about the original nsDownloadManager? :-P
Attached patch proposed patch w/ xpfe changes (obsolete) — Splinter Review
umm.. yes, and the original nsDownloadManager, too, even though it's not actually used.
Attachment #201620 - Attachment is obsolete: true
Attachment #201629 - Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #201629 - Flags: review?(cbiesinger)
Attachment #201620 - Flags: superreview?(darin)
Attachment #201620 - Flags: review?(cbiesinger)
eh, that download manager is very much used.
yes, I meant to say that the variables amountTransferred/size (mCurrBytes/mMaxBytes) are not used by xpfe.
Comment on attachment 201629 [details] [diff] [review]
proposed patch w/ xpfe changes

This change will make the download manager display bytes (although still using the KB of KB string!). Is it outside the scope of this bug to make it display scientifically i.e. K/M/GB as appropriate? Also is it outside the scope of this bug to set mMaxBytes to mCurrBytes at the end of an unknown amount of tranfer?
Attachment #201629 - Flags: superreview?(neil.parkwaycc.co.uk) → superreview-
Attachment #201629 - Flags: review?(cbiesinger) → review-
Attached patch patch v1 (obsolete) — Splinter Review
Hmmm... changed both references as per biesi's comment, although firefox works regardless.

> This change will make the download manager display bytes (although still using
> the KB of KB string!).

Yep, noticed this after building seamonkey. Seems xpfe uses the above code, but toolkit doesn't.

> Is it outside the scope of this bug to make it display scientifically 
> i.e. K/M/GB as appropriate?

Hmmm.. I'm be happy to do this is a separate bug, although there is existing toolkit code that does at least K/MB.

> Also is it outside the scope of this bug to set mMaxBytes to mCurrBytes at the 
> end of an unknown amount of tranfer?

Done.
Attachment #201629 - Attachment is obsolete: true
Attachment #202490 - Flags: superreview?
Attachment #202490 - Flags: review?(cbiesinger)
Comment on attachment 202490 [details] [diff] [review]
patch v1

updated superreview request to use neil's new email address.
Attachment #202490 - Flags: superreview? → superreview?(neil.parkwaycc.co.uk)
Blocks: 245725
Attachment #202490 - Flags: superreview?(neil.parkwaycc.co.uk) → superreview+
Blocks: 316585
Comment on attachment 202490 [details] [diff] [review]
patch v1

-  TransferInformation GetTransferInformation() {
+  void GetTransferInformation(PRInt64* aCurr, PRInt64* aMax) {

_why_?
Comment on attachment 202490 [details] [diff] [review]
patch v1

+  // update progress - for some reason in the last progress change
+  // for transfers of unknown size, aCurTotalProgress = -1.

is that a question? if so, the answer is:
http://lxr.mozilla.org/seamonkey/source/uriloader/exthandler/nsExternalHelperAppService.cpp#2067

I kinda think that this should be fixed in exthandler instead, and I actually believe that I once reviewed a patch that does that, no idea what happened to it...

anyway, this comment is stupid. remove the "for some reason" part. the reason is clear, and a bug (imo).
(In reply to comment #10)
> (From update of attachment 202490 [details] [diff] [review] [edit])
> -  TransferInformation GetTransferInformation() {
> +  void GetTransferInformation(PRInt64* aCurr, PRInt64* aMax) {
> 
> _why_?
> 

To make xpfe code the same as toolkit. Couldn't see any value in making it pass a struct instead of variables and it wasn't being used anywhere else.

> I kinda think that this should be fixed in exthandler instead, and I actually
> believe that I once reviewed a patch that does that, no idea what happened to
> it...

that would be bug 149237.

> anyway, this comment is stupid. remove the "for some reason" part. the reason
> is clear, and a bug (imo).

I put the comment there as I didn't understand why xpfe did this while toolkit didn't. I agree it's a bug and will attach a new patch.
I explicitly changed the xpfe code to use that style (per a sr comment), and my patch to port that and a lot of other stuff to toolkit did never get review... the reason is to group variables together that belong together.
hmmm... should I change toolkit code instead or just leave as it?
Attached patch patch v2Splinter Review
Fixed last progress change for transfers of unknown size and changed toolkit to use TransferInformation struct (making it the same as xpfe code).

carrying forward sr+
Attachment #202490 - Attachment is obsolete: true
Attachment #204110 - Flags: superreview+
Attachment #204110 - Flags: review?(cbiesinger)
Attachment #202490 - Flags: review?(cbiesinger)
Comment on attachment 204110 [details] [diff] [review]
patch v2

r=biesi, sorry for the delay
Attachment #204110 - Flags: review?(cbiesinger) → review+
Assignee: gandalf → son.le0
fixed on trunk
Checking in toolkit/components/downloads/src/nsDownloadManager.cpp;
/cvsroot/mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp,v  <--  nsDownloadManager.cpp
new revision: 1.56; previous revision: 1.55
done
Checking in toolkit/components/downloads/src/nsDownloadManager.h;
/cvsroot/mozilla/toolkit/components/downloads/src/nsDownloadManager.h,v  <--  nsDownloadManager.h
new revision: 1.19; previous revision: 1.18
done
Checking in uriloader/base/nsIDownload.idl;
/cvsroot/mozilla/uriloader/base/nsIDownload.idl,v  <--  nsIDownload.idl
new revision: 1.16; previous revision: 1.15
done
Checking in uriloader/exthandler/nsExternalHelperAppService.cpp;
/cvsroot/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp,v  <--  nsExternalHelperAppService.cpp
new revision: 1.295; previous revision: 1.294
done
Checking in xpfe/components/download-manager/src/nsDownloadManager.cpp;
/cvsroot/mozilla/xpfe/components/download-manager/src/nsDownloadManager.cpp,v  <--  nsDownloadManager.cpp
new revision: 1.113; previous revision: 1.112
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.43; previous revision: 1.42
done
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Depends on: 348925
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: