imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp
changeset 33 221be23823c5
parent 31 d429f823a6b7
child 39 1a8af2cd6858
equal deleted inserted replaced
31:d429f823a6b7 33:221be23823c5
   414         CActiveScheduler::Start();
   414         CActiveScheduler::Start();
   415         TN_DEBUG1( 
   415         TN_DEBUG1( 
   416             "CThumbnailServer::ThreadFunctionL() -- CActiveScheduler::Start() out" );
   416             "CThumbnailServer::ThreadFunctionL() -- CActiveScheduler::Start() out" );
   417         // Comes here if server gets shut down
   417         // Comes here if server gets shut down
   418         delete server;
   418         delete server;
       
   419         server = NULL;
   419         CleanupStack::PopAndDestroy( scheduler );
   420         CleanupStack::PopAndDestroy( scheduler );
   420         }
   421         }
   421     }
   422     }
   422 
   423 
   423 
   424 
   441     {
   442     {
   442     TN_DEBUG2( "CThumbnailServer::DropSession() iSessionCount was %d",
   443     TN_DEBUG2( "CThumbnailServer::DropSession() iSessionCount was %d",
   443         iSessionCount );
   444         iSessionCount );
   444     iSessionCount--;
   445     iSessionCount--;
   445     
   446     
   446     iProcessor->RemoveTasks(aSession);
   447     if(iProcessor)
       
   448         {
       
   449         iProcessor->RemoveTasks(aSession);
       
   450         }
   447     
   451     
   448     TN_DEBUG2( "CThumbnailServer::DropSession() aSession = 0x%08x", aSession );        
   452     TN_DEBUG2( "CThumbnailServer::DropSession() aSession = 0x%08x", aSession );        
   449     
   453     
   450     // clean-up bitmap pool    
   454     // clean-up bitmap pool    
   451     THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
   455     THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
   457         {        
   461         {        
   458         if ( ref->iSession == aSession )
   462         if ( ref->iSession == aSession )
   459             {
   463             {
   460             TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession );
   464             TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession );
   461         
   465         
   462             delete ref->iBitmap;            
   466             delete ref->iBitmap;
   463             bpiter.RemoveCurrent();
   467             bpiter.RemoveCurrent();
   464                         
   468                         
   465             TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", iBitmapPool.Count());
   469             TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", iBitmapPool.Count());
   466             }
   470             }
   467         
   471         
   850         TN_DEBUG2( "CThumbnailServer::DequeTask() - ref->iRequestId = %d", ref->iRequestId );
   854         TN_DEBUG2( "CThumbnailServer::DequeTask() - ref->iRequestId = %d", ref->iRequestId );
   851 
   855 
   852         if ( ref->iSession == aRequestId.iSession && 
   856         if ( ref->iSession == aRequestId.iSession && 
   853              ref->iRequestId == aRequestId.iRequestId )
   857              ref->iRequestId == aRequestId.iRequestId )
   854             {            
   858             {            
   855             delete ref->iBitmap;            
   859             delete ref->iBitmap;
   856             bpiter.RemoveCurrent();                        
   860             bpiter.RemoveCurrent();                        
   857                         
   861                         
   858             TN_DEBUG2( "CThumbnailServer::DequeTask() - deleted bitmap, left=%d", 
   862             TN_DEBUG2( "CThumbnailServer::DequeTask() - deleted bitmap, left=%d", 
   859                     iBitmapPool.Count());
   863                     iBitmapPool.Count());
   860             }
   864             }
  1069     StartUnmountTimeout( aDrive);
  1073     StartUnmountTimeout( aDrive);
  1070     
  1074     
  1071     if (store)
  1075     if (store)
  1072         {
  1076         {
  1073         delete *store;
  1077         delete *store;
       
  1078         *store = NULL;
  1074         iStores.Remove( aDrive );
  1079         iStores.Remove( aDrive );
  1075         }
  1080         }
  1076     }
  1081     }
  1077 
  1082 
  1078 
  1083 
  1157         if( !driveList[drive] ) 
  1162         if( !driveList[drive] ) 
  1158            {
  1163            {
  1159           // If drive-list entry is zero, drive is not available
  1164           // If drive-list entry is zero, drive is not available
  1160             continue;
  1165             continue;
  1161            }
  1166            }
  1162             
  1167 
  1163         TInt err = iFs.Volume(volumeInfo, drive);
  1168         TInt err = iFs.Volume(volumeInfo, drive);
  1164         TInt err_drive = iFs.Drive(driveInfo, drive);    
  1169         TInt err_drive = iFs.Drive(driveInfo, drive);    
  1165         
  1170         
  1166         // mount -- if removable drive, add new store
  1171         // mount -- if removable drive, add new store
  1167         if (!err && !err_drive 
  1172         if (!err && !err_drive 
  1464         } 
  1469         } 
  1465     else if ( ext.CompareF( KContactExt ) == 0 )
  1470     else if ( ext.CompareF( KContactExt ) == 0 )
  1466         {
  1471         {
  1467         aMimeType = TDataType( KContactMime );
  1472         aMimeType = TDataType( KContactMime );
  1468         } 
  1473         } 
       
  1474     else if ( ext.CompareF( KAlbumArtExt ) == 0 )
       
  1475         {
       
  1476         aMimeType = TDataType( KAlbumArtMime );
       
  1477         }
  1469     else
  1478     else
  1470         {
  1479         {
  1471         aMimeType = TDataType( KNullDesC8 );
  1480         aMimeType = TDataType( KNullDesC8 );
  1472         found = EFalse;
  1481         found = EFalse;
  1473         }
  1482         }
  1580          mimeType.CompareF( KPmRealVideoPluginMime ) == 0 ||
  1589          mimeType.CompareF( KPmRealVideoPluginMime ) == 0 ||
  1581          mimeType.CompareF( KPmRealVbVideoPluginMime ) == 0 ||
  1590          mimeType.CompareF( KPmRealVbVideoPluginMime ) == 0 ||
  1582          mimeType.CompareF( KRealVideoMime ) == 0 ||
  1591          mimeType.CompareF( KRealVideoMime ) == 0 ||
  1583          mimeType.CompareF( KFlashVideoMime ) == 0 ||
  1592          mimeType.CompareF( KFlashVideoMime ) == 0 ||
  1584          mimeType.CompareF( KMatroskaVideoMime ) == 0 ||
  1593          mimeType.CompareF( KMatroskaVideoMime ) == 0 ||
  1585          mimeType.CompareF( KContactMime ) == 0 )
  1594          mimeType.CompareF( KContactMime ) == 0 ||
       
  1595          mimeType.CompareF( KAlbumArtMime ) == 0 )
  1586         {
  1596         {
  1587         return ETrue;
  1597         return ETrue;
  1588         }
  1598         }
  1589     
  1599     
  1590     return EFalse;
  1600     return EFalse;
  1614         TRAP( result, CThumbnailServer::ThreadFunctionL());
  1624         TRAP( result, CThumbnailServer::ThreadFunctionL());
  1615         TN_DEBUG2( 
  1625         TN_DEBUG2( 
  1616             "CThumbnailServer::E32Main() -- thread function out, result=%d",
  1626             "CThumbnailServer::E32Main() -- thread function out, result=%d",
  1617             result );
  1627             result );
  1618         delete cleanup;
  1628         delete cleanup;
       
  1629         cleanup = NULL;
  1619         }
  1630         }
  1620     if ( result != KErrNone )
  1631     if ( result != KErrNone )
  1621         {
  1632         {
  1622         // Signal the client that server creation failed
  1633         // Signal the client that server creation failed
  1623         TN_DEBUG1( "CThumbnailServer::E32Main() -- Rendezvous() in" );
  1634         TN_DEBUG1( "CThumbnailServer::E32Main() -- Rendezvous() in" );