webengine/osswebengine/cache/inc/HttpCacheFileWriteHandler.h
changeset 11 c8a366e56285
parent 10 a359256acfc6
child 26 cb62a4f66ebe
equal deleted inserted replaced
10:a359256acfc6 11:c8a366e56285
    20 
    20 
    21 //  INCLUDES
    21 //  INCLUDES
    22 #include <e32base.h>
    22 #include <e32base.h>
    23 #include <f32file.h>
    23 #include <f32file.h>
    24 #include "HttpCacheHandler.h"
    24 #include "HttpCacheHandler.h"
       
    25 #include "HttpCacheEntry.h"
    25 #include "MemoryManager.h"
    26 #include "MemoryManager.h"
    26 
    27 
    27 // CONSTANTS
    28 // CONSTANTS
    28 
    29 
    29 // MACROS
    30 // MACROS
    41 /**
    42 /**
    42 *
    43 *
    43 *  @lib
    44 *  @lib
    44 *  @since 5.0
    45 *  @since 5.0
    45 */
    46 */
    46 NONSHARABLE_CLASS(CHttpCacheFileWriteHandler) : public CActive, public MMemoryCollector
    47 NONSHARABLE_CLASS(CHttpCacheFileWriteHandler) : public CActive, public MMemoryCollector, public MHttpCacheEntryDeleteObserver
    47     {
    48     {
    48     public:  // Constructors and destructor
    49     public:  // Constructors and destructor
    49 
    50 
    50         /**
    51         /**
    51         * Two-phased constructor.
    52         * Two-phased constructor.
    52         * @since 5.0
    53         * @since 5.0
    53         * @param
    54         * @param
    54         * @param
    55         * @param
    55         * @return CacheFileWriteHandler object.
    56         * @return CacheFileWriteHandler object.
    56         */
    57         */
    57         static CHttpCacheFileWriteHandler* NewL(CHttpCacheHandler* aManager, CHttpCacheStreamHandler* aStreamHandler, RFs& aRfs, const TInt aWriteTimeout);
    58         static CHttpCacheFileWriteHandler* NewL(CHttpCacheHandler* aManager, CHttpCacheStreamHandler* aStreamHandler, RFs& aRfs, const THttpCachePostponeParameters& aParams);
    58 
    59 
    59         /**
    60         /**
    60         * Destructor.
    61         * Destructor.
    61         */
    62         */
    62         virtual ~CHttpCacheFileWriteHandler();
    63         virtual ~CHttpCacheFileWriteHandler();
    95          * @param
    96          * @param
    96          * @return
    97          * @return
    97          */
    98          */
    98         TBool IsCacheEntryPostponed(const CHttpCacheEntry* aEntry);
    99         TBool IsCacheEntryPostponed(const CHttpCacheEntry* aEntry);
    99 
   100 
       
   101     public: // from MHttpCacheEntryDeleteObserver
       
   102         virtual void EntryDeleted(CHttpCacheEntry *aEntry); 
       
   103         
       
   104         
   100     public: // new functions
   105     public: // new functions
   101         enum TAddStatus {
   106         enum TAddStatus {
   102             EAddedOk,
   107             EAddedOk,
   103             EBodySmallerThanThreshold,
   108             EBodySmallerThanThreshold,
   104             ENotEnoughFreeMemory,
   109             ENotEnoughFreeMemory,
   146         CHttpCacheFileWriteHandler(CHttpCacheHandler* aHandler, CHttpCacheStreamHandler* aStreamHandler, RFs& aRfs);
   151         CHttpCacheFileWriteHandler(CHttpCacheHandler* aHandler, CHttpCacheStreamHandler* aStreamHandler, RFs& aRfs);
   147 
   152 
   148         /**
   153         /**
   149         * By default Symbian 2nd phase constructor is private.
   154         * By default Symbian 2nd phase constructor is private.
   150         */
   155         */
   151         void ConstructL(const TInt aWriteTimeout);
   156         void ConstructL(const THttpCachePostponeParameters& aParams);
   152 
   157 
   153         /**
   158         /**
   154          * from CActive
   159          * from CActive
   155          */
   160          */
   156         void DoCancel();
   161         void DoCancel();
   164 
   169 
   165         void OutputQueueContentToDebug();
   170         void OutputQueueContentToDebug();
   166 
   171 
   167         // sort by size function for arrays of CHttpCacheEntry objects.
   172         // sort by size function for arrays of CHttpCacheEntry objects.
   168         static TInt CompareHttpCacheEntrySize( const CHttpCacheEntry& aFirst, const CHttpCacheEntry& aSecond );
   173         static TInt CompareHttpCacheEntrySize( const CHttpCacheEntry& aFirst, const CHttpCacheEntry& aSecond );
       
   174 
   169         void CollectMemory( TUint aRequired );
   175         void CollectMemory( TUint aRequired );
   170 
   176 
   171         /**
   177         /**
   172          * Callback function for timer to activate writing.
   178          * Callback function for timer to activate writing.
   173          */
   179          */