webengine/osswebengine/cache/inc/HttpCacheEvictionHandler.h
changeset 10 a359256acfc6
parent 1 7c90e6132015
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 CHttpCacheEvictionHandler  
    14 * Description:  Definition of CHttpCacheEvictionHandler
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #ifndef CHTTPCACHEEVICTIONHANDLER_H
    18 #ifndef CHTTPCACHEEVICTIONHANDLER_H
    19 #define CHTTPCACHEEVICTIONHANDLER_H
    19 #define CHTTPCACHEEVICTIONHANDLER_H
    36 // FUNCTION PROTOTYPES
    36 // FUNCTION PROTOTYPES
    37 
    37 
    38 // CLASS DECLARATION
    38 // CLASS DECLARATION
    39 
    39 
    40 /**
    40 /**
    41 *  
    41 *
    42 *  @lib 
    42 *  @lib
    43 *  @since 3.1
    43 *  @since 3.1
    44 */
    44 */
    45 class CHttpCacheEvictionHandler : public CBase
    45 class CHttpCacheEvictionHandler : public CBase
    46     {
    46     {
    47     public:  // Constructors and destructor        
    47     public:  // Constructors and destructor
    48 
    48 
    49         /**
    49         /**
    50         * Two-phased constructor.
    50         * Two-phased constructor.
    51         * @since 3.1
    51         * @since 3.1
    52         * @param 
    52         * @param
    53         * @param 
    53         * @param
    54         * @return CHttpCacheEvictionHandler object.
    54         * @return CHttpCacheEvictionHandler object.
    55         */
    55         */
    56         static CHttpCacheEvictionHandler* NewL();
    56         static CHttpCacheEvictionHandler* NewL();
    57       
    57 
    58         /**
    58         /**
    59         * Destructor.
    59         * Destructor.
    60         */
    60         */
    61         virtual ~CHttpCacheEvictionHandler();
    61         virtual ~CHttpCacheEvictionHandler();
    62         
    62 
    63     public: // new functions
    63     public: // new functions
    64         
       
    65         /**
       
    66         * 
       
    67         * @since 3.1
       
    68         * @param 
       
    69         * @return 
       
    70         */
       
    71         void Insert( CHttpCacheEntry& aCacheEntry ); 
       
    72 
    64 
    73         /**
    65         /**
    74         * 
    66         *
    75         * @since 3.1
    67         * @since 3.1
    76         * @param 
    68         * @param
    77         * @return 
    69         * @return
    78         */
    70         */
    79         void Accessed( CHttpCacheEntry& aCacheEntry ); 
    71         void Insert( CHttpCacheEntry& aCacheEntry );
    80 
    72 
    81         /**
    73         /**
    82         * 
    74         *
    83         * @since 3.1
    75         * @since 3.1
    84         * @param 
    76         * @param
    85         * @return 
    77         * @return
    86         */
    78         */
    87         void Remove( CHttpCacheEntry& aCacheEntry ); 
    79         void Accessed( CHttpCacheEntry& aCacheEntry );
    88 
    80 
    89         /**
    81         /**
    90         * 
    82         *
    91         * @since 3.1
    83         * @since 3.1
    92         * @param 
    84         * @param
    93         * @return 
    85         * @return
       
    86         */
       
    87         void Remove( CHttpCacheEntry& aCacheEntry );
       
    88 
       
    89         /**
       
    90         *
       
    91         * @since 3.1
       
    92         * @param
       
    93         * @return
    94         */
    94         */
    95         void RemoveAll();
    95         void RemoveAll();
    96 
    96 
    97         /**
    97         /**
    98         * 
    98         *
    99         * @since 3.1
    99         * @since 3.1
   100         * @param 
   100         * @param
   101         * @return 
   101         * @return
   102         */
   102         */
   103         CArrayPtrFlat<CHttpCacheEntry>* EvictL( TInt aSpaceNeeded );
   103         CArrayPtrFlat<CHttpCacheEntry>* EvictL( TInt aSpaceNeeded );
   104 
   104 
   105     private:
   105     private:
   106         
   106 
   107         /**
   107         /**
   108         * Construct.
   108         * Construct.
   109         * @since 3.1
   109         * @since 3.1
   110         * @param 
   110         * @param
   111         * @param 
   111         * @param
   112         * @return CHttpCacheEvictionHandler object.
   112         * @return CHttpCacheEvictionHandler object.
   113         */
   113         */
   114         CHttpCacheEvictionHandler();
   114         CHttpCacheEvictionHandler();
   115 
   115 
   116         /**
   116         /**
   117         * By default Symbian 2nd phase constructor is private.
   117         * By default Symbian 2nd phase constructor is private.
   118         */
   118         */
   119         void ConstructL();    
   119         void ConstructL();
   120 
   120 
   121     private:
   121     private:
   122 
   122 
   123         /**
   123         /**
   124         * 
   124         *
   125         * @since 3.1
   125         * @since 3.1
   126         * @param 
   126         * @param
   127         * @return 
   127         * @return
   128         */
   128         */
   129         TBucket* Bucket( TInt aBucketIndex );
   129         TBucket* Bucket( TInt aBucketIndex );
   130 
   130 
   131         /**
   131         /**
   132         * 
   132         *
   133         * @since 3.1
   133         * @since 3.1
   134         * @param 
   134         * @param
   135         * @return 
   135         * @return
   136         */
   136         */
   137         TInt BucketIndex( TInt aSizeFrequencyValue );
   137         TInt BucketIndex( TInt aSizeFrequencyValue );
   138 
   138 
   139         /**
   139         /**
   140         * 
   140         *
   141         * @since 3.1
   141         * @since 3.1
   142         * @param 
   142         * @param
   143         * @return 
   143         * @return
   144         */
   144         */
   145         TBool ItemIsInBucket( TInt aBucketIndex, const CHttpCacheEntry& aCacheEntry );
   145         TBool ItemIsInBucket( TInt aBucketIndex, const CHttpCacheEntry& aCacheEntry );
   146 
   146 
   147         /**
   147         /**
   148         * 
   148         *
   149         * @since 3.1
   149         * @since 3.1
   150         * @param 
   150         * @param
   151         * @return 
   151         * @return
   152         */
   152         */
   153         TInt FastLog2( TUint aNum );
   153         TInt FastLog2( TUint aNum );
   154 
   154 
   155         /**
   155         /**
   156         * Used for debugging
   156         * Used for debugging
   157         * @since 3.1
   157         * @since 3.1
   158         * @param 
   158         * @param
   159         * @return 
   159         * @return
   160         */
   160         */
   161         void LogBuckets();
   161         void LogBuckets();
   162 
   162 
   163     private:    // Data
   163     private:    // Data
   164 
   164 
   165         // array of 5 buckets each bucket is a linked list of 
   165         // array of 5 buckets each bucket is a linked list of
   166         // cached items
   166         // cached items
   167         CArrayPtrFlat<TBucket>*            iBuckets;          // owned
   167         CArrayPtrFlat<TBucket>*            iBuckets;          // owned
   168     };
   168     };
   169 
   169 
   170 #endif      // CHTTPCACHEEVICTIONHANDLER_H
   170 #endif      // CHTTPCACHEEVICTIONHANDLER_H
   171             
   171 
   172 // End of File
   172 // End of File