webengine/osswebengine/WebCore/platform/symbian/OOMHandler.h
changeset 11 c8a366e56285
parent 0 dd21522fd290
child 15 60c5402cb945
equal deleted inserted replaced
10:a359256acfc6 11:c8a366e56285
     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:  
    14 * Description: 
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #ifndef __OOMHANDLER_H__
    19 #ifndef __OOMHANDLER_H__
    22 #include <e32def.h>
    22 #include <e32def.h>
    23 #include "MemoryManager.h"
    23 #include "MemoryManager.h"
    24 
    24 
    25 namespace WebCore {
    25 namespace WebCore {
    26 
    26 
    27 class OOMHandler : public MMemoryCollector, public MOOMStopper
    27 /*
       
    28  * This handles collecting memory when OOM occurs, by clearing the cache.
       
    29  * The StopScheduler has two collection modes, low and middle priority.
       
    30  * When memory is at a certain threshold, all collectors low and above are called.
       
    31  * When memory is at a critical threshold, all collectors middle and above are called.
       
    32  * We want the cache to always clear whenever OOM happens so this collector's
       
    33  * priority is high.
       
    34  */
       
    35 class OOMHandler : public MMemoryCollector
    28 {
    36 {
    29 public:
    37 public:
    30     OOMHandler();
    38     OOMHandler();
    31     virtual ~OOMHandler();
    39     virtual ~OOMHandler();
    32 
    40 
    33     // from collector
    41     // from collector
    34     TUint Collect(TUint aRequired);
    42     TUint Collect(TUint aRequired);
    35     void Restore();
    43     void Restore();
    36 
    44 
    37     // from stopper
       
    38     void Stop();
       
    39 
       
    40     TOOMPriority Priority()     { return EOOM_PriorityHigh; }
    45     TOOMPriority Priority()     { return EOOM_PriorityHigh; }
    41 };
    46 };
    42 
    47 
    43 }
    48 }
    44 
    49