Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
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 nsICacheEntryDescriptor; |
michael@0 | 11 | interface nsICacheListener; |
michael@0 | 12 | interface nsIFile; |
michael@0 | 13 | |
michael@0 | 14 | [scriptable, uuid(1dd7708c-de48-4ffe-b5aa-cd218c762887)] |
michael@0 | 15 | interface nsICacheSession : nsISupports |
michael@0 | 16 | { |
michael@0 | 17 | /** |
michael@0 | 18 | * Expired entries will be doomed or evicted if this attribute is set to |
michael@0 | 19 | * true. If false, expired entries will be returned (useful for offline- |
michael@0 | 20 | * mode and clients, such as HTTP, that can update the valid lifetime of |
michael@0 | 21 | * cached content). This attribute defaults to true. |
michael@0 | 22 | */ |
michael@0 | 23 | attribute boolean doomEntriesIfExpired; |
michael@0 | 24 | |
michael@0 | 25 | /** |
michael@0 | 26 | * When set, entries created with this session will be placed to a cache |
michael@0 | 27 | * based at this directory. Use when storing entries to a different |
michael@0 | 28 | * profile than the active profile of the the current running application |
michael@0 | 29 | * process. |
michael@0 | 30 | */ |
michael@0 | 31 | attribute nsIFile profileDirectory; |
michael@0 | 32 | |
michael@0 | 33 | /** |
michael@0 | 34 | * A cache session can only give out one descriptor with WRITE access |
michael@0 | 35 | * to a given cache entry at a time. Until the client calls MarkValid on |
michael@0 | 36 | * its descriptor, other attempts to open the same cache entry will block. |
michael@0 | 37 | */ |
michael@0 | 38 | |
michael@0 | 39 | /** |
michael@0 | 40 | * Synchronous cache access. This method fails if it is called on the main |
michael@0 | 41 | * thread. Use asyncOpenCacheEntry() instead. This returns a unique |
michael@0 | 42 | * descriptor each time it is called, even if the same key is specified. |
michael@0 | 43 | * When called by multiple threads for write access, only one writable |
michael@0 | 44 | * descriptor will be granted. If 'blockingMode' is set to false, it will |
michael@0 | 45 | * return NS_ERROR_CACHE_WAIT_FOR_VALIDATION rather than block when another |
michael@0 | 46 | * descriptor has been given WRITE access but hasn't validated the entry yet. |
michael@0 | 47 | */ |
michael@0 | 48 | nsICacheEntryDescriptor openCacheEntry(in ACString key, |
michael@0 | 49 | in nsCacheAccessMode accessRequested, |
michael@0 | 50 | in boolean blockingMode); |
michael@0 | 51 | |
michael@0 | 52 | /** |
michael@0 | 53 | * Asynchronous cache access. Does not block the calling thread. Instead, |
michael@0 | 54 | * the listener will be notified when the descriptor is available. If |
michael@0 | 55 | * 'noWait' is set to true, the listener will be notified immediately with |
michael@0 | 56 | * status NS_ERROR_CACHE_WAIT_FOR_VALIDATION rather than queuing the request |
michael@0 | 57 | * when another descriptor has been given WRITE access but hasn't validated |
michael@0 | 58 | * the entry yet. |
michael@0 | 59 | */ |
michael@0 | 60 | void asyncOpenCacheEntry(in ACString key, |
michael@0 | 61 | in nsCacheAccessMode accessRequested, |
michael@0 | 62 | in nsICacheListener listener, |
michael@0 | 63 | [optional] in boolean noWait); |
michael@0 | 64 | |
michael@0 | 65 | /** |
michael@0 | 66 | * Evict all entries for this session's clientID according to its storagePolicy. |
michael@0 | 67 | */ |
michael@0 | 68 | void evictEntries(); |
michael@0 | 69 | |
michael@0 | 70 | /** |
michael@0 | 71 | * Return whether any of the cache devices implied by the session storage policy |
michael@0 | 72 | * are currently enabled for instantiation if they don't already exist. |
michael@0 | 73 | */ |
michael@0 | 74 | boolean isStorageEnabled(); |
michael@0 | 75 | |
michael@0 | 76 | /** |
michael@0 | 77 | * Asynchronously doom an entry specified by the key. Listener will be |
michael@0 | 78 | * notified about the status of the operation. Null may be passed if caller |
michael@0 | 79 | * doesn't care about the result. |
michael@0 | 80 | */ |
michael@0 | 81 | void doomEntry(in ACString key, in nsICacheListener listener); |
michael@0 | 82 | |
michael@0 | 83 | /** |
michael@0 | 84 | * Private entries will be doomed when the last private browsing session |
michael@0 | 85 | * finishes. |
michael@0 | 86 | */ |
michael@0 | 87 | attribute boolean isPrivate; |
michael@0 | 88 | }; |