зеркало из https://github.com/mozilla/gecko-dev.git
86 строки
2.9 KiB
Plaintext
86 строки
2.9 KiB
Plaintext
/* -*- 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 http://mozilla.org/MPL/2.0/. */
|
|
|
|
#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;
|
|
};
|
|
|
|
%{C++
|
|
/**
|
|
* 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;
|
|
};
|
|
|
|
|