imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp
branchRCL_3
changeset 21 6257223ede8a
parent 20 2b4b06654caa
child 22 9d4d3445ce6e
equal deleted inserted replaced
20:2b4b06654caa 21:6257223ede8a
    29 #endif // RD_MDS_2_5
    29 #endif // RD_MDS_2_5
    30 #include "thumbnaillog.h"
    30 #include "thumbnaillog.h"
    31 #include "thumbnailpanic.h"
    31 #include "thumbnailpanic.h"
    32 
    32 
    33 #include "thumbnailcenrep.h"
    33 #include "thumbnailcenrep.h"
       
    34 #include "OstTraceDefinitions.h"
       
    35 #ifdef OST_TRACE_COMPILER_IN_USE
       
    36 #include "thumbnailserversessionTraces.h"
       
    37 #endif
       
    38 
    34 
    39 
    35 // ======== MEMBER FUNCTIONS ========
    40 // ======== MEMBER FUNCTIONS ========
    36 
    41 
    37 // ---------------------------------------------------------------------------
    42 // ---------------------------------------------------------------------------
    38 // CThumbnailServerSession::CThumbnailServerSession()
    43 // CThumbnailServerSession::CThumbnailServerSession()
   159 // ---------------------------------------------------------------------------
   164 // ---------------------------------------------------------------------------
   160 //
   165 //
   161 void CThumbnailServerSession::CreateL()
   166 void CThumbnailServerSession::CreateL()
   162     {
   167     {
   163     TN_DEBUG2( "CThumbnailServerSession::AddSession() = 0x%08x", this );
   168     TN_DEBUG2( "CThumbnailServerSession::AddSession() = 0x%08x", this );
       
   169     OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_CREATEL, "CThumbnailServerSession::CreateL;this=%o", this );
   164     
   170     
   165     Server()->AddSession();
   171     Server()->AddSession();
   166     }
   172     }
   167 
   173 
   168 
   174 
   172 // -----------------------------------------------------------------------------
   178 // -----------------------------------------------------------------------------
   173 //
   179 //
   174 void CThumbnailServerSession::ServiceL( const RMessage2& aMessage )
   180 void CThumbnailServerSession::ServiceL( const RMessage2& aMessage )
   175     {
   181     {
   176     TN_DEBUG1( "CThumbnailServerSession::ServiceL() - begin" );
   182     TN_DEBUG1( "CThumbnailServerSession::ServiceL() - begin" );
       
   183     OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_SERVICEL, "CThumbnailServerSession::ServiceL - begin" );
   177     
   184     
   178     __ASSERT_DEBUG( !iMessage.Handle(), ThumbnailPanic(EThumbnailMessageNotCompleted));
   185     __ASSERT_DEBUG( !iMessage.Handle(), ThumbnailPanic(EThumbnailMessageNotCompleted));
   179     if ( iMessage.Handle())
   186     if ( iMessage.Handle())
   180         {
   187         {
   181         iMessage.Complete( KErrUnknown );
   188         iMessage.Complete( KErrUnknown );
   189         // get client thread
   196         // get client thread
   190         TInt err = iMessage.Client( iClientThread );
   197         TInt err = iMessage.Client( iClientThread );
   191         if (err != KErrNone)
   198         if (err != KErrNone)
   192             {
   199             {
   193             TN_DEBUG1( "CThumbnailServerSession::ServiceL() - client thread not found");
   200             TN_DEBUG1( "CThumbnailServerSession::ServiceL() - client thread not found");
       
   201             OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_SERVICEL, "CThumbnailServerSession::ServiceL - client thread not found" );
   194     
   202     
   195             iMessage = RMessage2();
   203             iMessage = RMessage2();
   196             }       
   204             }       
   197         }
   205         }
   198     else
   206     else
   199         {
   207         {
   200         TN_DEBUG1( "CThumbnailServerSession::ServiceL() - message null");
   208         TN_DEBUG1( "CThumbnailServerSession::ServiceL() - message null");
       
   209         OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_SERVICEL, "CThumbnailServerSession::ServiceL - message null" );
   201         }
   210         }
   202     
   211     
   203     // clean up possible trash
   212     // clean up possible trash
   204     if (iBitmapHandle)
   213     if (iBitmapHandle)
   205         {
   214         {
   229     
   238     
   230     // close thread handle
   239     // close thread handle
   231     iClientThread.Close();
   240     iClientThread.Close();
   232     
   241     
   233     TN_DEBUG1( "CThumbnailServerSession::ServiceL() - end" );
   242     TN_DEBUG1( "CThumbnailServerSession::ServiceL() - end" );
       
   243     OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSERVERSESSION_SERVICEL, "CThumbnailServerSession::ServiceL - end" );
   234     }
   244     }
   235 
   245 
   236 
   246 
   237 // -----------------------------------------------------------------------------
   247 // -----------------------------------------------------------------------------
   238 // CThumbnailServerSession::Server()
   248 // CThumbnailServerSession::Server()
   259 // -----------------------------------------------------------------------------
   269 // -----------------------------------------------------------------------------
   260 //
   270 //
   261 void CThumbnailServerSession::UpdateThumbnailsL( const RMessage2& aMessage )
   271 void CThumbnailServerSession::UpdateThumbnailsL( const RMessage2& aMessage )
   262     {
   272     {
   263     TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL()" );
   273     TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL()" );
       
   274     OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_UPDATETHUMBNAILSL, "CThumbnailServerSession::UpdateThumbnailsL" );
   264     
   275     
   265     if(aMessage.Int1() != KCheckValue)
   276     if(aMessage.Int1() != KCheckValue)
   266        {
   277        {
   267        TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - error in aMessage - leaving" );
   278        TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - error in aMessage - leaving" );
   268        User::Leave(KErrArgument);
   279        User::Leave(KErrArgument);
   289         // source type
   300         // source type
   290         TDataType mimeType;
   301         TDataType mimeType;
   291         TInt sourceType = 0;
   302         TInt sourceType = 0;
   292         TInt err = Server()->MimeTypeFromFileExt( params.iFileName, mimeType );
   303         TInt err = Server()->MimeTypeFromFileExt( params.iFileName, mimeType );
   293         
   304         
       
   305         // need to use recognizer
       
   306         if (err == KErrNotFound)
       
   307             {
       
   308             Server()->Fs().ShareProtected();
       
   309             RFile64 file;
       
   310             CleanupClosePushL( file );
       
   311           
       
   312             User::LeaveIfError( file.Open( Server()->Fs(), params.iFileName, EFileShareReadersOrWriters )); 
       
   313             TN_DEBUG2( "CThumbnailServerSession::UpdateThumbnailsL - file handle opened for %S", &params.iFileName );
       
   314           
       
   315             mimeType = Server()->ResolveMimeTypeL(file);
       
   316           
       
   317             file.Close();
       
   318             TN_DEBUG1("CThumbnailServerSession::UpdateThumbnailsL - file handle closed");
       
   319           
       
   320             CleanupStack::Pop( &file );    
       
   321             }
       
   322         
   294         // get missing sizes
   323         // get missing sizes
   295         if ( err == KErrNone && ( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly ) != 0 )
   324         if ( ( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly ) != 0 )
   296             {
   325             {
   297             sourceType = Server()->SourceTypeFromMimeType( mimeType );
   326             sourceType = Server()->SourceTypeFromMimeType( mimeType );
   298             
   327             
   299             missingSizes = new (ELeave) RArray < TThumbnailPersistentSize >;
   328             missingSizes = new (ELeave) RArray < TThumbnailPersistentSize >;
   300             CleanupClosePushL( *missingSizes );
   329             CleanupClosePushL( *missingSizes );
   311             }
   340             }
   312         
   341         
   313         if(!missingSizes)
   342         if(!missingSizes)
   314             {
   343             {
   315             TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - finished part 1" );
   344             TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - finished part 1" );
       
   345             OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_UPDATETHUMBNAILSL, "CThumbnailServerSession::UpdateThumbnailsL - finished part 1" );
   316             aMessage.Complete( KErrNone );
   346             aMessage.Complete( KErrNone );
   317             }
   347             }
   318         else
   348         else
   319             {
   349             {
       
   350             OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_UPDATETHUMBNAILSL, "CThumbnailServerSession::UpdateThumbnailsL  - some sizes missing..." );
   320             TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - some sizes missing..." ); 
   351             TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - some sizes missing..." ); 
   321             }
   352             }
   322         }
   353         }
   323 
   354 
   324     if (missingSizes || !finished)
   355     if (missingSizes || !finished)
   325         {
   356         {
   326         TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - need to create (some) thumbs" );
   357         TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - need to create (some) thumbs" );
       
   358         OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSERVERSESSION_UPDATETHUMBNAILSL, "CThumbnailServerSession::UpdateThumbnailsL - need to create (some) thumbs" );
   327         
   359         
   328         if(missingSizes)
   360         if(missingSizes)
   329             {
   361             {
   330             CleanupStack::PopAndDestroy( missingSizes );
   362             CleanupStack::PopAndDestroy( missingSizes );
   331             delete missingSizes;
   363             delete missingSizes;
   341         aMessage.Complete( KThumbnailErrThumbnailNotFound );
   373         aMessage.Complete( KThumbnailErrThumbnailNotFound );
   342         }
   374         }
   343     else
   375     else
   344         {
   376         {
   345         TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - finished part 2" );
   377         TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - finished part 2" );
       
   378         OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVERSESSION_UPDATETHUMBNAILSL, "CThumbnailServerSession::UpdateThumbnailsL - finished part 2" );
   346         }
   379         }
   347     
   380     
   348     iMessage = RMessage2();
   381     iMessage = RMessage2();
   349     }
   382     }
   350 
   383 
   356 void CThumbnailServerSession::RenameThumbnailsL( const RMessage2& aMessage )
   389 void CThumbnailServerSession::RenameThumbnailsL( const RMessage2& aMessage )
   357     {
   390     {
   358     if(aMessage.Int1() != KCheckValue)
   391     if(aMessage.Int1() != KCheckValue)
   359        {
   392        {
   360        TN_DEBUG1( "CThumbnailServerSession::RenameThumbnailsL() - error in aMessage - leaving" );
   393        TN_DEBUG1( "CThumbnailServerSession::RenameThumbnailsL() - error in aMessage - leaving" );
       
   394        OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_RENAMETHUMBNAILSL, "CThumbnailServerSession::RenameThumbnailsL - error in aMessage - leaving" );
   361        User::Leave(KErrArgument);
   395        User::Leave(KErrArgument);
   362        }
   396        }
   363     
   397     
   364     // read message params
   398     // read message params
   365     aMessage.ReadL( 0, iRequestParams );
   399     aMessage.ReadL( 0, iRequestParams );
   395     TN_DEBUG1( "CThumbnailServerSession::RequestThumbByIdAsyncL() - begin" );
   429     TN_DEBUG1( "CThumbnailServerSession::RequestThumbByIdAsyncL() - begin" );
   396     
   430     
   397     if(aMessage.Int1() != KCheckValue)
   431     if(aMessage.Int1() != KCheckValue)
   398        {
   432        {
   399        TN_DEBUG1( "CThumbnailServerSession::RequestThumbByIdAsync() - error in aMessage - leaving" );
   433        TN_DEBUG1( "CThumbnailServerSession::RequestThumbByIdAsync() - error in aMessage - leaving" );
       
   434        OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYIDASYNCL, "CThumbnailServerSession::RequestThumbByIdAsyncL - leaving" );
   400        User::Leave(KErrArgument);
   435        User::Leave(KErrArgument);
   401        }
   436        }
   402 
   437 
   403     aMessage.ReadL( 0, iRequestParams );
   438     aMessage.ReadL( 0, iRequestParams );
   404     const TThumbnailRequestParams& params = iRequestParams();
   439     const TThumbnailRequestParams& params = iRequestParams();
   421 #endif // RD_MDS_2_5
   456 #endif // RD_MDS_2_5
   422         
   457         
   423     
   458     
   424 #ifdef _DEBUG
   459 #ifdef _DEBUG
   425     aStop.UniversalTime();
   460     aStop.UniversalTime();
       
   461     TInt tookTime = (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000;
   426     TN_DEBUG2( "CThumbnailServerSession::RequestThumbByIdAsyncL() request took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000 );
   462     TN_DEBUG2( "CThumbnailServerSession::RequestThumbByIdAsyncL() request took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000 );
       
   463     OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYIDASYNCL, "CThumbnailServerSession::RequestThumbByIdAsyncL;tookTime=%d", tookTime );
   427 #endif 
   464 #endif 
   428     
   465     
   429     TN_DEBUG1("CThumbnailServerSession::RequestThumbByIdAsyncL() - end" );
   466     TN_DEBUG1("CThumbnailServerSession::RequestThumbByIdAsyncL() - end" );
       
   467     OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYIDASYNCL, "CThumbnailServerSession::RequestThumbByIdAsyncL - end" );
   430     }
   468     }
   431 
   469 
   432 // -----------------------------------------------------------------------------
   470 // -----------------------------------------------------------------------------
   433 // CThumbnailServerSession::RequestThumbByFileHandleAsync()
   471 // CThumbnailServerSession::RequestThumbByFileHandleAsync()
   434 // -----------------------------------------------------------------------------
   472 // -----------------------------------------------------------------------------
   435 //
   473 //
   436 void CThumbnailServerSession::RequestThumbByFileHandleAsyncL( const RMessage2&
   474 void CThumbnailServerSession::RequestThumbByFileHandleAsyncL( const RMessage2&
   437     aMessage )
   475     aMessage )
   438     {
   476     {
   439     TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL()" );
   477     TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL()" );
       
   478     OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL" );
   440     
   479     
   441     if(aMessage.Int1() != KCheckValue)
   480     if(aMessage.Int1() != KCheckValue)
   442        {
   481        {
   443        TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsync() - error in aMessage - leaving" );
   482        TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsync() - error in aMessage - leaving" );
       
   483        OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - error in aMessage - leaving" );
   444        User::Leave(KErrArgument);
   484        User::Leave(KErrArgument);
   445        }
   485        }
   446     
   486     
   447     aMessage.ReadL( 0, iRequestParams );
   487     aMessage.ReadL( 0, iRequestParams );
   448     const TThumbnailRequestParams& params = iRequestParams();
   488     const TThumbnailRequestParams& params = iRequestParams();
   470     
   510     
   471     // CreateThumbnails
   511     // CreateThumbnails
   472     if (params.iControlFlags == EThumbnailGeneratePersistentSizesOnly)
   512     if (params.iControlFlags == EThumbnailGeneratePersistentSizesOnly)
   473         {
   513         {
   474         TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - EThumbnailGeneratePersistentSizesOnly" );
   514         TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - EThumbnailGeneratePersistentSizesOnly" );
       
   515         OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - EThumbnailGeneratePersistentSizesOnly" );
   475         CreateGenerateTaskFromFileHandleL( &file );
   516         CreateGenerateTaskFromFileHandleL( &file );
   476         
   517         
   477         // ownership of the file transferred
   518         // ownership of the file transferred
   478         CleanupStack::Pop(&file);
   519         CleanupStack::Pop(&file);
   479         }
   520         }
   484         
   525         
   485         if( err == KErrCompletion )
   526         if( err == KErrCompletion )
   486             {
   527             {
   487             // If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion
   528             // If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion
   488             TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail blacklisted" );
   529             TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail blacklisted" );
       
   530             OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - thumbnail blacklisted" );
   489             
   531             
   490             aMessage.Complete( err );
   532             aMessage.Complete( err );
   491             iMessage = RMessage2();
   533             iMessage = RMessage2();
   492             
   534             
   493             // close file
   535             // close file
   494             CleanupStack::PopAndDestroy(&file);
   536             CleanupStack::PopAndDestroy(&file);
   495             }
   537             }
   496         else if ( !err && iBitmap )
   538         else if ( !err && iBitmap )
   497             {
   539             {
   498             TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - bitmap " );
   540             TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - bitmap " );
       
   541             OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - found existing thumbnail - bitmap " );
   499 
   542 
   500             // Thumbnail already stored
   543             // Thumbnail already stored
   501             CleanupStack::PopAndDestroy(&file);
   544             CleanupStack::PopAndDestroy(&file);
   502             TN_DEBUG1("CThumbnailServerSession::RequestThumbByFileHandleAsyncL - file handle closed");
   545             TN_DEBUG1("CThumbnailServerSession::RequestThumbByFileHandleAsyncL - file handle closed");
       
   546             OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - file handle closed" );
   503 
   547 
   504             ProcessBitmapL();
   548             ProcessBitmapL();
   505             }
   549             }
   506         else if ( (err == KErrNotFound || err == KErrAccessDenied) && 
   550         else if ( (err == KErrNotFound || err == KErrAccessDenied) && 
   507                  !(params.iFlags& CThumbnailManager::EDoNotCreate) )
   551                  !(params.iFlags& CThumbnailManager::EDoNotCreate) )
   508             {
   552             {
   509             TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - KErrNotFound & !EDoNotCreate" );
   553             TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - KErrNotFound & !EDoNotCreate" );
       
   554             OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - KErrNotFound & !EDoNotCreate" );
   510             CreateGenerateTaskFromFileHandleL( &file);
   555             CreateGenerateTaskFromFileHandleL( &file);
   511             
   556             
   512             // ownership of the file transferred
   557             // ownership of the file transferred
   513         	CleanupStack::Pop(&file);
   558         	CleanupStack::Pop(&file);
   514             }
   559             }
   515         else if (!err && iBuffer)
   560         else if (!err && iBuffer)
   516             {
   561             {
   517             TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - jpeg " );
   562             TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - jpeg " );
       
   563             OstTrace0( TRACE_NORMAL, DUP7_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - found existing thumbnail - jpeg" );
   518             
   564             
   519             CThumbnailDecodeTask* task = new( ELeave )CThumbnailDecodeTask( Server()
   565             CThumbnailDecodeTask* task = new( ELeave )CThumbnailDecodeTask( Server()
   520                         ->Processor(), * Server(), iBuffer, params.iPriority, params.iDisplayMode );
   566                         ->Processor(), * Server(), iBuffer, params.iPriority, params.iDisplayMode );
   521             
   567             
   522             CleanupStack::PushL( task );
   568             CleanupStack::PushL( task );
   531             iBuffer = NULL;
   577             iBuffer = NULL;
   532             
   578             
   533             // close file
   579             // close file
   534             CleanupStack::PopAndDestroy(&file);
   580             CleanupStack::PopAndDestroy(&file);
   535             TN_DEBUG1("CThumbnailServerSession::RequestThumbByFileHandleAsyncL - file handle closed");
   581             TN_DEBUG1("CThumbnailServerSession::RequestThumbByFileHandleAsyncL - file handle closed");
       
   582             OstTrace0( TRACE_NORMAL, DUP8_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - file handle closed" );
   536             }
   583             }
   537         else
   584         else
   538             {
   585             {
   539             TN_DEBUG2( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail not found, err=%d", err );
   586             TN_DEBUG2( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail not found, err=%d", err );
       
   587             OstTrace1( TRACE_NORMAL, DUP9_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - thumbnail not found;err=%d", err );
   540             
   588             
   541             aMessage.Complete( ConvertSqlErrToE32Err( err ));
   589             aMessage.Complete( ConvertSqlErrToE32Err( err ));
   542             iMessage = RMessage2();
   590             iMessage = RMessage2();
   543             
   591             
   544             // close file
   592             // close file
   553 //
   601 //
   554 void CThumbnailServerSession::RequestThumbByPathAsyncL( const RMessage2&
   602 void CThumbnailServerSession::RequestThumbByPathAsyncL( const RMessage2&
   555     aMessage )
   603     aMessage )
   556     {
   604     {
   557     TN_DEBUG1( "CThumbnailServerSession::RequestThumbByPathAsyncL()" );
   605     TN_DEBUG1( "CThumbnailServerSession::RequestThumbByPathAsyncL()" );
       
   606     OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYPATHASYNCL, "CThumbnailServerSession::RequestThumbByPathAsyncL" );
   558     
   607     
   559 #ifdef _DEBUG
   608 #ifdef _DEBUG
   560     TTime aStart, aStop;
   609     TTime aStart, aStop;
   561     aStart.UniversalTime();
   610     aStart.UniversalTime();
   562 #endif
   611 #endif
   563     
   612     
   564     if(aMessage.Int1() != KCheckValue)
   613     if(aMessage.Int1() != KCheckValue)
   565        {
   614        {
   566        TN_DEBUG1( "CThumbnailServerSession::RequestThumbByPathAsync() - error in aMessage - leaving" );
   615        TN_DEBUG1( "CThumbnailServerSession::RequestThumbByPathAsync() - error in aMessage - leaving" );
       
   616        OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYPATHASYNCL, "CThumbnailServerSession::RequestThumbByPathAsyncL - error in aMessage - leaving" );
   567        User::Leave(KErrArgument);
   617        User::Leave(KErrArgument);
   568        }
   618        }
   569 
   619 
   570     aMessage.ReadL( 0, iRequestParams );
   620     aMessage.ReadL( 0, iRequestParams );
   571     const TThumbnailRequestParams& params = iRequestParams();
   621     const TThumbnailRequestParams& params = iRequestParams();
   588 	    
   638 	    
   589 	    if ( !err && iBitmap )
   639 	    if ( !err && iBitmap )
   590 	        {
   640 	        {
   591 	        TN_DEBUG1( 
   641 	        TN_DEBUG1( 
   592 	            "CThumbnailServerSession::RequestThumbByPathAsyncL() - found existing thumbnail- bitmap" );
   642 	            "CThumbnailServerSession::RequestThumbByPathAsyncL() - found existing thumbnail- bitmap" );
       
   643 	        OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYPATHASYNCL, "CThumbnailServerSession::RequestThumbByPathAsyncL - found existing thumbnail- bitmap" );
   593 
   644 
   594 	        ProcessBitmapL();
   645 	        ProcessBitmapL();
   595 	        }
   646 	        }
   596 	    else if ( !err && iBuffer)
   647 	    else if ( !err && iBuffer)
   597 	        {
   648 	        {
   598 	        TN_DEBUG1( 
   649 	        TN_DEBUG1( 
   599 	            "CThumbnailServerSession::RequestThumbByPathAsyncL() - found existing thumbnail- jpeg" );
   650 	            "CThumbnailServerSession::RequestThumbByPathAsyncL() - found existing thumbnail- jpeg" );
       
   651 	        OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYPATHASYNCL, "CThumbnailServerSession::RequestThumbByPathAsyncL - found existing thumbnail- jpeg" );
   600 	        
   652 	        
   601 	        CThumbnailDecodeTask* task = new( ELeave )CThumbnailDecodeTask( Server()
   653 	        CThumbnailDecodeTask* task = new( ELeave )CThumbnailDecodeTask( Server()
   602 	               ->Processor(), * Server(), iBuffer, params.iPriority, params.iDisplayMode );
   654 	               ->Processor(), * Server(), iBuffer, params.iPriority, params.iDisplayMode );
   603 	        
   655 	        
   604 	        CleanupStack::PushL( task );
   656 	        CleanupStack::PushL( task );
   614 	        }
   666 	        }
   615 	    else if( err == KErrCompletion )
   667 	    else if( err == KErrCompletion )
   616 	        {
   668 	        {
   617             // If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion
   669             // If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion
   618             TN_DEBUG1( "CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail blacklisted" );
   670             TN_DEBUG1( "CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail blacklisted" );
       
   671             OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYPATHASYNCL, "CThumbnailServerSession::RequestThumbByPathAsyncL - thumbnail blacklisted" );
   619             
   672             
   620             aMessage.Complete( err );
   673             aMessage.Complete( err );
   621             iMessage = RMessage2();
   674             iMessage = RMessage2();
   622 	        }
   675 	        }
   623 	    else 
   676 	    else 
   624 	        {
   677 	        {
   625 	        TN_DEBUG2( 
   678 	        TN_DEBUG2( 
   626 	            "CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail not found, err = %d", err );
   679 	            "CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail not found, err = %d", err );
       
   680 	        OstTrace1( TRACE_NORMAL, DUP5_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYPATHASYNCL, "CThumbnailServerSession::RequestThumbByPathAsyncL  - thumbnail not found;err=%d", err );
   627 	        
   681 	        
   628 	        // don't try to create from virtual URI
   682 	        // don't try to create from virtual URI
   629 	        if ( params.iVirtualUri )
   683 	        if ( params.iVirtualUri )
   630 	            {
   684 	            {
   631                 User::Leave(err);
   685                 User::Leave(err);
   650 	        }   
   704 	        }   
   651 	   }
   705 	   }
   652     
   706     
   653 #ifdef _DEBUG
   707 #ifdef _DEBUG
   654     aStop.UniversalTime();
   708     aStop.UniversalTime();
       
   709     TInt tookTime = (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000;
   655     TN_DEBUG2( "CThumbnailStore::RequestThumbByPathAsyncL() request took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000 );
   710     TN_DEBUG2( "CThumbnailStore::RequestThumbByPathAsyncL() request took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000 );
       
   711     OstTrace1( TRACE_NORMAL, DUP6_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYPATHASYNCL, "CThumbnailServerSession::RequestThumbByPathAsyncL;tookTime=%d", tookTime );
   656 #endif
   712 #endif
   657     }   
   713     }   
   658     
   714     
   659 void CThumbnailServerSession::RequestSetThumbnailByBufferL( const RMessage2& aMessage )
   715 void CThumbnailServerSession::RequestSetThumbnailByBufferL( const RMessage2& aMessage )
   660     {
   716     {
   661     TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBufferL()" );
   717     TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBufferL()" );
       
   718     OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_REQUESTSETTHUMBNAILBYBUFFERL, "CThumbnailServerSession::RequestSetThumbnailByBufferL" );
   662     
   719     
   663     if(aMessage.Int3() != KCheckValue)
   720     if(aMessage.Int3() != KCheckValue)
   664         {
   721         {
   665         TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBufferL() - error in aMessage - leaving" );
   722         TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBufferL() - error in aMessage - leaving" );
       
   723         OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_REQUESTSETTHUMBNAILBYBUFFERL, "CThumbnailServerSession::RequestSetThumbnailByBufferL - error in aMessage - leaving" );
   666         User::Leave(KErrArgument);
   724         User::Leave(KErrArgument);
   667         }
   725         }
   668       
   726       
   669     aMessage.ReadL( 0, iRequestParams );
   727     aMessage.ReadL( 0, iRequestParams );
   670     const TThumbnailRequestParams& params = iRequestParams();
   728     const TThumbnailRequestParams& params = iRequestParams();
   705     }
   763     }
   706 
   764 
   707 void CThumbnailServerSession::RequestSetThumbnailByBitmapL( const RMessage2& aMessage )
   765 void CThumbnailServerSession::RequestSetThumbnailByBitmapL( const RMessage2& aMessage )
   708     {
   766     {
   709     TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBitmapL()" );
   767     TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBitmapL()" );
       
   768     OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_REQUESTSETTHUMBNAILBYBITMAPL, "CThumbnailServerSession::RequestSetThumbnailByBitmapL" );
   710 
   769 
   711     if(aMessage.Int2() != KCheckValue)
   770     if(aMessage.Int2() != KCheckValue)
   712         {
   771         {
   713         TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBitmapL() - error in aMessage - leaving" );
   772         TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBitmapL() - error in aMessage - leaving" );
       
   773         OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_REQUESTSETTHUMBNAILBYBITMAPL, "CThumbnailServerSession::RequestSetThumbnailByBitmapL - error in aMessage - leaving" );
   714         User::Leave(KErrArgument);
   774         User::Leave(KErrArgument);
   715         }
   775         }
   716         
   776         
   717     aMessage.ReadL( 0, iRequestParams );
   777     aMessage.ReadL( 0, iRequestParams );
   718     const TThumbnailRequestParams& params = iRequestParams();
   778     const TThumbnailRequestParams& params = iRequestParams();
   806                    TInt height = (*missingSizes)[i].iSize.iHeight;
   866                    TInt height = (*missingSizes)[i].iSize.iHeight;
   807                    (*missingSizes)[i].iSize.iHeight = (*missingSizes)[i].iSize.iWidth;
   867                    (*missingSizes)[i].iSize.iHeight = (*missingSizes)[i].iSize.iWidth;
   808                    (*missingSizes)[i].iSize.iWidth = height;
   868                    (*missingSizes)[i].iSize.iWidth = height;
   809                     
   869                     
   810                    TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBitmapL() - portrait");
   870                    TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBitmapL() - portrait");
       
   871                    OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_REQUESTSETTHUMBNAILBYBITMAPL, "CThumbnailServerSession::RequestSetThumbnailByBitmapL - portrait" );
   811                    }
   872                    }
   812                }
   873                }
   813         
   874         
   814             CThumbnailScaleTask* scaleTask = CThumbnailScaleTask::NewL( Server()->Processor(),
   875             CThumbnailScaleTask* scaleTask = CThumbnailScaleTask::NewL( Server()->Processor(),
   815                     *Server(), params.iTargetUri, bitmap, bitmapSize,
   876                     *Server(), params.iTargetUri, bitmap, bitmapSize,
   860     {
   921     {
   861     TThumbnailRequestParams& params = iRequestParams();
   922     TThumbnailRequestParams& params = iRequestParams();
   862 
   923 
   863     TN_DEBUG2( 
   924     TN_DEBUG2( 
   864         "CThumbnailServerSession::CreateGenerateTaskFromFileHandleL() -- create thumbnail generation task for %S", &params.iFileName );
   925         "CThumbnailServerSession::CreateGenerateTaskFromFileHandleL() -- create thumbnail generation task for %S", &params.iFileName );
       
   926     OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_CREATEGENERATETASKFROMFILEHANDLEL, "CThumbnailServerSession::CreateGenerateTaskFromFileHandleL -- create thumbnail generation task for;params.iFileName=%S", params.iFileName );
   865     
   927     
   866     // disk space check only for stored sizes
   928     // disk space check only for stored sizes
   867     if ( params.iImport && 
   929     if ( params.iImport && 
   868          Server()->StoreForPathL(params.iTargetUri)->IsDiskFull() )
   930          Server()->StoreForPathL(params.iTargetUri)->IsDiskFull() )
   869         {
   931         {
   945     
  1007     
   946     // create new task
  1008     // create new task
   947     if( !aFile)
  1009     if( !aFile)
   948         {
  1010         {
   949         TN_DEBUG1("CThumbnailServerSession::CreateGenerateTaskFromFileHandleL() - KErrArgument");
  1011         TN_DEBUG1("CThumbnailServerSession::CreateGenerateTaskFromFileHandleL() - KErrArgument");
       
  1012         OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_CREATEGENERATETASKFROMFILEHANDLEL, "CThumbnailServerSession::CreateGenerateTaskFromFileHandleL - KErrArgument" );
   950         User::Leave( KErrArgument );
  1013         User::Leave( KErrArgument );
   951         }
  1014         }
   952     CleanupClosePushL( *aFile );
  1015     CleanupClosePushL( *aFile );
   953     CThumbnailGenerateTask* task = new( ELeave )CThumbnailGenerateTask( Server()
  1016     CThumbnailGenerateTask* task = new( ELeave )CThumbnailGenerateTask( Server()
   954         ->Processor(), * Server(), aFile, NULL, &params.iMimeType, params.iFlags,
  1017         ->Processor(), * Server(), aFile, NULL, &params.iMimeType, params.iFlags,
   987     {
  1050     {
   988     const TThumbnailRequestParams& params = iRequestParams();
  1051     const TThumbnailRequestParams& params = iRequestParams();
   989 
  1052 
   990     TN_DEBUG2( 
  1053     TN_DEBUG2( 
   991         "CThumbnailServerSession::CreateGenerateTaskFromBufferL() -- create thumbnail generation task for %S", &params.iTargetUri );
  1054         "CThumbnailServerSession::CreateGenerateTaskFromBufferL() -- create thumbnail generation task for %S", &params.iTargetUri );
       
  1055     OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_CREATEGENERATETASKFROMBUFFERL, "CThumbnailServerSession::CreateGenerateTaskFromBufferL -  -- create thumbnail generation task for;params.iTargetUri=%S", params.iTargetUri );
   992   
  1056   
   993     // disk space check only for stored sizes
  1057     // disk space check only for stored sizes
   994     if ( params.iThumbnailSize != ECustomThumbnailSize && 
  1058     if ( params.iThumbnailSize != ECustomThumbnailSize && 
   995          Server()->StoreForPathL(params.iTargetUri)->IsDiskFull() )
  1059          Server()->StoreForPathL(params.iTargetUri)->IsDiskFull() )
   996         {
  1060         {
  1012         RFile64 file;
  1076         RFile64 file;
  1013         CleanupClosePushL( file );
  1077         CleanupClosePushL( file );
  1014         
  1078         
  1015         User::LeaveIfError( file.Open( Server()->Fs(), params.iTargetUri, EFileShareReadersOrWriters )); 
  1079         User::LeaveIfError( file.Open( Server()->Fs(), params.iTargetUri, EFileShareReadersOrWriters )); 
  1016         TN_DEBUG2( "CThumbnailServerSession::CreateGenerateTaskFromBufferL - file handle opened for %S", &params.iFileName );
  1080         TN_DEBUG2( "CThumbnailServerSession::CreateGenerateTaskFromBufferL - file handle opened for %S", &params.iFileName );
       
  1081                 OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_CREATEGENERATETASKFROMBUFFERL, "CThumbnailServerSession::CreateGenerateTaskFromBufferL;params.iFileName=%S", params.iFileName );
  1017                 
  1082                 
  1018         mimetype = Server()->ResolveMimeTypeL(file);
  1083         mimetype = Server()->ResolveMimeTypeL(file);
  1019                 
  1084                 
  1020         file.Close();
  1085         file.Close();
  1021         TN_DEBUG1("CThumbnailServerSession::CreateGenerateTaskFromBufferL - file handle closed");
  1086         TN_DEBUG1("CThumbnailServerSession::CreateGenerateTaskFromBufferL - file handle closed");
       
  1087         OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_CREATEGENERATETASKFROMBUFFERL, "CThumbnailServerSession::CreateGenerateTaskFromBufferL - file handle closed" );
  1022         
  1088         
  1023         CleanupStack::Pop( &file );    
  1089         CleanupStack::Pop( &file );    
  1024         }
  1090         }
  1025         
  1091         
  1026     sourceType = Server()->SourceTypeFromMimeType( mimetype );    
  1092     sourceType = Server()->SourceTypeFromMimeType( mimetype );    
  1060     
  1126     
  1061     // create new task
  1127     // create new task
  1062     if( !aBuffer)
  1128     if( !aBuffer)
  1063         {
  1129         {
  1064         TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - KErrArgument" );
  1130         TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - KErrArgument" );
       
  1131         OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSERVERSESSION_CREATEGENERATETASKFROMBUFFERL, "CThumbnailServerSession::CreateGenerateTaskFromBufferL - KErrArgument" );
  1065         User::Leave( KErrArgument );
  1132         User::Leave( KErrArgument );
  1066         }
  1133         }
  1067     
  1134     
  1068     CThumbnailGenerateTask* task = new( ELeave )CThumbnailGenerateTask( Server()
  1135     CThumbnailGenerateTask* task = new( ELeave )CThumbnailGenerateTask( Server()
  1069         ->Processor(), * Server(), NULL, aBuffer, &params.iMimeType, params.iFlags,
  1136         ->Processor(), * Server(), NULL, aBuffer, &params.iMimeType, params.iFlags,
  1096 // -----------------------------------------------------------------------------
  1163 // -----------------------------------------------------------------------------
  1097 //
  1164 //
  1098 void CThumbnailServerSession::FetchThumbnailL()
  1165 void CThumbnailServerSession::FetchThumbnailL()
  1099     {
  1166     {
  1100     TN_DEBUG1("CThumbnailServerSession::FetchThumbnailL()");
  1167     TN_DEBUG1("CThumbnailServerSession::FetchThumbnailL()");
       
  1168     OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_FETCHTHUMBNAILL, "CThumbnailServerSession::FetchThumbnailL" );
  1101     __ASSERT_DEBUG( !iBitmap, ThumbnailPanic( EThumbnailBitmapNotReleased ));
  1169     __ASSERT_DEBUG( !iBitmap, ThumbnailPanic( EThumbnailBitmapNotReleased ));
  1102     __ASSERT_DEBUG( !iBuffer, ThumbnailPanic( EThumbnailBitmapNotReleased ));
  1170     __ASSERT_DEBUG( !iBuffer, ThumbnailPanic( EThumbnailBitmapNotReleased ));
  1103 
  1171 
  1104     delete iBitmap;
  1172     delete iBitmap;
  1105     iBitmap = NULL;
  1173     iBitmap = NULL;
  1117     
  1185     
  1118     if( params.iFileName != KNullDesC )
  1186     if( params.iFileName != KNullDesC )
  1119         {
  1187         {
  1120         TN_DEBUG3( "CThumbnailServerSession::FetchThumbnailL( ThumbnailSize=%d ( Path=%S ))", 
  1188         TN_DEBUG3( "CThumbnailServerSession::FetchThumbnailL( ThumbnailSize=%d ( Path=%S ))", 
  1121                  params.iThumbnailSize, &params.iFileName );
  1189                  params.iThumbnailSize, &params.iFileName );
       
  1190         OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_FETCHTHUMBNAILL, "CThumbnailServerSession::FetchThumbnailL;params.iFileName=%S", params.iFileName );
  1122         Server()->FetchThumbnailL( params.iFileName, iBitmap, iBuffer, params.iThumbnailSize, iOriginalSize);
  1191         Server()->FetchThumbnailL( params.iFileName, iBitmap, iBuffer, params.iThumbnailSize, iOriginalSize);
  1123         }
  1192         }
  1124     else
  1193     else
  1125         {
  1194         {
  1126         User::Leave( KErrNotSupported );
  1195         User::Leave( KErrNotSupported );
  1127         }
  1196         }
  1128 #ifdef _DEBUG
  1197 #ifdef _DEBUG
  1129     if( iBitmap)
  1198     if( iBitmap)
  1130         {
  1199         {
  1131         TN_DEBUG4( "CThumbnailServerSession::FetchThumbnailL() size %d x %d displaymode %d", iBitmap->SizeInPixels().iWidth, iBitmap->SizeInPixels().iHeight, iBitmap->DisplayMode());
  1200         TN_DEBUG4( "CThumbnailServerSession::FetchThumbnailL() size %d x %d displaymode %d", iBitmap->SizeInPixels().iWidth, iBitmap->SizeInPixels().iHeight, iBitmap->DisplayMode());
       
  1201         OstTraceExt3( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_FETCHTHUMBNAILL, "CThumbnailServerSession::FetchThumbnailL;iBitmap->SizeInPixels().iWidth=%d;iBitmap->SizeInPixels().iHeight=%d;iBitmap->DisplayMode()=%u", iBitmap->SizeInPixels().iWidth, iBitmap->SizeInPixels().iHeight, iBitmap->DisplayMode() );
  1132         }
  1202         }
  1133 #endif
  1203 #endif
  1134     }
  1204     }
  1135 
  1205 
  1136 // -----------------------------------------------------------------------------
  1206 // -----------------------------------------------------------------------------
  1144     TThumbnailRequestParams& params = iRequestParams();
  1214     TThumbnailRequestParams& params = iRequestParams();
  1145     
  1215     
  1146     if ( ClientThreadAlive() )
  1216     if ( ClientThreadAlive() )
  1147         {        
  1217         {        
  1148         TN_DEBUG2("CThumbnailServerSession::ProcessBitmapL(), iBitmap handle= 0x%08x", iBitmap->Handle());
  1218         TN_DEBUG2("CThumbnailServerSession::ProcessBitmapL(), iBitmap handle= 0x%08x", iBitmap->Handle());
       
  1219         OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_PROCESSBITMAPL, "CThumbnailServerSession::ProcessBitmapL;iBitmap->Handle()=%o", iBitmap->Handle() );
  1149         
  1220         
  1150         params.iBitmapHandle = iBitmap->Handle();
  1221         params.iBitmapHandle = iBitmap->Handle();
  1151         const TSize bitmapSize = iBitmap->SizeInPixels();
  1222         const TSize bitmapSize = iBitmap->SizeInPixels();
  1152         
  1223         
  1153         if ( params.iQualityPreference == CThumbnailManager
  1224         if ( params.iQualityPreference == CThumbnailManager
  1161             }
  1232             }
  1162 
  1233 
  1163         iMessage.WriteL( 0, iRequestParams );
  1234         iMessage.WriteL( 0, iRequestParams );
  1164         
  1235         
  1165         TN_DEBUG1("CThumbnailServerSession()::ProcessBitmapL() bitmap to pool");
  1236         TN_DEBUG1("CThumbnailServerSession()::ProcessBitmapL() bitmap to pool");
       
  1237         OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_PROCESSBITMAPL, "CThumbnailServerSession::ProcessBitmapL - bitmap to pool" );
  1166         
  1238         
  1167         Server()->AddBitmapToPoolL( this, iBitmap, TThumbnailServerRequestId( this, params.iRequestId ) );
  1239         Server()->AddBitmapToPoolL( this, iBitmap, TThumbnailServerRequestId( this, params.iRequestId ) );
  1168         
  1240         
  1169         iMessage.Complete( KErrNone );
  1241         iMessage.Complete( KErrNone );
  1170         iMessage = RMessage2();
  1242         iMessage = RMessage2();
  1184 // -----------------------------------------------------------------------------
  1256 // -----------------------------------------------------------------------------
  1185 //
  1257 //
  1186 void CThumbnailServerSession::ReleaseBitmap( const RMessage2& aMessage )
  1258 void CThumbnailServerSession::ReleaseBitmap( const RMessage2& aMessage )
  1187     {
  1259     {
  1188     TN_DEBUG2( "CThumbnailServerSession::ReleaseBitmap(%d)", aMessage.Int0());
  1260     TN_DEBUG2( "CThumbnailServerSession::ReleaseBitmap(%d)", aMessage.Int0());
       
  1261     OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_RELEASEBITMAP, "CThumbnailServerSession::ReleaseBitmap;aMessage.Int0()=%d", aMessage.Int0() );
  1189     Server()->DeleteBitmapFromPool( aMessage.Int0());
  1262     Server()->DeleteBitmapFromPool( aMessage.Int0());
  1190     }
  1263     }
  1191 
  1264 
  1192 
  1265 
  1193 // -----------------------------------------------------------------------------
  1266 // -----------------------------------------------------------------------------
  1196 // -----------------------------------------------------------------------------
  1269 // -----------------------------------------------------------------------------
  1197 //
  1270 //
  1198 TInt CThumbnailServerSession::CancelRequest( const RMessage2& aMessage )
  1271 TInt CThumbnailServerSession::CancelRequest( const RMessage2& aMessage )
  1199     {
  1272     {
  1200     TN_DEBUG1( "CThumbnailServerSession::CancelRequest()" );
  1273     TN_DEBUG1( "CThumbnailServerSession::CancelRequest()" );
       
  1274     OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_CANCELREQUEST, "CThumbnailServerSession::CancelRequest" );
  1201     
  1275     
  1202     const TThumbnailServerRequestId requestId( this, aMessage.Int0());
  1276     const TThumbnailServerRequestId requestId( this, aMessage.Int0());
  1203     const TInt err = Server()->DequeTask( requestId );
  1277     const TInt err = Server()->DequeTask( requestId );
  1204     TN_DEBUG4( 
  1278     TN_DEBUG4( 
  1205         "CThumbnailServerSession::CancelRequest(0x%08x/%d) - returning %d",
  1279         "CThumbnailServerSession::CancelRequest(0x%08x/%d) - returning %d",
  1206         requestId.iSession, requestId.iRequestId, err );
  1280         requestId.iSession, requestId.iRequestId, err );
       
  1281     OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_CANCELREQUEST, "CThumbnailServerSession::CancelRequest;requestId.iSession=%o", requestId.iSession );
       
  1282     OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_CANCELREQUEST, "CThumbnailServerSession::CancelRequest;err=%d", err );
       
  1283     
  1207     return err;
  1284     return err;
  1208     }
  1285     }
  1209 
  1286 
  1210 // -----------------------------------------------------------------------------
  1287 // -----------------------------------------------------------------------------
  1211 // CThumbnailServerSession::ChangePriority()
  1288 // CThumbnailServerSession::ChangePriority()
  1213 // -----------------------------------------------------------------------------
  1290 // -----------------------------------------------------------------------------
  1214 //
  1291 //
  1215 TInt CThumbnailServerSession::ChangePriority( const RMessage2& aMessage )
  1292 TInt CThumbnailServerSession::ChangePriority( const RMessage2& aMessage )
  1216     {
  1293     {
  1217     TN_DEBUG1( "CThumbnailServerSession::ChangePriority()" );
  1294     TN_DEBUG1( "CThumbnailServerSession::ChangePriority()" );
       
  1295     OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_CHANGEPRIORITY, "CThumbnailServerSession::ChangePriority" );
  1218     
  1296     
  1219     const TThumbnailServerRequestId requestId( this, aMessage.Int0());
  1297     const TThumbnailServerRequestId requestId( this, aMessage.Int0());
  1220     const TInt newPriority = aMessage.Int1();
  1298     const TInt newPriority = aMessage.Int1();
  1221 
  1299 
  1222     const TInt err = Server()->ChangeTaskPriority( requestId, newPriority );
  1300     const TInt err = Server()->ChangeTaskPriority( requestId, newPriority );
  1223     TN_DEBUG5( 
  1301     TN_DEBUG5( 
  1224         "CThumbnailServerSession::ChangePriority(0x%08x/%d, %d) - returning %d",
  1302         "CThumbnailServerSession::ChangePriority(0x%08x/%d, %d) - returning %d",
  1225         requestId.iSession, requestId.iRequestId, newPriority, err );
  1303         requestId.iSession, requestId.iRequestId, newPriority, err );
       
  1304     OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_CHANGEPRIORITY, "CThumbnailServerSession::ChangePriority;requestId.iSession=%o", requestId.iSession );
       
  1305     OstTraceExt2( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_CHANGEPRIORITY, "CThumbnailServerSession::ChangePriority;requestId.iRequestId=%u;err=%d", requestId.iRequestId, err );
       
  1306     
  1226     return err;
  1307     return err;
  1227     }
  1308     }
  1228 
  1309 
  1229 // -----------------------------------------------------------------------------
  1310 // -----------------------------------------------------------------------------
  1230 // CThumbnailServerSession::DeleteThumbnailsL()
  1311 // CThumbnailServerSession::DeleteThumbnailsL()
  1234 void CThumbnailServerSession::DeleteThumbnailsL( const RMessage2& aMessage )
  1315 void CThumbnailServerSession::DeleteThumbnailsL( const RMessage2& aMessage )
  1235     {
  1316     {
  1236     if(aMessage.Int2() != KCheckValue)
  1317     if(aMessage.Int2() != KCheckValue)
  1237        {
  1318        {
  1238        TN_DEBUG1( "CThumbnailServerSession::DeleteThumbnailsL() - error in aMessage - leaving" );
  1319        TN_DEBUG1( "CThumbnailServerSession::DeleteThumbnailsL() - error in aMessage - leaving" );
       
  1320        OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_DELETETHUMBNAILSL, "CThumbnailServerSession::DeleteThumbnailsL - error in aMessage - leaving" );
  1239        User::Leave(KErrArgument);
  1321        User::Leave(KErrArgument);
  1240        }
  1322        }
  1241     
  1323     
  1242     HBufC* fileName = HBufC::NewLC( KMaxFileName );
  1324     HBufC* fileName = HBufC::NewLC( KMaxFileName );
  1243     TPtr ptr = fileName->Des();
  1325     TPtr ptr = fileName->Des();
  1257 void CThumbnailServerSession::DeleteThumbnailsByIdL( const RMessage2& aMessage )
  1339 void CThumbnailServerSession::DeleteThumbnailsByIdL( const RMessage2& aMessage )
  1258     {
  1340     {
  1259     if(aMessage.Int2() != KCheckValue)
  1341     if(aMessage.Int2() != KCheckValue)
  1260        {
  1342        {
  1261        TN_DEBUG1( "CThumbnailServerSession::DeleteThumbnailsByIdL() - error in aMessage - leaving" );
  1343        TN_DEBUG1( "CThumbnailServerSession::DeleteThumbnailsByIdL() - error in aMessage - leaving" );
       
  1344        OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_DELETETHUMBNAILSBYIDL, "CThumbnailServerSession::DeleteThumbnailsByIdL - error in aMessage - leaving" );
  1262        User::Leave(KErrArgument);
  1345        User::Leave(KErrArgument);
  1263        }
  1346        }
  1264     
  1347     
  1265     // read message params
  1348     // read message params
  1266     aMessage.ReadL( 0, iRequestParams );
  1349     aMessage.ReadL( 0, iRequestParams );
  1300 // -----------------------------------------------------------------------------
  1383 // -----------------------------------------------------------------------------
  1301 //
  1384 //
  1302 void CThumbnailServerSession::GetMimeTypeListL( const RMessage2& aMessage )
  1385 void CThumbnailServerSession::GetMimeTypeListL( const RMessage2& aMessage )
  1303     {
  1386     {
  1304     TN_DEBUG1( "CThumbnailServerSession::GetMimeTypeListL()" );
  1387     TN_DEBUG1( "CThumbnailServerSession::GetMimeTypeListL()" );
       
  1388     OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_GETMIMETYPELISTL, "CThumbnailServerSession::GetMimeTypeListL" );
  1305     
  1389     
  1306     TInt len = aMessage.GetDesMaxLengthL( 0 );
  1390     TInt len = aMessage.GetDesMaxLengthL( 0 );
  1307     HBufC* buf = HBufC::NewLC( len );
  1391     HBufC* buf = HBufC::NewLC( len );
  1308     TPtr ptr = buf->Des();
  1392     TPtr ptr = buf->Des();
  1309     Server()->GetMimeTypeList( ptr );
  1393     Server()->GetMimeTypeList( ptr );
  1415                 RFile64 file;
  1499                 RFile64 file;
  1416                 CleanupClosePushL( file );
  1500                 CleanupClosePushL( file );
  1417               
  1501               
  1418                 User::LeaveIfError( file.Open( Server()->Fs(), params.iFileName, EFileShareReadersOrWriters )); 
  1502                 User::LeaveIfError( file.Open( Server()->Fs(), params.iFileName, EFileShareReadersOrWriters )); 
  1419                 TN_DEBUG2( "CThumbnailServerSession::ResolveMimeType - file handle opened for %S", &params.iFileName );
  1503                 TN_DEBUG2( "CThumbnailServerSession::ResolveMimeType - file handle opened for %S", &params.iFileName );
       
  1504                 OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_RESOLVEMIMETYPEL, "CThumbnailServerSession::ResolveMimeTypeL - file handle opened;params.iFileName=%S", params.iFileName );
  1420               
  1505               
  1421                 params.iMimeType = Server()->ResolveMimeTypeL(file);
  1506                 params.iMimeType = Server()->ResolveMimeTypeL(file);
  1422               
  1507               
  1423                 file.Close();
  1508                 file.Close();
  1424                 TN_DEBUG1("CThumbnailServerSession::ResolveMimeType - file handle closed");
  1509                 TN_DEBUG1("CThumbnailServerSession::ResolveMimeType - file handle closed");
       
  1510                 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_RESOLVEMIMETYPEL, "CThumbnailServerSession::ResolveMimeTypeL - file handle closed" );
  1425               
  1511               
  1426                 CleanupStack::Pop( &file );    
  1512                 CleanupStack::Pop( &file );    
  1427                 }    
  1513                 }    
  1428             }        
  1514             }        
  1429         }       
  1515         }       
  1435 // ---------------------------------------------------------------------------
  1521 // ---------------------------------------------------------------------------
  1436 //
  1522 //
  1437 TInt CThumbnailServerSession::ConvertSqlErrToE32Err( TInt aReason )
  1523 TInt CThumbnailServerSession::ConvertSqlErrToE32Err( TInt aReason )
  1438     {
  1524     {
  1439     TN_DEBUG2("CThumbnailServerSession::ConvertSqlErrToE32Err(%d)", aReason);
  1525     TN_DEBUG2("CThumbnailServerSession::ConvertSqlErrToE32Err(%d)", aReason);
       
  1526     OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_CONVERTSQLERRTOE32ERR, "CThumbnailServerSession::ConvertSqlErrToE32Err;aReason=%d", aReason );
  1440     TInt e32Err(aReason);
  1527     TInt e32Err(aReason);
  1441 	
  1528 	
  1442     if ( aReason >=  - 144 )
  1529     if ( aReason >=  - 144 )
  1443     // magic: [-1..-144] is E32 error range 
  1530     // magic: [-1..-144] is E32 error range 
  1444         {
  1531         {
  1538 // ---------------------------------------------------------------------------
  1625 // ---------------------------------------------------------------------------
  1539 //
  1626 //
  1540 TBool CThumbnailServerSession::ClientThreadAlive()
  1627 TBool CThumbnailServerSession::ClientThreadAlive()
  1541     {
  1628     {
  1542     TN_DEBUG1( "CThumbnailServerSession::ClientThreadAlive()");
  1629     TN_DEBUG1( "CThumbnailServerSession::ClientThreadAlive()");
       
  1630     OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_CLIENTTHREADALIVE, "CThumbnailServerSession::ClientThreadAlive" );
  1543     
  1631     
  1544     if ( iMessage.Handle())
  1632     if ( iMessage.Handle())
  1545         {
  1633         {
  1546         // check if client thread alive
  1634         // check if client thread alive
  1547         TExitType exitType = iClientThread.ExitType();
  1635         TExitType exitType = iClientThread.ExitType();
  1548         
  1636         
  1549         if( exitType != EExitPending )
  1637         if( exitType != EExitPending )
  1550             {
  1638             {
  1551             TN_DEBUG1( "CThumbnailServerSession::ClientThreadAlive() - client thread died");
  1639             TN_DEBUG1( "CThumbnailServerSession::ClientThreadAlive() - client thread died");
       
  1640             OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_CLIENTTHREADALIVE, "CThumbnailServerSession::ClientThreadAlive - client thread died" );
  1552         
  1641         
  1553             iMessage = RMessage2();
  1642             iMessage = RMessage2();
  1554             
  1643             
  1555             return EFalse;
  1644             return EFalse;
  1556             }
  1645             }
  1561             }
  1650             }
  1562         }
  1651         }
  1563     else
  1652     else
  1564         {
  1653         {
  1565         TN_DEBUG1( "CThumbnailServerSession::ClientThreadAlive() - message null");       
  1654         TN_DEBUG1( "CThumbnailServerSession::ClientThreadAlive() - message null");       
       
  1655         OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_CLIENTTHREADALIVE, "CThumbnailServerSession::ClientThreadAlive - message null" );
  1566         return EFalse;
  1656         return EFalse;
  1567         }
  1657         }
  1568     }
  1658     }
  1569 
  1659 
  1570 
  1660