2013-09-20 13:11:25 +04:00
|
|
|
/* 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 nsICacheStorage;
|
|
|
|
interface nsILoadContextInfo;
|
|
|
|
interface nsIApplicationCache;
|
|
|
|
interface nsIEventTarget;
|
2014-04-06 22:44:40 +04:00
|
|
|
interface nsICacheStorageConsumptionObserver;
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Provides access to particual cache storages of the network URI cache.
|
|
|
|
*/
|
2015-07-31 08:57:50 +03:00
|
|
|
[scriptable, uuid(44de2fa4-1b0e-4cd3-9e32-211e936f721e)]
|
2013-09-20 13:11:25 +04:00
|
|
|
interface nsICacheStorageService : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Get storage where entries will only remain in memory, never written
|
|
|
|
* to the disk.
|
|
|
|
*
|
2014-06-25 20:42:50 +04:00
|
|
|
* NOTE: Any existing disk entry for [URL|id-extension] will be doomed
|
|
|
|
* prior opening an entry using this memory-only storage. Result of
|
|
|
|
* AsyncOpenURI will be a new and empty memory-only entry. Using
|
|
|
|
* OPEN_READONLY open flag has no effect on this behavior.
|
|
|
|
*
|
2013-09-20 13:11:25 +04:00
|
|
|
* @param aLoadContextInfo
|
|
|
|
* Information about the loading context, this focuses the storage JAR and
|
|
|
|
* respects separate storage for private browsing.
|
|
|
|
*/
|
|
|
|
nsICacheStorage memoryCacheStorage(in nsILoadContextInfo aLoadContextInfo);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get storage where entries will be written to disk when not forbidden by
|
|
|
|
* response headers.
|
|
|
|
*
|
|
|
|
* @param aLookupAppCache
|
|
|
|
* When set true (for top level document loading channels) app cache will
|
|
|
|
* be first to check on to find entries in.
|
|
|
|
*/
|
|
|
|
nsICacheStorage diskCacheStorage(in nsILoadContextInfo aLoadContextInfo,
|
|
|
|
in bool aLookupAppCache);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get storage for a specified application cache obtained using some different
|
|
|
|
* mechanism.
|
|
|
|
*
|
|
|
|
* @param aLoadContextInfo
|
|
|
|
* Mandatory reference to a load context information.
|
|
|
|
* @param aApplicationCache
|
|
|
|
* Optional reference to an existing appcache. When left null, this will
|
|
|
|
* work with offline cache as a whole.
|
|
|
|
*/
|
|
|
|
nsICacheStorage appCacheStorage(in nsILoadContextInfo aLoadContextInfo,
|
|
|
|
in nsIApplicationCache aApplicationCache);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Evict the whole cache.
|
|
|
|
*/
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Purge only data of disk backed entries. Metadata are left for
|
|
|
|
* performance purposes.
|
|
|
|
*/
|
|
|
|
const uint32_t PURGE_DISK_DATA_ONLY = 1;
|
|
|
|
/**
|
|
|
|
* Purge whole disk backed entries from memory. Disk files will
|
|
|
|
* be left unattended.
|
|
|
|
*/
|
|
|
|
const uint32_t PURGE_DISK_ALL = 2;
|
|
|
|
/**
|
|
|
|
* Purge all entries we keep in memory, including memory-storage
|
|
|
|
* entries. This may be dangerous to use.
|
|
|
|
*/
|
|
|
|
const uint32_t PURGE_EVERYTHING = 3;
|
|
|
|
/**
|
|
|
|
* Purges data we keep warmed in memory. Use for tests and for
|
|
|
|
* saving memory.
|
|
|
|
*/
|
|
|
|
void purgeFromMemory(in uint32_t aWhat);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* I/O thread target to use for any operations on disk
|
|
|
|
*/
|
|
|
|
readonly attribute nsIEventTarget ioTarget;
|
2014-04-06 22:44:40 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Asynchronously determine how many bytes of the disk space the cache takes.
|
|
|
|
* @see nsICacheStorageConsumptionObserver
|
|
|
|
* @param aObserver
|
|
|
|
* A mandatory (weak referred) observer. Documented at
|
|
|
|
* nsICacheStorageConsumptionObserver.
|
|
|
|
* NOTE: the observer MUST implement nsISupportsWeakReference.
|
|
|
|
*/
|
|
|
|
void asyncGetDiskConsumption(in nsICacheStorageConsumptionObserver aObserver);
|
|
|
|
};
|
|
|
|
|
|
|
|
[scriptable, uuid(7728ab5b-4c01-4483-a606-32bf5b8136cb)]
|
|
|
|
interface nsICacheStorageConsumptionObserver : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Callback invoked to answer asyncGetDiskConsumption call. Always triggered
|
|
|
|
* on the main thread.
|
|
|
|
* NOTE: implementers must also implement nsISupportsWeakReference.
|
|
|
|
*
|
|
|
|
* @param aDiskSize
|
|
|
|
* The disk consumption in bytes.
|
|
|
|
*/
|
|
|
|
void onNetworkCacheDiskConsumption(in int64_t aDiskSize);
|
2013-09-20 13:11:25 +04:00
|
|
|
};
|