netwerk/cache2/nsICacheStorage.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #include "nsISupports.idl"
michael@0 6
michael@0 7 interface nsIURI;
michael@0 8 interface nsICacheEntryOpenCallback;
michael@0 9 interface nsICacheEntryDoomCallback;
michael@0 10 interface nsICacheStorageVisitor;
michael@0 11
michael@0 12 /**
michael@0 13 * Representation of a cache storage. There can be just-in-mem,
michael@0 14 * in-mem+on-disk, in-mem+on-disk+app-cache or just a specific
michael@0 15 * app-cache storage.
michael@0 16 */
michael@0 17 [scriptable, uuid(d983ba0c-433f-4017-abc1-93af737c82e4)]
michael@0 18 interface nsICacheStorage : nsISupports
michael@0 19 {
michael@0 20 /**
michael@0 21 * Placeholder for specifying "no special flags" during open.
michael@0 22 */
michael@0 23 const uint32_t OPEN_NORMALLY = 0;
michael@0 24
michael@0 25 /**
michael@0 26 * Rewrite any existing data when opening a URL.
michael@0 27 */
michael@0 28 const uint32_t OPEN_TRUNCATE = 1 << 0;
michael@0 29
michael@0 30 /**
michael@0 31 * Only open an existing entry. Don't create a new one.
michael@0 32 */
michael@0 33 const uint32_t OPEN_READONLY = 1 << 1;
michael@0 34
michael@0 35 /**
michael@0 36 * Use for first-paint blocking loads.
michael@0 37 */
michael@0 38 const uint32_t OPEN_PRIORITY = 1 << 2;
michael@0 39
michael@0 40 /**
michael@0 41 * Bypass the cache load when write is still in progress.
michael@0 42 */
michael@0 43 const uint32_t OPEN_BYPASS_IF_BUSY = 1 << 3;
michael@0 44
michael@0 45 /**
michael@0 46 * Perform the cache entry check (onCacheEntryCheck invocation) on any thread
michael@0 47 * for optimal perfomance optimization. If this flag is not specified it is
michael@0 48 * ensured that onCacheEntryCheck is called on the same thread as respective
michael@0 49 * asyncOpen has been called.
michael@0 50 */
michael@0 51 const uint32_t CHECK_MULTITHREADED = 1 << 4;
michael@0 52
michael@0 53 /**
michael@0 54 * Asynchronously opens a cache entry for the specified URI.
michael@0 55 * Result is fetched asynchronously via the callback.
michael@0 56 *
michael@0 57 * @param aURI
michael@0 58 * The URI to search in cache or to open for writting.
michael@0 59 * @param aIdExtension
michael@0 60 * Any string that will extend (distinguish) the entry. Two entries
michael@0 61 * with the same aURI but different aIdExtension will be comletely
michael@0 62 * different entries. If you don't know what aIdExtension should be
michael@0 63 * leave it empty.
michael@0 64 * @param aFlags
michael@0 65 * OPEN_NORMALLY - open cache entry normally for read and write
michael@0 66 * OPEN_TRUNCATE - delete any existing entry before opening it
michael@0 67 * OPEN_READONLY - don't create an entry if there is none
michael@0 68 * OPEN_PRIORITY - give this request a priority over others
michael@0 69 * OPEN_BYPASS_IF_BUSY - backward compatibility only, LOAD_BYPASS_LOCAL_CACHE_IF_BUSY
michael@0 70 * CHECK_MULTITHREADED - onCacheEntryCheck may be called on any thread, consumer
michael@0 71 * implementation is thread-safe
michael@0 72 * @param aCallback
michael@0 73 * The consumer that receives the result.
michael@0 74 * IMPORTANT: The callback may be called sooner the method returns.
michael@0 75 */
michael@0 76 void asyncOpenURI(in nsIURI aURI, in ACString aIdExtension,
michael@0 77 in uint32_t aFlags,
michael@0 78 in nsICacheEntryOpenCallback aCallback);
michael@0 79
michael@0 80 /**
michael@0 81 * Asynchronously removes an entry belonging to the URI from the cache.
michael@0 82 */
michael@0 83 void asyncDoomURI(in nsIURI aURI, in ACString aIdExtension,
michael@0 84 in nsICacheEntryDoomCallback aCallback);
michael@0 85
michael@0 86 /**
michael@0 87 * Asynchronously removes all cached entries under this storage.
michael@0 88 * NOTE: Disk storage also evicts memory storage.
michael@0 89 */
michael@0 90 void asyncEvictStorage(in nsICacheEntryDoomCallback aCallback);
michael@0 91
michael@0 92 /**
michael@0 93 * Visits the storage and its entries.
michael@0 94 * NOTE: Disk storage also visits memory storage.
michael@0 95 */
michael@0 96 void asyncVisitStorage(in nsICacheStorageVisitor aVisitor,
michael@0 97 in boolean aVisitEntries);
michael@0 98 };

mercurial