author | Albert Crespell <acperez@tid.es> |
Tue, 15 Oct 2013 12:01:16 +0200 | |
changeset 164596 | 516d0f14f7fd5c1ae20e76e259d322f1841288a7 |
parent 164595 | 7ecc058d0317a5b2d4f26d67a35480a890197e3f |
child 164597 | ea06175feb4f7069750bdac30bb73a9645098533 |
push id | 3066 |
push user | akeybl@mozilla.com |
push date | Mon, 09 Dec 2013 19:58:46 +0000 |
treeherder | mozilla-beta@a31a0dce83aa [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jonas, hsinyi |
bugs | 887699 |
milestone | 27.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/network/interfaces/nsIDOMNetworkStats.idl +++ b/dom/network/interfaces/nsIDOMNetworkStats.idl @@ -1,39 +1,40 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" +interface nsIDOMMozNetworkStatsInterface; + [scriptable, builtinclass, uuid(3b16fe17-5583-483a-b486-b64a3243221c)] interface nsIDOMMozNetworkStatsData : nsISupports { readonly attribute unsigned long rxBytes; // Received bytes. readonly attribute unsigned long txBytes; // Sent bytes. readonly attribute jsval date; // Date. }; -[scriptable, builtinclass, uuid(6613ea55-b99c-44f9-91bf-d07da10b9b74)] +[scriptable, builtinclass, uuid(b6fc4b14-628d-4c99-bf4e-e4ed56916cbe)] interface nsIDOMMozNetworkStats : nsISupports { /** * Manifest URL of an application for specifying the per-app * stats of the specified app. If null, system stats are returned. */ readonly attribute DOMString manifestURL; /** - * Can be 'mobile', 'wifi' or null. - * If null, stats for both mobile and wifi are returned. + * Network the returned data belongs to. */ - readonly attribute DOMString connectionType; + readonly attribute nsIDOMMozNetworkStatsInterface network; /** - * Stats for connectionType + * Stats for a network. */ readonly attribute jsval data; // array of NetworkStatsData. // one element per day. /** * Dates */ readonly attribute jsval start; // Date.
--- a/dom/network/interfaces/nsIDOMNetworkStatsManager.idl +++ b/dom/network/interfaces/nsIDOMNetworkStatsManager.idl @@ -1,62 +1,70 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" interface nsIDOMDOMRequest; -dictionary NetworkStatsOptions +/** + * Represents a data interface for which the manager is recording statistics. + */ +[scriptable, uuid(f540615b-d803-43ff-8200-2a9d145a5645)] +interface nsIDOMMozNetworkStatsInterface : nsISupports { + readonly attribute long type; + /** - * Connection type used to filter which network stats will be returned: - * 'mobile', 'wifi' or null. - * If null, stats for both mobile and wifi are returned. - * - * Manifest URL used to retrieve network stats per app. - * If null, system stats (regardless of the app) are returned. + * Id value is '0' for wifi or the iccid for mobile (SIM). */ - DOMString connectionType; - DOMString manifestURL; - jsval start; // date - jsval end; // date + readonly attribute DOMString id; }; -[scriptable, uuid(87529a6c-aef6-11e1-a595-4f034275cfa6)] +[scriptable, uuid(5fbdcae6-a2cd-47b3-929f-83ac75bd4881)] interface nsIDOMMozNetworkStatsManager : nsISupports { /** - * Query network statistics. - * - * If options.connectionType is not provided, return statistics for all known - * network interfaces. - * - * If options.manifestURL is not provided, return statistics regardless of the app. + * Constants for known interface types. + */ + const long WIFI = 0; + const long MOBILE = 1; + + /** + * Find samples between two dates start and end, both included. * - * If successful, the request result will be an nsIDOMMozNetworkStats object. + * If manifestURL is provided, per-app usage is retrieved, + * otherwise the target will be system usage. * - * If network stats are not available for some dates, then rxBytes & - * txBytes are undefined for those dates. + * If success, the request result will be an nsIDOMMozNetworkStats object. */ - nsIDOMDOMRequest getNetworkStats(in jsval options); + nsIDOMDOMRequest getSamples(in nsIDOMMozNetworkStatsInterface network, + in jsval start, + in jsval end, + [optional] in DOMString manifestURL); /** - * Return available connection types. + * Remove all stats related with the provided network from DB. */ - readonly attribute jsval connectionTypes; // array of DOMStrings. + nsIDOMDOMRequest clearStats(in nsIDOMMozNetworkStatsInterface network); /** - * Clear all stats from DB. + * Remove all stats in the database. */ - nsIDOMDOMRequest clearAllData(); + nsIDOMDOMRequest clearAllStats(); /** - * Time in seconds between samples stored in database. + * Return currently available networks. */ - readonly attribute long sampleRate; + readonly attribute jsval availableNetworks; // array of nsIDOMMozNetworkStatsInterface. /** - * Maximum number of samples stored in the database per connection type. + * Minimum time in milliseconds between samples stored in the database. */ - readonly attribute long maxStorageSamples; + readonly attribute long sampleRate; + + /** + * Time in milliseconds recorded by the API until present time. All samples + * older than maxStorageAge from now are deleted. + */ + readonly attribute long long maxStorageAge; };
--- a/dom/network/interfaces/nsINetworkStatsServiceProxy.idl +++ b/dom/network/interfaces/nsINetworkStatsServiceProxy.idl @@ -1,35 +1,37 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" +interface nsINetworkInterface; + [scriptable, function, uuid(5f821529-1d80-4ab5-a933-4e1b3585b6bc)] interface nsINetworkStatsServiceProxyCallback : nsISupports { /* * @param aResult callback result with boolean value * @param aMessage message */ void notify(in boolean aResult, in jsval aMessage); }; -[scriptable, uuid(8fbd115d-f590-474c-96dc-e2b6803ca975)] +[scriptable, uuid(facef032-3fd9-4509-a396-83d94c1a11ae)] interface nsINetworkStatsServiceProxy : nsISupports { /* * An interface used to record per-app traffic data. * @param aAppId app id - * @param aConnectionType network connection type (0 for wifi, 1 for mobile) + * @param aNetworkInterface network * @param aTimeStamp time stamp * @param aRxBytes received data amount * @param aTxBytes transmitted data amount * @param aCallback an optional callback */ void saveAppStats(in unsigned long aAppId, - in long aConnectionType, + in nsINetworkInterface aNetwork, in unsigned long long aTimeStamp, in unsigned long long aRxBytes, in unsigned long long aTxBytes, [optional] in nsINetworkStatsServiceProxyCallback aCallback); };