netwerk/cache/nsCacheDevice.h

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     2  *
     3  * This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef _nsCacheDevice_h_
     8 #define _nsCacheDevice_h_
    10 #include "nspr.h"
    11 #include "nsError.h"
    12 #include "nsICache.h"
    14 class nsIFile;
    15 class nsCString;
    16 class nsCacheEntry;
    17 class nsICacheVisitor;
    18 class nsIInputStream;
    19 class nsIOutputStream;
    21 /******************************************************************************
    22 * nsCacheDevice
    23 *******************************************************************************/
    24 class nsCacheDevice {
    25 public:
    26     nsCacheDevice() { MOZ_COUNT_CTOR(nsCacheDevice); }
    27     virtual ~nsCacheDevice() { MOZ_COUNT_DTOR(nsCacheDevice); }
    29     virtual nsresult Init() = 0;
    30     virtual nsresult Shutdown() = 0;
    32     virtual const char *   GetDeviceID(void) = 0;
    33     virtual nsCacheEntry * FindEntry( nsCString * key, bool *collision ) = 0;
    35     virtual nsresult DeactivateEntry( nsCacheEntry * entry ) = 0;
    36     virtual nsresult BindEntry( nsCacheEntry * entry ) = 0;
    37     virtual void     DoomEntry( nsCacheEntry * entry ) = 0;
    39     virtual nsresult OpenInputStreamForEntry(nsCacheEntry *     entry,
    40                                              nsCacheAccessMode  mode,
    41                                              uint32_t           offset,
    42                                              nsIInputStream **  result) = 0;
    44     virtual nsresult OpenOutputStreamForEntry(nsCacheEntry *     entry,
    45                                               nsCacheAccessMode  mode,
    46                                               uint32_t           offset,
    47                                               nsIOutputStream ** result) = 0;
    49     virtual nsresult GetFileForEntry( nsCacheEntry *    entry,
    50                                       nsIFile **        result ) = 0;
    52     virtual nsresult OnDataSizeChange( nsCacheEntry * entry, int32_t deltaSize ) = 0;
    54     virtual nsresult Visit(nsICacheVisitor * visitor) = 0;
    56     /**
    57      * Device must evict entries associated with clientID.  If clientID == nullptr, all
    58      * entries must be evicted.  Active entries must be doomed, rather than evicted.
    59      */
    60     virtual nsresult EvictEntries(const char * clientID) = 0;
    61 };
    63 #endif // _nsCacheDevice_h_

mercurial