Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
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_ |