imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp
branchRCL_3
changeset 22 9d4d3445ce6e
parent 21 6257223ede8a
equal deleted inserted replaced
21:6257223ede8a 22:9d4d3445ce6e
    23 #include "thumbnailprovider.h"
    23 #include "thumbnailprovider.h"
    24 #include "thumbnailmanageruids.hrh"
    24 #include "thumbnailmanageruids.hrh"
    25 #include "thumbnailmanagerconstants.h"
    25 #include "thumbnailmanagerconstants.h"
    26 #include "thumbnailgeneratetask.h"
    26 #include "thumbnailgeneratetask.h"
    27 #include "thumbnailpanic.h"
    27 #include "thumbnailpanic.h"
    28 #include "OstTraceDefinitions.h"
       
    29 #ifdef OST_TRACE_COMPILER_IN_USE
       
    30 #include "thumbnailtaskprocessorTraces.h"
       
    31 #endif
       
    32 
       
    33 
    28 
    34 
    29 
    35 // ======== MEMBER FUNCTIONS ========
    30 // ======== MEMBER FUNCTIONS ========
    36 
    31 
    37 // ---------------------------------------------------------------------------
    32 // ---------------------------------------------------------------------------
    69 void CThumbnailTaskProcessor::ConstructL()
    64 void CThumbnailTaskProcessor::ConstructL()
    70     {
    65     {
    71     // define PS property
    66     // define PS property
    72     TInt ret = RProperty::Delete(KServerIdle, KIdle);
    67     TInt ret = RProperty::Delete(KServerIdle, KIdle);
    73     TN_DEBUG2( "CThumbnailTaskProcessor::CThumbnailTaskProcessor() Delete KServerIdle %d", ret);
    68     TN_DEBUG2( "CThumbnailTaskProcessor::CThumbnailTaskProcessor() Delete KServerIdle %d", ret);
    74     OstTrace1( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_CONSTRUCTL, "CThumbnailTaskProcessor::ConstructL - Delete KServerIdle;ret=%d", ret );
       
    75     
    69     
    76     ret=RProperty::Define(KServerIdle, KIdle, RProperty::EInt);
    70     ret=RProperty::Define(KServerIdle, KIdle, RProperty::EInt);
    77     TN_DEBUG2( "CThumbnailTaskProcessor::ConstructL() Define KServerIdle %d", ret);
    71     TN_DEBUG2( "CThumbnailTaskProcessor::ConstructL() Define KServerIdle %d", ret);
    78     OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASKPROCESSOR_CONSTRUCTL, "CThumbnailTaskProcessor::ConstructL - Define KServerIdle;ret=%d", ret );
       
    79     
    72     
    80     // attach to the property    
    73     // attach to the property    
    81 	ret = iProperty.Attach(KServerIdle, KIdle, EOwnerThread);
    74 	ret = iProperty.Attach(KServerIdle, KIdle, EOwnerThread);
    82     TN_DEBUG2( "CThumbnailTaskProcessor::ConstructL()Attach %d", ret);
    75     TN_DEBUG2( "CThumbnailTaskProcessor::ConstructL()Attach %d", ret);
    83     OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILTASKPROCESSOR_CONSTRUCTL, "CThumbnailTaskProcessor::ConstructL - Attach;ret=%d", ret );
       
    84     
    76     
    85 	// set initial PS value
    77 	// set initial PS value
    86     ret = iProperty.Set( ETrue );
    78     ret = iProperty.Set( ETrue );
    87     TN_DEBUG2( "CThumbnailTaskProcessor::ConstructL() Set IDLE ETrue %d", ret );
    79     TN_DEBUG2( "CThumbnailTaskProcessor::ConstructL() Set IDLE ETrue %d", ret );
    88     OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILTASKPROCESSOR_CONSTRUCTL, "CThumbnailTaskProcessor::ConstructL - Set IDLE ETrue;ret=%d", ret );
       
    89     iIdle = ETrue;
    80     iIdle = ETrue;
    90     
    81     
    91     iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityIdle);
    82     iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityIdle);
    92     
    83     
    93     iTimerActive = EFalse;
    84     iTimerActive = EFalse;
   106     Cancel();
    97     Cancel();
   107     iTasks.ResetAndDestroy();
    98     iTasks.ResetAndDestroy();
   108     iProperty.Close();
    99     iProperty.Close();
   109     TInt ret = RProperty::Delete(KServerIdle, KIdle);
   100     TInt ret = RProperty::Delete(KServerIdle, KIdle);
   110     TN_DEBUG2( "CThumbnailTaskProcessor::CThumbnailTaskProcessor() Delete KServerIdle %d", ret);
   101     TN_DEBUG2( "CThumbnailTaskProcessor::CThumbnailTaskProcessor() Delete KServerIdle %d", ret);
   111     OstTrace1( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_CTHUMBNAILTASKPROCESSOR, "CThumbnailTaskProcessor::~CThumbnailTaskProcessor - Delete KServerIdle;ret=%d", ret );
       
   112     
   102     
   113     if(iPeriodicTimer)
   103     if(iPeriodicTimer)
   114        {
   104        {
   115        iPeriodicTimer->Cancel();
   105        iPeriodicTimer->Cancel();
   116        }
   106        }
   125 // ---------------------------------------------------------------------------
   115 // ---------------------------------------------------------------------------
   126 //
   116 //
   127 void CThumbnailTaskProcessor::AddTaskL( CThumbnailTask* aTask )
   117 void CThumbnailTaskProcessor::AddTaskL( CThumbnailTask* aTask )
   128     {
   118     {
   129     TN_DEBUG1( "CThumbnailTaskProcessor::AddTaskL()");
   119     TN_DEBUG1( "CThumbnailTaskProcessor::AddTaskL()");
   130     OstTrace0( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_ADDTASKL, "CThumbnailTaskProcessor::AddTaskL" );
       
   131     __ASSERT_DEBUG(( aTask ), ThumbnailPanic( EThumbnailNullPointer ));
   120     __ASSERT_DEBUG(( aTask ), ThumbnailPanic( EThumbnailNullPointer ));
   132     const TInt taskCount = iTasks.Count();
   121     const TInt taskCount = iTasks.Count();
   133     iTasks.AppendL( aTask );
   122     iTasks.AppendL( aTask );
   134     
   123     
   135     if ( !IsActive() && !taskCount )
   124     if ( !IsActive() && !taskCount )
   151 //
   140 //
   152 TInt CThumbnailTaskProcessor::RemoveTask( const TThumbnailServerRequestId&
   141 TInt CThumbnailTaskProcessor::RemoveTask( const TThumbnailServerRequestId&
   153     aRequestId )
   142     aRequestId )
   154     {
   143     {
   155     TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - request ID: %d", aRequestId.iRequestId);
   144     TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - request ID: %d", aRequestId.iRequestId);
   156     OstTrace1( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_REMOVETASK, "CThumbnailTaskProcessor::RemoveTask;aRequestId.iRequestId=%u", aRequestId.iRequestId );
       
   157     
   145     
   158     TBool cancel = EFalse;
   146     TBool cancel = EFalse;
   159     TInt res = KErrNotFound;
   147     TInt res = KErrNotFound;
   160     
   148     
   161     for ( TInt i = iTasks.Count(); --i >= 0; )
   149     for ( TInt i = iTasks.Count(); --i >= 0; )
   169                 delete task;
   157                 delete task;
   170                 task = NULL;
   158                 task = NULL;
   171                 iTasks.Remove( i );
   159                 iTasks.Remove( i );
   172                 
   160                 
   173                 TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - removed request ID: %d", aRequestId.iRequestId);
   161                 TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - removed request ID: %d", aRequestId.iRequestId);
   174                 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASKPROCESSOR_REMOVETASK, "CThumbnailTaskProcessor::RemoveTask - removed request ID:;aRequestId.iRequestId=%u", aRequestId.iRequestId );
       
   175                 }
   162                 }
   176             else
   163             else
   177                 {
   164                 {
   178                 // Task is already running, canceled first
   165                 // Task is already running, canceled first
   179                 task->Cancel();
   166                 task->Cancel();
   181                 task = NULL;
   168                 task = NULL;
   182                 iTasks.Remove( i );
   169                 iTasks.Remove( i );
   183                 cancel = ETrue;
   170                 cancel = ETrue;
   184                 
   171                 
   185                 TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - canceled & removed request ID: %d", aRequestId.iRequestId);
   172                 TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - canceled & removed request ID: %d", aRequestId.iRequestId);
   186                 OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILTASKPROCESSOR_REMOVETASK, "CThumbnailTaskProcessor::RemoveTask - canceled & removed request ID:;aRequestId.iRequestId=%u", aRequestId.iRequestId );
       
   187                 }
   173                 }
   188             
   174             
   189             res = KErrNone;
   175             res = KErrNone;
   190             
   176             
   191             // don't break, because there could be many tasks related to the same request ID
   177             // don't break, because there could be many tasks related to the same request ID
   203         {
   189         {
   204         iTasks.Compress();
   190         iTasks.Compress();
   205         }
   191         }
   206     
   192     
   207     TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - remaining task count: %d", iTasks.Count());
   193     TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - remaining task count: %d", iTasks.Count());
   208     OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILTASKPROCESSOR_REMOVETASK, "CThumbnailTaskProcessor::RemoveTask -  - remaining task count;iTasks.Count()=%d", iTasks.Count() );
   194     
   209     return res;
   195     return res;
   210     }
   196     }
   211 
   197 
   212 // ---------------------------------------------------------------------------
   198 // ---------------------------------------------------------------------------
   213 // CThumbnailTaskProcessor::RemoveTasks()
   199 // CThumbnailTaskProcessor::RemoveTasks()
   215 // ---------------------------------------------------------------------------
   201 // ---------------------------------------------------------------------------
   216 //
   202 //
   217 void CThumbnailTaskProcessor::RemoveTasks( CThumbnailServerSession* aSession )
   203 void CThumbnailTaskProcessor::RemoveTasks( CThumbnailServerSession* aSession )
   218     {
   204     {
   219     TN_DEBUG1( "CThumbnailTaskProcessor::RemoveTasks()");
   205     TN_DEBUG1( "CThumbnailTaskProcessor::RemoveTasks()");
   220     OstTrace0( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_REMOVETASKS, "CThumbnailTaskProcessor::RemoveTasks" );
       
   221     
   206     
   222     TBool cancel = EFalse;
   207     TBool cancel = EFalse;
   223     
   208     
   224     for ( TInt i = iTasks.Count(); --i >= 0; )
   209     for ( TInt i = iTasks.Count(); --i >= 0; )
   225         {
   210         {
   235                 delete task;
   220                 delete task;
   236                 task = NULL;
   221                 task = NULL;
   237                 iTasks.Remove( i );
   222                 iTasks.Remove( i );
   238                 
   223                 
   239                 TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - removed request ID: %d", id);
   224                 TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - removed request ID: %d", id);
   240                 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASKPROCESSOR_REMOVETASKS, "CThumbnailTaskProcessor::RemoveTasks - removed request ID;id=%d", id );
       
   241                 }
   225                 }
   242             else
   226             else
   243                 {
   227                 {
   244                 TN_DEBUG1( "CThumbnailTaskProcessor::RemoveTasks() - task still running");
   228                 TN_DEBUG1( "CThumbnailTaskProcessor::RemoveTasks() - task still running");
   245                 OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILTASKPROCESSOR_REMOVETASKS, "CThumbnailTaskProcessor::RemoveTasks - task still running" );
       
   246                 
   229                 
   247                 TThumbnailRequestId id = task->RequestId().iRequestId;
   230                 TThumbnailRequestId id = task->RequestId().iRequestId;
   248                 
   231                 
   249                 // Task is already running, canceled first
   232                 // Task is already running, canceled first
   250                 task->Cancel();
   233                 task->Cancel();
   252                 task = NULL;
   235                 task = NULL;
   253                 iTasks.Remove( i );
   236                 iTasks.Remove( i );
   254                 cancel = ETrue;
   237                 cancel = ETrue;
   255                 
   238                 
   256                 TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - canceled & removed request ID: %d", id);
   239                 TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - canceled & removed request ID: %d", id);
   257                 OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILTASKPROCESSOR_REMOVETASKS, "CThumbnailTaskProcessor::RemoveTasks - canceled & removed request ID;id=%d", id );
       
   258                 }
   240                 }
   259             }
   241             }
   260         }
   242         }
   261     
   243     
   262     // no tasks active anymore
   244     // no tasks active anymore
   265         Cancel();
   247         Cancel();
   266         TaskComplete(NULL);
   248         TaskComplete(NULL);
   267         }
   249         }
   268     
   250     
   269     TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - remaining task count: %d", iTasks.Count());
   251     TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - remaining task count: %d", iTasks.Count());
   270     OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILTASKPROCESSOR_REMOVETASKS, "CThumbnailTaskProcessor::RemoveTasks - remaining task count;iTasks.Count()=%d", iTasks.Count() );
       
   271     }
   252     }
   272 
   253 
   273 // ---------------------------------------------------------------------------
   254 // ---------------------------------------------------------------------------
   274 // CThumbnailTaskProcessor::RemoveAllTasks()
   255 // CThumbnailTaskProcessor::RemoveAllTasks()
   275 // Removes specific task from the queue.
   256 // Removes specific task from the queue.
   276 // ---------------------------------------------------------------------------
   257 // ---------------------------------------------------------------------------
   277 //
   258 //
   278 void CThumbnailTaskProcessor::RemoveAllTasks()
   259 void CThumbnailTaskProcessor::RemoveAllTasks()
   279     {
   260     {
   280     TN_DEBUG1( "CThumbnailTaskProcessor::RemoveAllTasks()");
   261     TN_DEBUG1( "CThumbnailTaskProcessor::RemoveAllTasks()");
   281     OstTrace0( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_REMOVEALLTASKS, "CThumbnailTaskProcessor::RemoveAllTasks" );
       
   282     
   262     
   283     TBool cancel = EFalse;
   263     TBool cancel = EFalse;
   284     
   264     
   285     for ( TInt i = iTasks.Count(); --i >= 0; )
   265     for ( TInt i = iTasks.Count(); --i >= 0; )
   286         {
   266         {
   293             delete task;
   273             delete task;
   294             task = NULL;
   274             task = NULL;
   295             iTasks.Remove( i );
   275             iTasks.Remove( i );
   296             
   276             
   297             TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - removed request ID: %d", id);
   277             TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - removed request ID: %d", id);
   298             OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASKPROCESSOR_REMOVEALLTASKS, "CThumbnailTaskProcessor::RemoveAllTasks -  removed request ID;id=%d", id );
       
   299             }
   278             }
   300         else
   279         else
   301             {
   280             {
   302             TN_DEBUG1( "CThumbnailTaskProcessor::RemoveTasks() - task still running");
   281             TN_DEBUG1( "CThumbnailTaskProcessor::RemoveTasks() - task still running");
   303             OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILTASKPROCESSOR_REMOVEALLTASKS, "CThumbnailTaskProcessor::RemoveAllTasks - task still running" );
       
   304             
   282             
   305             TThumbnailRequestId id = task->RequestId().iRequestId;
   283             TThumbnailRequestId id = task->RequestId().iRequestId;
   306             
   284             
   307             // Task is already running, canceled first
   285             // Task is already running, canceled first
   308             task->Cancel();
   286             task->Cancel();
   310             task = NULL;
   288             task = NULL;
   311             iTasks.Remove( i );
   289             iTasks.Remove( i );
   312             cancel = ETrue;
   290             cancel = ETrue;
   313             
   291             
   314             TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - canceled & removed request ID: %d", id);
   292             TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - canceled & removed request ID: %d", id);
   315             OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILTASKPROCESSOR_REMOVEALLTASKS, "CThumbnailTaskProcessor::RemoveAllTasks - canceled & removed request ID;id=%d", id );
       
   316             }
   293             }
   317         }
   294         }
   318     
   295     
   319     // no tasks active anymore
   296     // no tasks active anymore
   320     if ( cancel ) 
   297     if ( cancel ) 
   322         Cancel();
   299         Cancel();
   323         TaskComplete(NULL);
   300         TaskComplete(NULL);
   324         }
   301         }
   325     
   302     
   326     TN_DEBUG1( "CThumbnailTaskProcessor::RemoveAllTasks() - Task removed because of starting format" );
   303     TN_DEBUG1( "CThumbnailTaskProcessor::RemoveAllTasks() - Task removed because of starting format" );
   327     OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILTASKPROCESSOR_REMOVEALLTASKS, "CThumbnailTaskProcessor::RemoveAllTasks - Task removed because of starting format" );
       
   328     }
   304     }
   329 
   305 
   330 // ---------------------------------------------------------------------------
   306 // ---------------------------------------------------------------------------
   331 // CThumbnailTaskProcessor::ChangeTaskPriority()
   307 // CThumbnailTaskProcessor::ChangeTaskPriority()
   332 // Changes priority of a task.
   308 // Changes priority of a task.
   361     TInt taskPriority;
   337     TInt taskPriority;
   362     TBool processingDaemonTasksOnly(ETrue);
   338     TBool processingDaemonTasksOnly(ETrue);
   363     
   339     
   364 #ifdef _DEBUG
   340 #ifdef _DEBUG
   365     TN_DEBUG2( "CThumbnailTaskProcessor::TASKPROCESSOR-COUNTER---------- in, Tasks = %d", iTasks.Count() );
   341     TN_DEBUG2( "CThumbnailTaskProcessor::TASKPROCESSOR-COUNTER---------- in, Tasks = %d", iTasks.Count() );
   366     OstTrace1( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_RUNL, "CThumbnailTaskProcessor::TASKPROCESSOR-COUNTER---------- in, Tasks;iTasks.Count()=%d", iTasks.Count() );
       
   367 #endif
   342 #endif
   368     
   343     
   369     // remove completed tasks and run priorised task
   344     // remove completed tasks and run priorised task
   370     for ( TInt i = iTasks.Count(); --i >= 0; )
   345     for ( TInt i = iTasks.Count(); --i >= 0; )
   371         {
   346         {
   392             if ( processingDaemonTasksOnly && task->ClientThreadAlive() )
   367             if ( processingDaemonTasksOnly && task->ClientThreadAlive() )
   393                 {
   368                 {
   394                 if(task->GetMessageData().Identity() != KDaemonUid )
   369                 if(task->GetMessageData().Identity() != KDaemonUid )
   395                     {
   370                     {
   396                     TN_DEBUG1( "CThumbnailTaskProcessor::RunL() processingDaemonTasksOnly = EFalse" );
   371                     TN_DEBUG1( "CThumbnailTaskProcessor::RunL() processingDaemonTasksOnly = EFalse" );
   397                     OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILTASKPROCESSOR_RUNL, "CThumbnailTaskProcessor::RunL processingDaemonTasksOnly = EFalse" );
       
   398                     processingDaemonTasksOnly = EFalse; 
   372                     processingDaemonTasksOnly = EFalse; 
   399                     }
   373                     }
   400                 }
   374                 }
   401             }
   375             }
   402         }
   376         }
   406         iActiveTask->StartL();
   380         iActiveTask->StartL();
   407         }
   381         }
   408     
   382     
   409 #ifdef _DEBUG
   383 #ifdef _DEBUG
   410     TN_DEBUG2( "CThumbnailTaskProcessor::TASKPROCESSOR-COUNTER---------- out, Tasks = %d", iTasks.Count() );
   384     TN_DEBUG2( "CThumbnailTaskProcessor::TASKPROCESSOR-COUNTER---------- out, Tasks = %d", iTasks.Count() );
   411     OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILTASKPROCESSOR_RUNL, "CThumbnailTaskProcessor::TASKPROCESSOR-COUNTER---------- out, Tasks;iTasks.Count()=%d", iTasks.Count() );
       
   412 #endif
   385 #endif
   413 
   386 
   414 	//update PS value for Daemon
   387 	//update PS value for Daemon
   415     if( iTasks.Count() > 0 && iIdle && !processingDaemonTasksOnly)
   388     if( iTasks.Count() > 0 && iIdle && !processingDaemonTasksOnly)
   416         {
   389         {
   420            iPeriodicTimer->Cancel();
   393            iPeriodicTimer->Cancel();
   421            iTimerActive = EFalse;
   394            iTimerActive = EFalse;
   422            }
   395            }
   423         TInt ret = iProperty.Set( EFalse );
   396         TInt ret = iProperty.Set( EFalse );
   424         TN_DEBUG2( "CThumbnailTaskProcessor::RunL() iProperty Set EFalse %d", ret );
   397         TN_DEBUG2( "CThumbnailTaskProcessor::RunL() iProperty Set EFalse %d", ret );
   425         OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILTASKPROCESSOR_RUNL, "CThumbnailTaskProcessor::RunL - iProperty Set EFalse;ret=%d", ret );
       
   426         iIdle = EFalse;
   398         iIdle = EFalse;
   427         }
   399         }
   428     else
   400     else
   429         {
   401         {
   430         if(!iIdle)
   402         if(!iIdle)
   436                  {
   408                  {
   437                  iPeriodicTimer->Cancel();
   409                  iPeriodicTimer->Cancel();
   438                  iTimerActive = EFalse;
   410                  iTimerActive = EFalse;
   439                  } 
   411                  } 
   440                TN_DEBUG1( "CThumbnailTaskProcessor::RunL() - daemon is the process");
   412                TN_DEBUG1( "CThumbnailTaskProcessor::RunL() - daemon is the process");
   441                OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILTASKPROCESSOR_RUNL, "CThumbnailTaskProcessor::RunL - daemon is the process" );
       
   442                TInt ret = iProperty.Set( ETrue );
   413                TInt ret = iProperty.Set( ETrue );
   443                TN_DEBUG2( "CThumbnailTaskProcessor::RunL() iProperty Set ETrue %d", ret );
   414                TN_DEBUG2( "CThumbnailTaskProcessor::RunL() iProperty Set ETrue %d", ret );
   444                iIdle = ETrue;
   415                iIdle = ETrue;
   445                }
   416                }
   446             else
   417             else
   447                {
   418                {
   448                TN_DEBUG1( "CThumbnailTaskProcessor::RunL() - daemon is not the process - start timer");
   419                TN_DEBUG1( "CThumbnailTaskProcessor::RunL() - daemon is not the process - start timer");
   449                OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILTASKPROCESSOR_RUNL, "CThumbnailTaskProcessor::RunL - daemon is not the process - start timer" );
       
   450                if(iTimerActive)
   420                if(iTimerActive)
   451                   {
   421                   {
   452                   iPeriodicTimer->Cancel();
   422                   iPeriodicTimer->Cancel();
   453                   iTimerActive = EFalse;
   423                   iTimerActive = EFalse;
   454                   }  
   424                   }  
   465 // ---------------------------------------------------------------------------
   435 // ---------------------------------------------------------------------------
   466 //
   436 //
   467 TInt CThumbnailTaskProcessor::RunError( TInt aError )
   437 TInt CThumbnailTaskProcessor::RunError( TInt aError )
   468     {
   438     {
   469     TN_DEBUG1( "CThumbnailTaskProcessor::RunError()");
   439     TN_DEBUG1( "CThumbnailTaskProcessor::RunError()");
   470     OstTrace0( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_RUNERROR, "CThumbnailTaskProcessor::RunError" );
       
   471     if ( iActiveTask )
   440     if ( iActiveTask )
   472         {
   441         {
   473         // This will complete the task and continue processing from the
   442         // This will complete the task and continue processing from the
   474         // next task
   443         // next task
   475         iActiveTask->StartError( aError );
   444         iActiveTask->StartError( aError );
   493 // ---------------------------------------------------------------------------
   462 // ---------------------------------------------------------------------------
   494 //
   463 //
   495 void CThumbnailTaskProcessor::TaskComplete( CThumbnailTask*  /*aTask*/ )
   464 void CThumbnailTaskProcessor::TaskComplete( CThumbnailTask*  /*aTask*/ )
   496     {
   465     {
   497     TN_DEBUG1( "CThumbnailTaskProcessor::TaskComplete()");
   466     TN_DEBUG1( "CThumbnailTaskProcessor::TaskComplete()");
   498     OstTrace0( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_TASKCOMPLETE, "CThumbnailTaskProcessor::TaskComplete" );
       
   499  
   467  
   500     if ( iTasks.Count() && !IsActive())
   468     if ( iTasks.Count() && !IsActive())
   501         {
   469         {
   502         // More tasks yet to be run
   470         // More tasks yet to be run
   503         SetActive();
   471         SetActive();
   512               {
   480               {
   513               iPeriodicTimer->Cancel();
   481               iPeriodicTimer->Cancel();
   514               iTimerActive = EFalse;
   482               iTimerActive = EFalse;
   515               } 
   483               } 
   516             TN_DEBUG1( "CThumbnailTaskProcessor::TaskComplete() - daemon is the process");
   484             TN_DEBUG1( "CThumbnailTaskProcessor::TaskComplete() - daemon is the process");
   517             OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILTASKPROCESSOR_TASKCOMPLETE, "CThumbnailTaskProcessor::TaskComplete - daemon is the process" );
       
   518             TInt ret = iProperty.Set( ETrue );
   485             TInt ret = iProperty.Set( ETrue );
   519             TN_DEBUG2( "CThumbnailTaskProcessor::TaskComplete() iProperty Set ETrue %d", ret );
   486             TN_DEBUG2( "CThumbnailTaskProcessor::TaskComplete() iProperty Set ETrue %d", ret );
   520             OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILTASKPROCESSOR_TASKCOMPLETE, "CThumbnailTaskProcessor::TaskComplete - iProperty Set ETrue;ret=%d", ret );
       
   521             iIdle = ETrue;
   487             iIdle = ETrue;
   522             }
   488             }
   523         else
   489         else
   524             {
   490             {
   525             if(iTimerActive)
   491             if(iTimerActive)
   539 // ---------------------------------------------------------------------------
   505 // ---------------------------------------------------------------------------
   540 //
   506 //
   541 TInt CThumbnailTaskProcessor::PeriodicTimerCallBack(TAny* aAny)
   507 TInt CThumbnailTaskProcessor::PeriodicTimerCallBack(TAny* aAny)
   542     {
   508     {
   543     TN_DEBUG1( "CThumbnailTaskProcessor::PeriodicTimerCallBack()");
   509     TN_DEBUG1( "CThumbnailTaskProcessor::PeriodicTimerCallBack()");
   544     OstTrace0( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_PERIODICTIMERCALLBACK, "CThumbnailTaskProcessor::PeriodicTimerCallBack" );
       
   545     
   510     
   546     CThumbnailTaskProcessor* self = static_cast<CThumbnailTaskProcessor*>( aAny );
   511     CThumbnailTaskProcessor* self = static_cast<CThumbnailTaskProcessor*>( aAny );
   547     
   512     
   548     self->iTimerActive = EFalse;
   513     self->iTimerActive = EFalse;
   549     self->iPeriodicTimer->Cancel();
   514     self->iPeriodicTimer->Cancel();
   550     TInt ret = self->iProperty.Set( ETrue );
   515     TInt ret = self->iProperty.Set( ETrue );
   551     TN_DEBUG2( "CThumbnailTaskProcessor::PeriodicTimerCallBack() iProperty Set ETrue %d", ret );
   516     TN_DEBUG2( "CThumbnailTaskProcessor::PeriodicTimerCallBack() iProperty Set ETrue %d", ret );
   552     OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASKPROCESSOR_PERIODICTIMERCALLBACK, "CThumbnailTaskProcessor::PeriodicTimerCallBack - iProperty Set ETrue;ret=%d", ret );
       
   553     self->iIdle = ETrue;
   517     self->iIdle = ETrue;
   554 
   518 
   555     return KErrNone; // Return value ignored by CPeriodic
   519     return KErrNone; // Return value ignored by CPeriodic
   556     }
   520     }
   557 
   521 
   558 void CThumbnailTaskProcessor::SetDaemonAsProcess(TBool aValue)
   522 void CThumbnailTaskProcessor::SetDaemonAsProcess(TBool aValue)
   559     {
   523     {
   560     TN_DEBUG2( "CThumbnailTaskProcessor::SetDaemonAsProcess() Daemon set %d", aValue );
   524     TN_DEBUG2( "CThumbnailTaskProcessor::SetDaemonAsProcess() Daemon set %d", aValue );
   561     OstTrace1( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_SETDAEMONASPROCESS, "CThumbnailTaskProcessor::SetDaemonAsProcess - Daemon set;aValue=%d", aValue );
       
   562     iIsDaemonAsProcess = aValue;
   525     iIsDaemonAsProcess = aValue;
   563     }
   526     }
   564 
   527 
   565 
   528 
   566 // End of file
   529 // End of file