webengine/osswebengine/cache/inc/HttpCacheStreamHandler.h
changeset 10 a359256acfc6
parent 1 7c90e6132015
child 11 c8a366e56285
equal deleted inserted replaced
5:10e98eab6f85 10:a359256acfc6
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Definition of CHttpCacheStreamHandler  
    14 * Description:  Definition of CHttpCacheStreamHandler
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #ifndef CHTTPCACHESTREAMHANDLER_H
    18 #ifndef CHTTPCACHESTREAMHANDLER_H
    19 #define CHTTPCACHESTREAMHANDLER_H
    19 #define CHTTPCACHESTREAMHANDLER_H
    20 
    20 
    21 //  INCLUDES
    21 //  INCLUDES
       
    22 
    22 #include <e32base.h>
    23 #include <e32base.h>
    23 #include <f32file.h>
    24 #include <f32file.h>
    24 #include <s32file.h>
    25 #include <s32file.h>
       
    26 #include "HttpCacheHandler.h"
    25 
    27 
    26 // CONSTANTS
    28 // CONSTANTS
    27 
    29 
    28 // MACROS
    30 // MACROS
    29 
    31 
    33 
    35 
    34 // FORWARD DECLARATIONS
    36 // FORWARD DECLARATIONS
    35 class CHttpCacheEntry;
    37 class CHttpCacheEntry;
    36 class RFileWriteStream;
    38 class RFileWriteStream;
    37 class RFileReadStream;
    39 class RFileReadStream;
       
    40 class CHttpCacheFileWriteHandler;
       
    41 class CSegmentedHeapBuffer;
    38 
    42 
    39 // CLASS DECLARATION
    43 // CLASS DECLARATION
    40 
    44 
    41 /**
    45 /**
    42 *
    46 *
    52         * @since 3.1
    56         * @since 3.1
    53         * @param
    57         * @param
    54         * @param
    58         * @param
    55         * @return CHttpCacheStreamHandler object.
    59         * @return CHttpCacheStreamHandler object.
    56         */
    60         */
    57         static CHttpCacheStreamHandler* NewL( const TDesC& aDirectory, TInt aCriticalLevel );
    61         static CHttpCacheStreamHandler* NewL( const TDesC& aDirectory, TInt aCriticalLevel, RFs& aRFs );
    58 
    62 
    59         /**
    63         /**
    60         * Destructor.
    64         * Destructor.
    61         */
    65         */
    62         virtual ~CHttpCacheStreamHandler();
    66         virtual ~CHttpCacheStreamHandler();
    63 
    67 
    64     public: // new functions
    68     public: // new functions
    65 
    69 
       
    70         void InitialiseCacheEntryL(CHttpCacheEntry& aCacheEntry);
       
    71 
    66         /**
    72         /**
    67         *
    73         *
    68         * @since 3.1
    74         * @since 3.1
    69         * @param
    75         * @param
    70         * @return
    76         * @return
    83         *
    89         *
    84         * @since 3.1
    90         * @since 3.1
    85         * @param
    91         * @param
    86         * @return
    92         * @return
    87         */
    93         */
    88         TBool AttachL( CHttpCacheEntry& aCacheEntry );
    94         void Erase( CHttpCacheEntry& aCacheEntry );
    89 
       
    90         /**
       
    91         *
       
    92         * @since 3.1
       
    93         * @param
       
    94         * @return
       
    95         */
       
    96         void Detach( CHttpCacheEntry& aCacheEntry );
       
    97 
       
    98         /**
       
    99         *
       
   100         * @since 3.1
       
   101         * @param
       
   102         * @return
       
   103         */
       
   104         void EraseCacheFile( CHttpCacheEntry& aCacheEntry );
       
   105 
    95 
   106         /**
    96         /**
   107         *
    97         *
   108         * @since 3.1
    98         * @since 3.1
   109         * @param
    99         * @param
   158         * @return
   148         * @return
   159         */
   149         */
   160         TBool Flush( CHttpCacheEntry& aCacheEntry );
   150         TBool Flush( CHttpCacheEntry& aCacheEntry );
   161 
   151 
   162         /**
   152         /**
   163         *
   153         * FlushL
   164         * @since 3.1
   154         * @since 7.1
   165         * @param
   155         * @param
   166         * @return
   156         * @return
   167         */
   157         */
   168         TBool OpenCacheFiles( CHttpCacheEntry& aCacheEntry );
   158         TBool FlushL( CHttpCacheEntry& aCacheEntry );
   169 
   159 
   170         /**
   160         /**
   171         *
   161         * FlushAsync
   172         * @since 3.1
   162         * @since 7.1
   173         * @param
   163         * @param
   174         * @return
   164         * @return
   175         */
   165         */
   176         TBool CreateNewFilesL( CHttpCacheEntry& aCacheEntry );
   166         TBool FlushAsync( CHttpCacheEntry& aCacheEntry , TRequestStatus& aStatus);
       
   167 
       
   168         /**
       
   169         *
       
   170         * @since 7.1
       
   171         * @param
       
   172         * @return
       
   173         */
       
   174         TBool OpenBodyFile( CHttpCacheEntry& aCacheEntry );
       
   175 
       
   176         /**
       
   177         *
       
   178         * @since 7.1
       
   179         * @param
       
   180         * @return
       
   181         */
       
   182         TBool CreateNewBodyFile( CHttpCacheEntry& aCacheEntry );
   177 
   183 
   178     private:
   184     private:
   179 
   185 
   180         /**
   186         /**
   181         * Construct.
   187         * Construct.
   182         * @since 3.1
   188         * @since 3.1
   183         * @param
   189         * @param
   184         * @param
   190         * @param
   185         * @return CacheHandler object.
   191         * @return CacheHandler object.
   186         */
   192         */
   187         CHttpCacheStreamHandler();
   193         CHttpCacheStreamHandler(RFs& aRFs);
   188 
   194 
   189         /**
   195         /**
   190         * By default Symbian 2nd phase constructor is private.
   196         * By default Symbian 2nd phase constructor is private.
   191         */
   197         */
   192         void ConstructL( const TDesC& aDirectory, TInt aCriticalLevel );
   198         void ConstructL( const TDesC& aDirectory, TInt aCriticalLevel );
   198         * @since 3.1
   204         * @since 3.1
   199         * @param
   205         * @param
   200         * @return
   206         * @return
   201         */
   207         */
   202         TBool IsDiskSpaceAvailable( TInt aContentSize );
   208         TBool IsDiskSpaceAvailable( TInt aContentSize );
   203         
   209 
   204         /**
   210         /**
   205         *
   211         *
   206         * @since 7.1
   212         * @since 7.1
   207         * @param
   213         * @param
   208         * @return
   214         * @return
   210         void FindCacheEntryIndex( const CHttpCacheEntry& aCacheEntry, TInt* aIndex );
   216         void FindCacheEntryIndex( const CHttpCacheEntry& aCacheEntry, TInt* aIndex );
   211 
   217 
   212     private:    // Data
   218     private:    // Data
   213 
   219 
   214         //
   220         //
   215         RFs                                 iRfs;               // owned
   221         RFs                                 iRfs;
   216         // attached entries
   222         // attached entries
   217         CArrayPtrFlat<CHttpCacheEntry>*     iActiveEntries;     // owned
   223         CArrayPtrFlat<CHttpCacheEntry>*     iActiveEntries;     // owned
   218         //
   224         //
   219         TInt                                iContentSize;
   225         TInt                                iContentSize;
   220         //
   226         //