Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "nsISupports.idl" |
michael@0 | 8 | #include "nsICache.idl" |
michael@0 | 9 | |
michael@0 | 10 | interface nsISimpleEnumerator; |
michael@0 | 11 | interface nsICacheListener; |
michael@0 | 12 | interface nsICacheSession; |
michael@0 | 13 | interface nsICacheVisitor; |
michael@0 | 14 | interface nsIEventTarget; |
michael@0 | 15 | |
michael@0 | 16 | [scriptable, uuid(14dbe1e9-f3bc-45af-92f4-2c574fcd4e39)] |
michael@0 | 17 | interface nsICacheService : nsISupports |
michael@0 | 18 | { |
michael@0 | 19 | /** |
michael@0 | 20 | * Create a cache session |
michael@0 | 21 | * |
michael@0 | 22 | * A cache session represents a client's access into the cache. The cache |
michael@0 | 23 | * session is not "owned" by the cache service. Hence, it is possible to |
michael@0 | 24 | * create duplicate cache sessions. Entries created by a cache session |
michael@0 | 25 | * are invisible to other cache sessions, unless the cache sessions are |
michael@0 | 26 | * equivalent. |
michael@0 | 27 | * |
michael@0 | 28 | * @param clientID - Specifies the name of the client using the cache. |
michael@0 | 29 | * @param storagePolicy - Limits the storage policy for all entries |
michael@0 | 30 | * accessed via the returned session. As a result, devices excluded |
michael@0 | 31 | * by the storage policy will not be searched when opening entries |
michael@0 | 32 | * from the returned session. |
michael@0 | 33 | * @param streamBased - Indicates whether or not the data being cached |
michael@0 | 34 | * can be represented as a stream. The storagePolicy must be |
michael@0 | 35 | * consistent with the value of this field. For example, a non-stream- |
michael@0 | 36 | * based cache entry can only have a storage policy of STORE_IN_MEMORY. |
michael@0 | 37 | * @return new cache session. |
michael@0 | 38 | */ |
michael@0 | 39 | nsICacheSession createSession(in string clientID, |
michael@0 | 40 | in nsCacheStoragePolicy storagePolicy, |
michael@0 | 41 | in boolean streamBased); |
michael@0 | 42 | |
michael@0 | 43 | /** |
michael@0 | 44 | * Visit entries stored in the cache. Used to implement about:cache. |
michael@0 | 45 | */ |
michael@0 | 46 | void visitEntries(in nsICacheVisitor visitor); |
michael@0 | 47 | |
michael@0 | 48 | /** |
michael@0 | 49 | * Evicts all entries in all devices implied by the storage policy. |
michael@0 | 50 | * |
michael@0 | 51 | * @note This function may evict some items but will throw if it fails to evict |
michael@0 | 52 | * everything. |
michael@0 | 53 | */ |
michael@0 | 54 | void evictEntries(in nsCacheStoragePolicy storagePolicy); |
michael@0 | 55 | |
michael@0 | 56 | /** |
michael@0 | 57 | * Event target which is used for I/O operations |
michael@0 | 58 | */ |
michael@0 | 59 | readonly attribute nsIEventTarget cacheIOTarget; |
michael@0 | 60 | }; |
michael@0 | 61 | |
michael@0 | 62 | %{C++ |
michael@0 | 63 | /** |
michael@0 | 64 | * Observer service notification that is sent when |
michael@0 | 65 | * nsICacheService::evictEntries() or nsICacheSession::evictEntries() |
michael@0 | 66 | * is called. |
michael@0 | 67 | */ |
michael@0 | 68 | #define NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID "cacheservice:empty-cache" |
michael@0 | 69 | %} |
michael@0 | 70 | |
michael@0 | 71 | [scriptable, builtinclass, uuid(d0fc8d38-db80-4928-bf1c-b0085ddfa9dc)] |
michael@0 | 72 | interface nsICacheServiceInternal : nsICacheService |
michael@0 | 73 | { |
michael@0 | 74 | /** |
michael@0 | 75 | * This is an internal interface. It changes so frequently that it probably |
michael@0 | 76 | * went away while you were reading this. |
michael@0 | 77 | */ |
michael@0 | 78 | |
michael@0 | 79 | /** |
michael@0 | 80 | * Milliseconds for which the service lock has been held. 0 if unlocked. |
michael@0 | 81 | */ |
michael@0 | 82 | readonly attribute double lockHeldTime; |
michael@0 | 83 | }; |
michael@0 | 84 | |
michael@0 | 85 |