netwerk/cache/nsCacheDevice.h

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 /* -*- Mode: C++; 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 #ifndef _nsCacheDevice_h_
michael@0 8 #define _nsCacheDevice_h_
michael@0 9
michael@0 10 #include "nspr.h"
michael@0 11 #include "nsError.h"
michael@0 12 #include "nsICache.h"
michael@0 13
michael@0 14 class nsIFile;
michael@0 15 class nsCString;
michael@0 16 class nsCacheEntry;
michael@0 17 class nsICacheVisitor;
michael@0 18 class nsIInputStream;
michael@0 19 class nsIOutputStream;
michael@0 20
michael@0 21 /******************************************************************************
michael@0 22 * nsCacheDevice
michael@0 23 *******************************************************************************/
michael@0 24 class nsCacheDevice {
michael@0 25 public:
michael@0 26 nsCacheDevice() { MOZ_COUNT_CTOR(nsCacheDevice); }
michael@0 27 virtual ~nsCacheDevice() { MOZ_COUNT_DTOR(nsCacheDevice); }
michael@0 28
michael@0 29 virtual nsresult Init() = 0;
michael@0 30 virtual nsresult Shutdown() = 0;
michael@0 31
michael@0 32 virtual const char * GetDeviceID(void) = 0;
michael@0 33 virtual nsCacheEntry * FindEntry( nsCString * key, bool *collision ) = 0;
michael@0 34
michael@0 35 virtual nsresult DeactivateEntry( nsCacheEntry * entry ) = 0;
michael@0 36 virtual nsresult BindEntry( nsCacheEntry * entry ) = 0;
michael@0 37 virtual void DoomEntry( nsCacheEntry * entry ) = 0;
michael@0 38
michael@0 39 virtual nsresult OpenInputStreamForEntry(nsCacheEntry * entry,
michael@0 40 nsCacheAccessMode mode,
michael@0 41 uint32_t offset,
michael@0 42 nsIInputStream ** result) = 0;
michael@0 43
michael@0 44 virtual nsresult OpenOutputStreamForEntry(nsCacheEntry * entry,
michael@0 45 nsCacheAccessMode mode,
michael@0 46 uint32_t offset,
michael@0 47 nsIOutputStream ** result) = 0;
michael@0 48
michael@0 49 virtual nsresult GetFileForEntry( nsCacheEntry * entry,
michael@0 50 nsIFile ** result ) = 0;
michael@0 51
michael@0 52 virtual nsresult OnDataSizeChange( nsCacheEntry * entry, int32_t deltaSize ) = 0;
michael@0 53
michael@0 54 virtual nsresult Visit(nsICacheVisitor * visitor) = 0;
michael@0 55
michael@0 56 /**
michael@0 57 * Device must evict entries associated with clientID. If clientID == nullptr, all
michael@0 58 * entries must be evicted. Active entries must be doomed, rather than evicted.
michael@0 59 */
michael@0 60 virtual nsresult EvictEntries(const char * clientID) = 0;
michael@0 61 };
michael@0 62
michael@0 63 #endif // _nsCacheDevice_h_

mercurial