I "had" the same speeds with windows update when resuming update.
Does anyone have the knowledge of how FF calculates the speeds. I tried looking the sourcecode, but It was a bit too complicated (about 30 000 files each files uses few interfaces). I dont know if Im even looking the right file but:
nslDownload is:
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Blake Ross <blaker@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIURI;
interface nsILocalFile;
interface nsIObserver;
interface nsIWebBrowserPersist;
interface nsIWebProgressListener;
interface nsIMIMEInfo;
[scriptable, uuid(d80095a7-e81c-464c-a13f-ecb84feb969f)]
interface nsITransfer : nsISupports {
/**
* Initializes the transfer with certain properties. This function must
* be called prior to accessing any properties on this interface.
*
* @param aSource The source URI of the transfer.
*
* @param aTarget The target URI of the transfer.
*
* @param aDisplayName The user-readable description of the transfer.
*
* @param aMIMEInfo The MIME info associated with the target,
* including MIME type and helper app when appropriate.
* This parameter is optional.
*
* @param aPersist The "persist" used for this transfer. If set,
* the manager will set its listener to the transfer item
* and use it for cancellation. If not set, the client
* is expected to set the transfer item as the listener on
* whatever transfer component is being used, and to
* set an observer on the transfer item that listens for
* the "oncancel" topic and cancels the transfer.
*/
void init(in nsIURI aSource,
in nsIURI aTarget,
in wstring aDisplayName,
in nsIMIMEInfo aMIMEInfo,
in long long startTime,
in nsIWebBrowserPersist aPersist);
/**
* The source of the transfer.
*/
readonly attribute nsIURI source;
/**
* The target of the transfer.
*/
readonly attribute nsIURI target;
/**
* Optional. If set, it will be used for cancellation, and the transfer
* will be set as its listener. If not, |observer| should be set to listen
* and respond accordingly to topics like oncancel, and the client promises
* to set the transfer item as the listener for whatever transfer component
* is being used.
*/
readonly attribute nsIWebBrowserPersist persist;
/**
* The percentage of transfer completed;
*/
readonly attribute PRInt32 percentComplete;
/**
* The user-readable description of the transfer.
*/
attribute wstring displayName;
/**
* The time a transfer was started.
*/
readonly attribute long long startTime;
/**
* Optional. If set, it will contain the target's relevant MIME information.
* This includes it's MIME Type, helper app, and whether that helper should be
* executed.
*/
readonly attribute nsIMIMEInfo MIMEInfo;
/**
* Optional; transfering information is passed to this listener and used to
* update client UI.
*/
attribute nsIWebProgressListener listener;
/**
* If set, receives notifications of events like cancel ("oncancel").
* Must be set if no persist object is specified (see above).
*/
attribute nsIObserver observer;
};
[scriptable, uuid(b0aae798-78aa-4769-9f0e-9aef4cf9474d)]
interface nsIDownload : nsITransfer {
/**
* The target of a download is always a file on the local file system.
*/
readonly attribute nsILocalFile targetFile;
};
%{C++
#define NS_DOWNLOAD_CONTRACTID "@mozilla.org/download;1"
// {E3FA9D0A-1DD1-11B2-BDEF-8C720B597445}
#define NS_DOWNLOAD_CID \
{ 0xe3fa9d0a, 0x1dd1, 0x11b2, { 0xbd, 0xef, 0x8c, 0x72, 0x0b, 0x59, 0x74, 0x45 } }
%}
There is this
/**
* The percentage of transfer completed;
*/
readonly attribute PRInt32 percentComplete;
and this
/**
* Optional; transfering information is passed to this listener and used to
* update client UI.
*/
attribute nsIWebProgressListener listener;
And the nsIWebProgressListener:
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
*/
#include "nsISupports.idl"
/**
* The nsIWebProgressListener interface is implemented by clients wishing to
* listen in on the progress associated with the loading of documents.
*
* @status UNDER_REVIEW
*/
interface nsIWebProgress;
interface nsIRequest;
interface nsIURI;
[scriptable, uuid(570F39D1-EFD0-11d3-B093-00A024FFC08C)]
interface nsIWebProgressListener : nsISupports
{
/**
* Progress state transition bits.
* These flags indicate the various states that documents and requests
* may transition through as they are being loaded.
*/
const unsigned long STATE_START = 0x00000001;
const unsigned long STATE_REDIRECTING = 0x00000002;
const unsigned long STATE_TRANSFERRING = 0x00000004;
const unsigned long STATE_NEGOTIATING = 0x00000008;
const unsigned long STATE_STOP = 0x00000010;
/**
* Progress State type bits.
* These flags indicate whether the transition is occuring on a document
* or an individual request within the document.
*/
const unsigned long STATE_IS_REQUEST = 0x00010000;
const unsigned long STATE_IS_DOCUMENT = 0x00020000;
const unsigned long STATE_IS_NETWORK = 0x00040000;
const unsigned long STATE_IS_WINDOW = 0x00080000;
/**
* Security state bits
*/
const unsigned long STATE_IS_INSECURE = 0x00000004;
const unsigned long STATE_IS_BROKEN = 0x00000001;
const unsigned long STATE_IS_SECURE = 0x00000002;
const unsigned long STATE_SECURE_HIGH = 0x00040000;
const unsigned long STATE_SECURE_MED = 0x00010000;
const unsigned long STATE_SECURE_LOW = 0x00020000;
/**
* Notification indicating the state has changed for one of the requests
* associated with the document loaded.
*
* @param aWebProgress The nsIWebProgress instance that fired the
* notification
*
* @param aRequest The nsIRequest which has changed state.
*
* @param aStateFlags Flags indicating the state change.
*
* @param aStatus Error status code associated with the state change.
* This parameter should be ignored unless the status flag includes the
* STATE_STOP bit. The status code will indicate success / failure of the
* request associated with the state change.
*
* @return NS_OK should always be returned.
*/
void onStateChange(in nsIWebProgress aWebProgress,
in nsIRequest aRequest,
in unsigned long aStateFlags,
in nsresult aStatus);
/**
* Notification that the progress has changed for one of the requests being
* monitored.
*
* @param aWebProgress The nsIWebProgress instance that fired the
* notification
*
* @param aRequest The nsIRequest that has new progress.
*
* @param aCurSelfProgress The current progress for aRequest.
*
* @param aMaxSelfProgress The maximum progress for aRequest. If this
* value is not known then -1 is passed.
*
* @param aCurTotalProgress The current progress for all the requests
* being monitored.
*
* @param aMaxTotalProgress The total progress for all the requests being
* monitored. If this value is not known then
* -1 is passed.
*
* @return NS_OK should always be returned.
*/
void onProgressChange(in nsIWebProgress aWebProgress,
in nsIRequest aRequest,
in long aCurSelfProgress,
in long aMaxSelfProgress,
in long aCurTotalProgress,
in long aMaxTotalProgress);
/**
* Called when the window being watched changes the location that is currently.
* This is not when a load is requested, but rather once it is verified that
* the load is going to occur in the given window. For instance, a load that
* starts in a window might send progress and status messages, for the new site
* but it will not send the onLocationChange until we are sure we are loading
* this new page here.
*
* @param location The URI of the location that is being loaded.
*
* @return NS_OK should always be returned.
*/
void onLocationChange(in nsIWebProgress aWebProgress,
in nsIRequest aRequest,
in nsIURI location);
/**
* Notification that the status has changed. The status message is usually
* printed in the status bar of the browser.
*
* @return NS_OK should always be returned.
*/
void onStatusChange(in nsIWebProgress aWebProgress,
in nsIRequest aRequest,
in nsresult aStatus,
in wstring aMessage);
/**
* Notification called for security progress.
* This method will be called on security transitions (eg HTTP -> HTTPS,
* HTTPS -> HTTP, FOO -> https) and after document load completion.
* It might also be called if an error occurs during network loading.
*
* These notification will only occur if a security package is installed.
*
* @return NS_OK should always be returned.
*/
void onSecurityChange(in nsIWebProgress aWebProgress,
in nsIRequest aRequest,
in unsigned long state);
};
and there is this:
void onStateChange(in nsIWebProgress aWebProgress,
in nsIRequest aRequest,
in unsigned long aStateFlags,
in nsresult aStatus);
nsl WebProgess
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
*/
#include "nsISupports.idl"
interface nsIDOMWindow;
interface nsIWebProgressListener;
/**
* The nsIWebProgress interface is used to look at the progress of document
* loading in a particular DOM Window.
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(570F39D0-EFD0-11d3-B093-00A024FFC08C)]
interface nsIWebProgress : nsISupports
{
const unsigned long NOTIFY_STATE_REQUEST = 0x00000001;
const unsigned long NOTIFY_STATE_DOCUMENT = 0x00000002;
const unsigned long NOTIFY_STATE_NETWORK = 0x00000004;
const unsigned long NOTIFY_STATE_WINDOW = 0x00000008;
const unsigned long NOTIFY_STATE_ALL = 0x0000000f;
const unsigned long NOTIFY_PROGRESS = 0x00000010;
const unsigned long NOTIFY_STATUS = 0x00000020;
const unsigned long NOTIFY_SECURITY = 0x00000040;
const unsigned long NOTIFY_LOCATION = 0x00000080;
const unsigned long NOTIFY_ALL = 0x000000ff;
/**
* Registers a listener to be notified of Progress Events
*
* @param listener - The listener interface to be called when a progress
* event occurs.
*
* @param aNotifyMask - The types of notifications to receive.
*
* @return NS_OK - Listener was registered successfully.
* NS_INVALID_ARG - The listener passed in was either nsnull,
* or was already registered with this progress
* interface.
*/
void addProgressListener(in nsIWebProgressListener listener,
in unsigned long aNotifyMask);
/**
* Removes a previously registered listener of Progress Events
*
* @param listener - The listener interface previously registered with
* AddListener().
*
* @return NS_OK - Listener was successfully unregistered.
* NS_ERROR_INVALID_ARG - The listener was not previously
* registered listener.
*/
void removeProgressListener(in nsIWebProgressListener listener);
/**
* The DOM Window associated with the WebProgress instance.
*/
readonly attribute nsIDOMWindow DOMWindow;
/**
* The IsLoadingDocument associated with the WebProgress instance
*/
readonly attribute PRBool isLoadingDocument;
};
adds the listener:
void addProgressListener(in nsIWebProgressListener listener,
in unsigned long aNotifyMask);
but now Im lost, where should I look to figure out how it calculates it?
Im not good with C/C++ so could someone with skills explain the method of calculation.