webengine/osswebengine/MemoryManager/Src/MemoryManager.cpp
changeset 1 7c90e6132015
parent 0 dd21522fd290
child 5 10e98eab6f85
equal deleted inserted replaced
0:dd21522fd290 1:7c90e6132015
    51 //-----------------------------------------------------------------------------
    51 //-----------------------------------------------------------------------------
    52 EXPORT_C RAllocator* MemoryManager::SwitchToFastAllocator()
    52 EXPORT_C RAllocator* MemoryManager::SwitchToFastAllocator()
    53     {
    53     {
    54     // create the right memory pool
    54     // create the right memory pool
    55     __ASSERT_DEBUG( s_pool == 0, User::Panic( KMemManPanicDes, 0 ) );
    55     __ASSERT_DEBUG( s_pool == 0, User::Panic( KMemManPanicDes, 0 ) );
       
    56 #ifdef __NEW_ALLOCATOR__
       
    57     s_pool = new CNewSymbianHeapPool();
       
    58     s_pool->Create();
       
    59     RSymbianDlAllocatorWrapper* allocator = new RSymbianDlAllocatorWrapper((CNewSymbianHeapPool*)s_pool);
       
    60     return User::SwitchAllocator( allocator );
       
    61 #else
    56     s_pool = new CFastMemoryPool();
    62     s_pool = new CFastMemoryPool();
    57     s_pool->Create();
    63     s_pool->Create();
    58     RFastAllocator* allocator = new RFastAllocator((CFastMemoryPool*)s_pool);
    64     RFastAllocator* allocator = new RFastAllocator((CFastMemoryPool*)s_pool);
    59     return User::SwitchAllocator( allocator );
    65     return User::SwitchAllocator( allocator );
       
    66 #endif
    60     }
    67     }
    61 
    68 
    62 //-----------------------------------------------------------------------------
    69 //-----------------------------------------------------------------------------
    63 // MemoryManager::CloseFastAllocator
    70 // MemoryManager::CloseFastAllocator
    64 //-----------------------------------------------------------------------------
    71 //-----------------------------------------------------------------------------
    65 EXPORT_C void MemoryManager::CloseFastAllocator(RAllocator* aDefaultAllocator)
    72 EXPORT_C void MemoryManager::CloseFastAllocator(RAllocator* aDefaultAllocator)
    66     {
    73     {
       
    74 #ifdef __NEW_ALLOCATOR__
       
    75     RAllocator* allocator = User::SwitchAllocator( aDefaultAllocator );
       
    76     delete (RSymbianDlAllocatorWrapper*)(allocator);
       
    77 #else
    67     RAllocator* allocator = User::SwitchAllocator( aDefaultAllocator );
    78     RAllocator* allocator = User::SwitchAllocator( aDefaultAllocator );
    68     delete (RFastAllocator*)(allocator);
    79     delete (RFastAllocator*)(allocator);
       
    80 #endif
    69     }
    81     }
    70 
    82 
    71 //-----------------------------------------------------------------------------
    83 //-----------------------------------------------------------------------------
    72 // MemoryManager::AddCollector
    84 // MemoryManager::AddCollector
    73 //-----------------------------------------------------------------------------
    85 //-----------------------------------------------------------------------------