netwerk/cache2/nsICacheStorageService.idl

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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

mercurial