DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

IDL

Mercurial (d38398e5144e)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
/* 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;
interface nsICacheStorageConsumptionObserver;
interface nsICacheStorageVisitor;

/**
 * Provides access to particual cache storages of the network URI cache.
 */
[scriptable, uuid(ae29c44b-fbc3-4552-afaf-0a157ce771e7)]
interface nsICacheStorageService : nsISupports
{
  /**
   * Get storage where entries will only remain in memory, never written
   * to the disk.
   *
   * 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.
   *
   * @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 where entries will be written to disk and marked as pinned.
   * These pinned entries are immune to over limit eviction and call of clear()
   * on this service.
   */
  nsICacheStorage pinningCacheStorage(in nsILoadContextInfo aLoadContextInfo);

  /**
   * 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);

  /**
   * Get storage for synthesized cache entries that we currently use for ServiceWorker interception in non-e10s mode.
   *
   * This cache storage has no limits on file size to allow the ServiceWorker to intercept large files.
   */
  nsICacheStorage synthesizedCacheStorage(in nsILoadContextInfo aLoadContextInfo);

  /**
   * 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;

  /**
   * 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);

  /**
   * Asynchronously visits all storages of the disk cache and memory cache.
   * @see nsICacheStorageVisitor
   * @param aVisitor
   *   A visitor callback.
   * @param aVisitEntries
   *   A boolean indicates whether visits entries.
   */
  void asyncVisitAllStorages(in nsICacheStorageVisitor aVisitor,
                             in boolean aVisitEntries);
};

[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);
};