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