Bug 887699 - Part 1: IDL definition. r=jonas, r=hsinyi

This commit is contained in:
Albert Crespell 2013-10-15 12:01:16 +02:00
Родитель 18dbbb6e83
Коммит 1e74154822
3 изменённых файлов: 51 добавлений и 40 удалений

Просмотреть файл

@ -4,6 +4,8 @@
#include "nsISupports.idl"
interface nsIDOMMozNetworkStatsInterface;
[scriptable, builtinclass, uuid(3b16fe17-5583-483a-b486-b64a3243221c)]
interface nsIDOMMozNetworkStatsData : nsISupports
{
@ -12,7 +14,7 @@ interface nsIDOMMozNetworkStatsData : nsISupports
readonly attribute jsval date; // Date.
};
[scriptable, builtinclass, uuid(6613ea55-b99c-44f9-91bf-d07da10b9b74)]
[scriptable, builtinclass, uuid(b6fc4b14-628d-4c99-bf4e-e4ed56916cbe)]
interface nsIDOMMozNetworkStats : nsISupports
{
/**
@ -22,13 +24,12 @@ interface nsIDOMMozNetworkStats : nsISupports
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.

Просмотреть файл

@ -6,57 +6,65 @@
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.
*
* If successful, the request result will be an nsIDOMMozNetworkStats object.
*
* If network stats are not available for some dates, then rxBytes &
* txBytes are undefined for those dates.
* Constants for known interface types.
*/
nsIDOMDOMRequest getNetworkStats(in jsval options);
const long WIFI = 0;
const long MOBILE = 1;
/**
* Return available connection types.
* Find samples between two dates start and end, both included.
*
* If manifestURL is provided, per-app usage is retrieved,
* otherwise the target will be system usage.
*
* If success, the request result will be an nsIDOMMozNetworkStats object.
*/
readonly attribute jsval connectionTypes; // array of DOMStrings.
nsIDOMDOMRequest getSamples(in nsIDOMMozNetworkStatsInterface network,
in jsval start,
in jsval end,
[optional] in DOMString manifestURL);
/**
* Clear all stats from DB.
* Remove all stats related with the provided network from DB.
*/
nsIDOMDOMRequest clearAllData();
nsIDOMDOMRequest clearStats(in nsIDOMMozNetworkStatsInterface network);
/**
* Time in seconds between samples stored in database.
* Remove all stats in the database.
*/
readonly attribute long sampleRate;
nsIDOMDOMRequest clearAllStats();
/**
* Maximum number of samples stored in the database per connection type.
* Return currently available networks.
*/
readonly attribute long maxStorageSamples;
readonly attribute jsval availableNetworks; // array of nsIDOMMozNetworkStatsInterface.
/**
* Minimum time in milliseconds between samples stored in the database.
*/
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;
};

Просмотреть файл

@ -4,6 +4,8 @@
#include "nsISupports.idl"
interface nsINetworkInterface;
[scriptable, function, uuid(5f821529-1d80-4ab5-a933-4e1b3585b6bc)]
interface nsINetworkStatsServiceProxyCallback : nsISupports
{
@ -14,20 +16,20 @@ interface nsINetworkStatsServiceProxyCallback : nsISupports
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,