imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtask.cpp
branchRCL_3
changeset 41 9d4d3445ce6e
parent 40 6257223ede8a
child 58 9e8b0cc88842
equal deleted inserted replaced
40:6257223ede8a 41:9d4d3445ce6e
    23 #include "thumbnailprovider.h"
    23 #include "thumbnailprovider.h"
    24 #include "thumbnaillog.h"
    24 #include "thumbnaillog.h"
    25 #include "thumbnailpanic.h"
    25 #include "thumbnailpanic.h"
    26 #include "thumbnailserversession.h"  // ConvertSqlErrToE32Err()
    26 #include "thumbnailserversession.h"  // ConvertSqlErrToE32Err()
    27 #include "thumbnailmanagerconstants.h"
    27 #include "thumbnailmanagerconstants.h"
    28 #include "OstTraceDefinitions.h"
       
    29 #ifdef OST_TRACE_COMPILER_IN_USE
       
    30 #include "thumbnailtaskTraces.h"
       
    31 #endif
       
    32 
       
    33 
    28 
    34 // ======== MEMBER FUNCTIONS ========
    29 // ======== MEMBER FUNCTIONS ========
    35 
    30 
    36 // ---------------------------------------------------------------------------
    31 // ---------------------------------------------------------------------------
    37 // CThumbnailTask::CThumbnailTask()
    32 // CThumbnailTask::CThumbnailTask()
    88 // ---------------------------------------------------------------------------
    83 // ---------------------------------------------------------------------------
    89 //
    84 //
    90 void CThumbnailTask::StartL()
    85 void CThumbnailTask::StartL()
    91     {
    86     {
    92     TN_DEBUG3( "CThumbnailTask(0x%08x)::StartL() iState == %d ", this, iState );
    87     TN_DEBUG3( "CThumbnailTask(0x%08x)::StartL() iState == %d ", this, iState );
    93     OstTrace1( TRACE_NORMAL, CTHUMBNAILTASK_STARTL, "CThumbnailTask::StartL;this=%o", this );
       
    94     OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASK_STARTL, "CThumbnailTask::StartL;iState=%u", iState );
       
    95     
       
    96     __ASSERT_DEBUG(( iState != ERunning ), ThumbnailPanic( EThumbnailAlreadyRunning ));
    88     __ASSERT_DEBUG(( iState != ERunning ), ThumbnailPanic( EThumbnailAlreadyRunning ));
    97     iState = ERunning;
    89     iState = ERunning;
    98     }
    90     }
    99 
    91 
   100 
    92 
   114 //
   106 //
   115 void CThumbnailTask::Complete( TInt aReason )
   107 void CThumbnailTask::Complete( TInt aReason )
   116     {
   108     {
   117     TN_DEBUG4( "CThumbnailTask(0x%08x)::Complete(aReason=%d) iState was %d",
   109     TN_DEBUG4( "CThumbnailTask(0x%08x)::Complete(aReason=%d) iState was %d",
   118         this, aReason, iState );
   110         this, aReason, iState );
   119     OstTrace1( TRACE_NORMAL, CTHUMBNAILTASK_COMPLETE, "CThumbnailTask::Complete;this=%o", this );
       
   120     OstTraceExt2( TRACE_NORMAL, DUP1_CTHUMBNAILTASK_COMPLETE, "CThumbnailTask::Complete;aReason=%d;iState=%u", aReason, iState );
       
   121     
   111     
   122     if ( iState != EComplete )
   112     if ( iState != EComplete )
   123         {
   113         {
   124         iState = EComplete;
   114         iState = EComplete;
   125         
   115         
   164 void CThumbnailTask::StartError( TInt aError )
   154 void CThumbnailTask::StartError( TInt aError )
   165     {
   155     {
   166     // This is called if StartL() left. Complete this task with an error and
   156     // This is called if StartL() left. Complete this task with an error and
   167     // continue processing.
   157     // continue processing.
   168     TN_DEBUG3( "CThumbnailTask(0x%08x)::StartError(aError=%d)", this, aError );
   158     TN_DEBUG3( "CThumbnailTask(0x%08x)::StartError(aError=%d)", this, aError );
   169     OstTrace1( TRACE_NORMAL, CTHUMBNAILTASK_STARTERROR, "CThumbnailTask::StartError;this=%o", this );
       
   170     OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASK_STARTERROR, "CThumbnailTask::StartError;aError=%d", aError );
       
   171     
       
   172     Complete( aError );
   159     Complete( aError );
   173     }
   160     }
   174 
   161 
   175 
   162 
   176 // ---------------------------------------------------------------------------
   163 // ---------------------------------------------------------------------------
   200         iClientThread.Duplicate(aClientThread);
   187         iClientThread.Duplicate(aClientThread);
   201         }
   188         }
   202     else
   189     else
   203         {
   190         {
   204         TN_DEBUG2( "CThumbnailTask(0x%08x)::ClientThreadAlive() - message null", this);
   191         TN_DEBUG2( "CThumbnailTask(0x%08x)::ClientThreadAlive() - message null", this);
   205         OstTrace1( TRACE_NORMAL, CTHUMBNAILTASK_SETMESSAGEDATA, "CThumbnailTask::SetMessageData - message null;this=%o", this );
       
   206         }
   192         }
   207     }
   193     }
   208 
   194 
   209 // ---------------------------------------------------------------------------
   195 // ---------------------------------------------------------------------------
   210 // CThumbnailTask::SetMessageData()
   196 // CThumbnailTask::SetMessageData()
   259 // ---------------------------------------------------------------------------
   245 // ---------------------------------------------------------------------------
   260 //
   246 //
   261 TBool CThumbnailTask::ClientThreadAlive(const TBool aGetThread)
   247 TBool CThumbnailTask::ClientThreadAlive(const TBool aGetThread)
   262     {
   248     {
   263     TN_DEBUG1( "CThumbnailTask::ClientThreadAlive()");
   249     TN_DEBUG1( "CThumbnailTask::ClientThreadAlive()");
   264     OstTrace0( TRACE_NORMAL, CTHUMBNAILTASK_CLIENTTHREADALIVE, "CThumbnailTask::ClientThreadAlive" );
       
   265     
   250     
   266     if ( iMessage.Handle())
   251     if ( iMessage.Handle())
   267         {
   252         {
   268         if (aGetThread)
   253         if (aGetThread)
   269             {
   254             {
   270             // get client thread
   255             // get client thread
   271             TInt err = iMessage.Client( iClientThread );
   256             TInt err = iMessage.Client( iClientThread );
   272             if (err != KErrNone)
   257             if (err != KErrNone)
   273                 {
   258                 {
   274                 TN_DEBUG2( "CThumbnailTask(0x%08x)::ClientThreadAlive() - client thread not found", this);
   259                 TN_DEBUG2( "CThumbnailTask(0x%08x)::ClientThreadAlive() - client thread not found", this);
   275                 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASK_CLIENTTHREADALIVE, "CThumbnailTask::ClientThreadAlive - client thread not found;this=%o", this );
       
   276             
   260             
   277                 ResetMessageData();
   261                 ResetMessageData();
   278                 
   262                 
   279                 return EFalse;
   263                 return EFalse;
   280                 }
   264                 }
   283         // check if client thread alive
   267         // check if client thread alive
   284         TExitType exitType = iClientThread.ExitType();
   268         TExitType exitType = iClientThread.ExitType();
   285         if( exitType != EExitPending )
   269         if( exitType != EExitPending )
   286             {
   270             {
   287             TN_DEBUG2( "CThumbnailTask(0x%08x)::ClientThreadAlive() - client thread died", this);
   271             TN_DEBUG2( "CThumbnailTask(0x%08x)::ClientThreadAlive() - client thread died", this);
   288             OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILTASK_CLIENTTHREADALIVE, "CThumbnailTask::ClientThreadAlive -  client thread died;this=%o", this );
       
   289         
   272         
   290             ResetMessageData();
   273             ResetMessageData();
   291             
   274             
   292             return EFalse;
   275             return EFalse;
   293             }
   276             }