netwerk/cache2/nsICacheEntryOpenCallback.idl

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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 nsICacheEntry;
michael@0 8 interface nsIApplicationCache;
michael@0 9
michael@0 10 [scriptable, uuid(1fc9fe11-c6ac-4748-94bd-8555a5a12b94)]
michael@0 11 interface nsICacheEntryOpenCallback : nsISupports
michael@0 12 {
michael@0 13 /**
michael@0 14 * State of the entry determined by onCacheEntryCheck.
michael@0 15 *
michael@0 16 * ENTRY_WANTED - the consumer is interested in the entry, we will pass it.
michael@0 17 * RECHECK_AFTER_WRITE_FINISHED - the consumer cannot use the entry while data is
michael@0 18 * still being written and wants to check it again after the current write is
michael@0 19 * finished. This actually prevents concurrent read/write and is used with
michael@0 20 * non-resumable HTTP responses.
michael@0 21 * ENTRY_NEEDS_REVALIDATION - entry needs to be revalidated first with origin server,
michael@0 22 * this means the loading channel will decide whether to use the entry content
michael@0 23 * as is after it gets a positive response from the server about validity of the
michael@0 24 * content ; when a new content needs to be loaded from the server, the loading
michael@0 25 * channel opens a new entry with OPEN_TRUNCATE flag which dooms the one
michael@0 26 * this check has been made for.
michael@0 27 * ENTRY_NOT_WANTED - the consumer is not interested in the entry, we will not pass it.
michael@0 28 */
michael@0 29 const unsigned long ENTRY_WANTED = 0;
michael@0 30 const unsigned long RECHECK_AFTER_WRITE_FINISHED = 1;
michael@0 31 const unsigned long ENTRY_NEEDS_REVALIDATION = 2;
michael@0 32 const unsigned long ENTRY_NOT_WANTED = 3;
michael@0 33
michael@0 34 /**
michael@0 35 * Callback to perform any validity checks before the entry should be used.
michael@0 36 * Called before onCacheEntryAvailable callback, depending on the result it
michael@0 37 * may be called more then one time.
michael@0 38 *
michael@0 39 * This callback is ensured to be called on the same thread on which asyncOpenURI
michael@0 40 * has been called, unless nsICacheStorage.CHECK_MULTITHREADED flag has been specified.
michael@0 41 * In that case this callback can be invoked on any thread, usually it is the cache I/O
michael@0 42 * or cache management thread.
michael@0 43 *
michael@0 44 * IMPORTANT NOTE:
michael@0 45 * This callback may be invoked sooner then respective asyncOpenURI call exits.
michael@0 46 *
michael@0 47 * @param aEntry
michael@0 48 * An entry to examine. Consumer has a chance to decide whether the
michael@0 49 * entry is valid or not.
michael@0 50 * @param aApplicationCache
michael@0 51 * Optional, application cache the entry has been found in, if any.
michael@0 52 * @return
michael@0 53 * State of the entry, see the constants just above.
michael@0 54 */
michael@0 55 unsigned long onCacheEntryCheck(in nsICacheEntry aEntry,
michael@0 56 in nsIApplicationCache aApplicationCache);
michael@0 57
michael@0 58 /**
michael@0 59 * Callback giving actual result of asyncOpenURI. It may give consumer the cache
michael@0 60 * entry or a failure result when it's not possible to open it from some reason.
michael@0 61 * This callback is ensured to be called on the same thread on which asyncOpenURI
michael@0 62 * has been called.
michael@0 63 *
michael@0 64 * IMPORTANT NOTE:
michael@0 65 * This callback may be invoked sooner then respective asyncOpenURI call exits.
michael@0 66 *
michael@0 67 * @param aEntry
michael@0 68 * The entry bound to the originally requested URI. May be null when
michael@0 69 * loading from a particular application cache and the URI has not
michael@0 70 * been found in that application cache.
michael@0 71 * @param aNew
michael@0 72 * Whether no data so far has been stored for this entry, i.e. reading
michael@0 73 * it will just fail. When aNew is true, a server request should be
michael@0 74 * made and data stored to this new entry.
michael@0 75 * @param aApplicationCache
michael@0 76 * When an entry had been found in an application cache, this is the
michael@0 77 * given application cache. It should be associated with the loading
michael@0 78 * channel.
michael@0 79 * @param aResult
michael@0 80 * Result of the request. This may be a failure only when one of these
michael@0 81 * issues occur:
michael@0 82 * - the cache storage service could not be started due to some unexpected
michael@0 83 * faulure
michael@0 84 * - there is not enough disk space to create new entries
michael@0 85 * - cache entry was not found in a given application cache
michael@0 86 */
michael@0 87 void onCacheEntryAvailable(in nsICacheEntry aEntry,
michael@0 88 in boolean aNew,
michael@0 89 in nsIApplicationCache aApplicationCache,
michael@0 90 in nsresult aResult);
michael@0 91 };

mercurial