author Ryan VanderMeulen <>
Wed, 19 Jun 2013 20:32:47 -0400
changeset 147226 0bd279c73d1fc81e148e44ff134400095ea47ade
parent 143189 e1eb29a56dab37ba0fe5e7f8f2eb778ae772c88d
child 206077 d405928cb93469b7559d9599a719dae9ba670586
permissions -rw-r--r--
Backed out changeset 833ca9a17792 (bug 874132) for Android bustage on a CLOSED TREE.

/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * 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 */

#include "nsISupports.idl"
#include "nsICache.idl"

interface nsISimpleEnumerator;
interface nsICacheListener;
interface nsICacheSession;
interface nsICacheVisitor;
interface nsIEventTarget;

[scriptable, uuid(14dbe1e9-f3bc-45af-92f4-2c574fcd4e39)]
interface nsICacheService : nsISupports
     * Create a cache session
     * A cache session represents a client's access into the cache.  The cache
     * session is not "owned" by the cache service.  Hence, it is possible to
     * create duplicate cache sessions.  Entries created by a cache session
     * are invisible to other cache sessions, unless the cache sessions are
     * equivalent.
     * @param clientID - Specifies the name of the client using the cache.
     * @param storagePolicy - Limits the storage policy for all entries
     *   accessed via the returned session.  As a result, devices excluded
     *   by the storage policy will not be searched when opening entries
     *   from the returned session.
     * @param streamBased - Indicates whether or not the data being cached
     *   can be represented as a stream.  The storagePolicy must be 
     *   consistent with the value of this field.  For example, a non-stream-
     *   based cache entry can only have a storage policy of STORE_IN_MEMORY.
     * @return new cache session.
    nsICacheSession createSession(in string                 clientID,
                                  in nsCacheStoragePolicy   storagePolicy,
                                  in boolean                streamBased);

     * Visit entries stored in the cache.  Used to implement about:cache.
    void visitEntries(in nsICacheVisitor visitor);

     * Evicts all entries in all devices implied by the storage policy.
     * @note This function may evict some items but will throw if it fails to evict
     *       everything.
    void evictEntries(in nsCacheStoragePolicy  storagePolicy);

     * Event target which is used for I/O operations
    readonly attribute nsIEventTarget cacheIOTarget;

 * Observer service notification that is sent when
 * nsICacheService::evictEntries() or nsICacheSession::evictEntries()
 * is called.
#define NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID "cacheservice:empty-cache"

[scriptable, builtinclass, uuid(d0fc8d38-db80-4928-bf1c-b0085ddfa9dc)]
interface nsICacheServiceInternal : nsICacheService
     * This is an internal interface. It changes so frequently that it probably
     * went away while you were reading this.

     * Milliseconds for which the service lock has been held. 0 if unlocked.
    readonly attribute double lockHeldTime;