wim/WimServer/src/WimMemMgmt.cpp
branchRCL_3
changeset 5 3b17fc5c9564
parent 0 164170e6151a
equal deleted inserted replaced
1:d5423fbb4f29 5:3b17fc5c9564
     1 /*
     1 /*
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    59     CleanupStack::PushL( self );
    59     CleanupStack::PushL( self );
    60     self->ConstructL();
    60     self->ConstructL();
    61     CleanupStack::Pop( self );
    61     CleanupStack::Pop( self );
    62     return self;
    62     return self;
    63     }
    63     }
    64     
    64 
    65 // Destructor
    65 // Destructor
    66 CWimMemMgmt::~CWimMemMgmt()
    66 CWimMemMgmt::~CWimMemMgmt()
    67     {
    67     {
    68     _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::~CWimMemMgmt | Begin"));
    68     _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::~CWimMemMgmt | Begin"));
    69 
    69 
   183 // -----------------------------------------------------------------------------
   183 // -----------------------------------------------------------------------------
   184 //
   184 //
   185 void CWimMemMgmt::FreeWIMRefs( const RMessage2& aMessage )
   185 void CWimMemMgmt::FreeWIMRefs( const RMessage2& aMessage )
   186     {
   186     {
   187     _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::FreeWIMRefsL | Begin"));
   187     _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::FreeWIMRefsL | Begin"));
   188     TUint wimCount = aMessage.Int1(); 
   188     TUint wimCount = aMessage.Int1();
   189     WIMI_Ref_pt ref = reinterpret_cast< WIMI_Ref_pt >( aMessage.Int0() );
   189     WIMI_Ref_pt ref = reinterpret_cast< WIMI_Ref_pt >( aMessage.Int0() );
   190     _WIMTRACE3(_L("WIM | WIMServer | CWimMemMgmt::FreeWIMRefsL | ref 0x%08x, wimCount %d"),
   190     _WIMTRACE3(_L("WIM | WIMServer | CWimMemMgmt::FreeWIMRefsL | ref 0x%08x, wimCount %d"),
   191             ref, wimCount);
   191             ref, wimCount);
   192 
   192 
   193     for( TUint8 wimIndex = 0; wimIndex < wimCount; wimIndex++ )
   193     for( TUint8 wimIndex = 0; wimIndex < wimCount; wimIndex++ )
   194         {
   194         {
   195         _WIMTRACE2(_L("WIM | WIMServer | CWimMemMgmt::FreeWIMRefsL | index=%d"), wimIndex);
   195         _WIMTRACE2(_L("WIM | WIMServer | CWimMemMgmt::FreeWIMRefsL | index=%d"), wimIndex);
   196         FreeRef( ref );     // TODO: fix, now deallocating the same ref in each loop?
   196         FreeRef( ref );
   197         }
   197         }
   198 
   198 
   199     _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::FreeWIMRefsL | End"));
   199     _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::FreeWIMRefsL | End"));
   200     aMessage.Complete( KErrNone );
   200     aMessage.Complete( KErrNone );
   201     }
   201     }
   223             aMessage.Complete( KErrNone );
   223             aMessage.Complete( KErrNone );
   224             return;
   224             return;
   225             }
   225             }
   226         }
   226         }
   227     _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::FreeRefLst | not found") );
   227     _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::FreeRefLst | not found") );
   228     aMessage.Complete( KErrNotFound );              
   228     aMessage.Complete( KErrNotFound );
   229     }
   229     }
   230 
   230 
   231 // -----------------------------------------------------------------------------
   231 // -----------------------------------------------------------------------------
   232 // CWimMemMgmt::ValidateWIMRefL
   232 // CWimMemMgmt::ValidateWIMRefL
   233 // -----------------------------------------------------------------------------
   233 // -----------------------------------------------------------------------------
   237     _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::ValidateWIMRefL | Begin"));
   237     _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::ValidateWIMRefL | Begin"));
   238     TInt count = iRefs.Count();
   238     TInt count = iRefs.Count();
   239     for( TUint8 index = 0; index < count; index++ )
   239     for( TUint8 index = 0; index < count; index++ )
   240         {
   240         {
   241         TWimiAllocRef* allocRef = iRefs[ index ];
   241         TWimiAllocRef* allocRef = iRefs[ index ];
   242         if( allocRef->ref == aRef )
   242         if( allocRef && ( allocRef->ref == aRef ) )
   243             {
   243             {
   244             _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::ValidateWIMRefL, valid"));
   244             _WIMTRACE(_L("WIM | WIMServer | CWimMemMgmt::ValidateWIMRefL, valid"));
   245             return ETrue;
   245             return ETrue;
   246             }
   246             }
   247         }
   247         }