mpx/collectionframework/collectionengine/src/mpxcollectioncache.cpp
branchRCL_3
changeset 24 6c1dfe4da5dd
parent 3 b425f12f328d
child 25 63223d4fd956
equal deleted inserted replaced
23:e42293e811d8 24:6c1dfe4da5dd
    26 #include <mpxmediageneraldefs.h>
    26 #include <mpxmediageneraldefs.h>
    27 #include <mpxmediacontainerdefs.h>
    27 #include <mpxmediacontainerdefs.h>
    28 #include <mpxcollectionopenlresultdef.h>
    28 #include <mpxcollectionopenlresultdef.h>
    29 #include <mpxlog.h>
    29 #include <mpxlog.h>
    30 #include "mpxcollectioncache.h"
    30 #include "mpxcollectioncache.h"
       
    31 #include <mmf/common/mmfcontrollerpluginresolver.h>
    31 
    32 
    32 // CONSTANTS
    33 // CONSTANTS
    33 const TInt KMPXRootNodeId = 0;
    34 const TInt KMPXRootNodeId = 0;
    34 
    35 
    35 // ---------------------------------------------------------------------------
    36 // ---------------------------------------------------------------------------
   587 // ----------------------------------------------------------------------------
   588 // ----------------------------------------------------------------------------
   588 //
   589 //
   589 void CMPXCollectionCacheNode::HandleChangeL( TMPXItemId aChangeItemId, 
   590 void CMPXCollectionCacheNode::HandleChangeL( TMPXItemId aChangeItemId, 
   590                                 RPointerArray<CMPXCollectionCacheNode>& aArray )
   591                                 RPointerArray<CMPXCollectionCacheNode>& aArray )
   591     {
   592     {
       
   593     CleanupResetAndDestroyPushL(aArray); 
   592     // This node is affected
   594     // This node is affected
   593     // All child nodes are invalid!
   595     // All child nodes are invalid!
   594     //
   596     //
   595     TBool aOpen(ETrue);
   597     TBool aOpen(ETrue);
   596     if( iId == aChangeItemId )
   598     if( iId == aChangeItemId )
   645                     break;
   647                     break;
   646                     }
   648                     }
   647                 } // for
   649                 } // for
   648             } // if iResults
   650             } // if iResults
   649         } // if no children
   651         } // if no children
       
   652     CleanupStack::Pop(&aArray); 
   650     }
   653     }
   651     
   654     
   652 // ----------------------------------------------------------------------------
   655 // ----------------------------------------------------------------------------
   653 // CMPXCollectionCacheNode::IndexOfId
   656 // CMPXCollectionCacheNode::IndexOfId
   654 // ----------------------------------------------------------------------------
   657 // ----------------------------------------------------------------------------
   825 void CMPXCollectionCacheNode::DoMergeArrayL( RArray<TMPXOpenDataBlock>& aArray )
   828 void CMPXCollectionCacheNode::DoMergeArrayL( RArray<TMPXOpenDataBlock>& aArray )
   826     {
   829     {
   827     // O(n^2) complexity here is OK, Merging keeps the number of items 
   830     // O(n^2) complexity here is OK, Merging keeps the number of items 
   828     // very small. Less than 3 items are alive at a time
   831     // very small. Less than 3 items are alive at a time
   829     //
   832     //
       
   833     CleanupClosePushL( aArray );
   830     RArray<TMPXOpenDataBlock> newArray;
   834     RArray<TMPXOpenDataBlock> newArray;
   831     CleanupClosePushL( newArray );
   835     CleanupClosePushL( newArray );
   832     
   836     
   833     TInt c1 = aArray.Count();
   837     TInt c1 = aArray.Count();
   834     for( TInt i=0; i<c1; ++i )
   838     for( TInt i=0; i<c1; ++i )
   867         {
   871         {
   868         aArray.AppendL( newArray[i] );
   872         aArray.AppendL( newArray[i] );
   869         MPX_DEBUG3("Order: %i %i", newArray[i].iOffset, newArray[i].iSize );
   873         MPX_DEBUG3("Order: %i %i", newArray[i].iOffset, newArray[i].iSize );
   870         }
   874         }
   871     CleanupStack::PopAndDestroy( &newArray );
   875     CleanupStack::PopAndDestroy( &newArray );
       
   876     CleanupStack::Pop(); 
   872     }
   877     }
   873                                  
   878                                  
   874 #ifdef _DEBUG
   879 #ifdef _DEBUG
   875 
   880 
   876 // ----------------------------------------------------------------------------
   881 // ----------------------------------------------------------------------------