netwerk/cache2/nsICacheStorageService.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #include "nsISupports.idl"
michael@0 6
michael@0 7 interface nsICacheStorage;
michael@0 8 interface nsILoadContextInfo;
michael@0 9 interface nsIApplicationCache;
michael@0 10 interface nsIEventTarget;
michael@0 11 interface nsICacheStorageConsumptionObserver;
michael@0 12
michael@0 13 /**
michael@0 14 * Provides access to particual cache storages of the network URI cache.
michael@0 15 */
michael@0 16 [scriptable, uuid(44de2fa4-1b0e-4cd3-9e32-211e936f721e)]
michael@0 17 interface nsICacheStorageService : nsISupports
michael@0 18 {
michael@0 19 /**
michael@0 20 * Get storage where entries will only remain in memory, never written
michael@0 21 * to the disk.
michael@0 22 *
michael@0 23 * @param aLoadContextInfo
michael@0 24 * Information about the loading context, this focuses the storage JAR and
michael@0 25 * respects separate storage for private browsing.
michael@0 26 */
michael@0 27 nsICacheStorage memoryCacheStorage(in nsILoadContextInfo aLoadContextInfo);
michael@0 28
michael@0 29 /**
michael@0 30 * Get storage where entries will be written to disk when not forbidden by
michael@0 31 * response headers.
michael@0 32 *
michael@0 33 * @param aLookupAppCache
michael@0 34 * When set true (for top level document loading channels) app cache will
michael@0 35 * be first to check on to find entries in.
michael@0 36 */
michael@0 37 nsICacheStorage diskCacheStorage(in nsILoadContextInfo aLoadContextInfo,
michael@0 38 in bool aLookupAppCache);
michael@0 39
michael@0 40 /**
michael@0 41 * Get storage for a specified application cache obtained using some different
michael@0 42 * mechanism.
michael@0 43 *
michael@0 44 * @param aLoadContextInfo
michael@0 45 * Mandatory reference to a load context information.
michael@0 46 * @param aApplicationCache
michael@0 47 * Optional reference to an existing appcache. When left null, this will
michael@0 48 * work with offline cache as a whole.
michael@0 49 */
michael@0 50 nsICacheStorage appCacheStorage(in nsILoadContextInfo aLoadContextInfo,
michael@0 51 in nsIApplicationCache aApplicationCache);
michael@0 52
michael@0 53 /**
michael@0 54 * Evict the whole cache.
michael@0 55 */
michael@0 56 void clear();
michael@0 57
michael@0 58 /**
michael@0 59 * Purge only data of disk backed entries. Metadata are left for
michael@0 60 * performance purposes.
michael@0 61 */
michael@0 62 const uint32_t PURGE_DISK_DATA_ONLY = 1;
michael@0 63 /**
michael@0 64 * Purge whole disk backed entries from memory. Disk files will
michael@0 65 * be left unattended.
michael@0 66 */
michael@0 67 const uint32_t PURGE_DISK_ALL = 2;
michael@0 68 /**
michael@0 69 * Purge all entries we keep in memory, including memory-storage
michael@0 70 * entries. This may be dangerous to use.
michael@0 71 */
michael@0 72 const uint32_t PURGE_EVERYTHING = 3;
michael@0 73 /**
michael@0 74 * Purges data we keep warmed in memory. Use for tests and for
michael@0 75 * saving memory.
michael@0 76 */
michael@0 77 void purgeFromMemory(in uint32_t aWhat);
michael@0 78
michael@0 79 /**
michael@0 80 * I/O thread target to use for any operations on disk
michael@0 81 */
michael@0 82 readonly attribute nsIEventTarget ioTarget;
michael@0 83
michael@0 84 /**
michael@0 85 * Asynchronously determine how many bytes of the disk space the cache takes.
michael@0 86 * @see nsICacheStorageConsumptionObserver
michael@0 87 * @param aObserver
michael@0 88 * A mandatory (weak referred) observer. Documented at
michael@0 89 * nsICacheStorageConsumptionObserver.
michael@0 90 * NOTE: the observer MUST implement nsISupportsWeakReference.
michael@0 91 */
michael@0 92 void asyncGetDiskConsumption(in nsICacheStorageConsumptionObserver aObserver);
michael@0 93 };
michael@0 94
michael@0 95 [scriptable, uuid(7728ab5b-4c01-4483-a606-32bf5b8136cb)]
michael@0 96 interface nsICacheStorageConsumptionObserver : nsISupports
michael@0 97 {
michael@0 98 /**
michael@0 99 * Callback invoked to answer asyncGetDiskConsumption call. Always triggered
michael@0 100 * on the main thread.
michael@0 101 * NOTE: implementers must also implement nsISupportsWeakReference.
michael@0 102 *
michael@0 103 * @param aDiskSize
michael@0 104 * The disk consumption in bytes.
michael@0 105 */
michael@0 106 void onNetworkCacheDiskConsumption(in int64_t aDiskSize);
michael@0 107 };

mercurial