27 #include "thumbnailtaskprocessor.h" |
27 #include "thumbnailtaskprocessor.h" |
28 #include "thumbnailmanagerconstants.h" |
28 #include "thumbnailmanagerconstants.h" |
29 #include "thumbnaillog.h" |
29 #include "thumbnaillog.h" |
30 #include "thumbnailpanic.h" |
30 #include "thumbnailpanic.h" |
31 #include "thumbnailfetchedchecker.h" |
31 #include "thumbnailfetchedchecker.h" |
|
32 #include "OstTraceDefinitions.h" |
|
33 #ifdef OST_TRACE_COMPILER_IN_USE |
|
34 #include "thumbnailgeneratetaskTraces.h" |
|
35 #endif |
|
36 |
32 |
37 |
33 // ======== MEMBER FUNCTIONS ======== |
38 // ======== MEMBER FUNCTIONS ======== |
34 |
39 |
35 // --------------------------------------------------------------------------- |
40 // --------------------------------------------------------------------------- |
36 // CThumbnailGenerateTask::CThumbnailGenerateTask() |
41 // CThumbnailGenerateTask::CThumbnailGenerateTask() |
50 iMissingSizes( aMissingSizes ), iTargetUri( aTargetUri ), |
55 iMissingSizes( aMissingSizes ), iTargetUri( aTargetUri ), |
51 iThumbnailSize( aThumbnailSize ), iModified(aModified), |
56 iThumbnailSize( aThumbnailSize ), iModified(aModified), |
52 iQualityPreference( aQualityPreference ), iVirtualUri( aVirtualUri ) |
57 iQualityPreference( aQualityPreference ), iVirtualUri( aVirtualUri ) |
53 { |
58 { |
54 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CThumbnailGenerateTask()", this); |
59 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CThumbnailGenerateTask()", this); |
|
60 OstTrace1( TRACE_NORMAL, CTHUMBNAILGENERATETASK_CTHUMBNAILGENERATETASK, "CThumbnailGenerateTask::CThumbnailGenerateTask;this=%o", this ); |
55 |
61 |
56 if ( !aBuffer && aFile) |
62 if ( !aBuffer && aFile) |
57 { |
63 { |
58 iFile = *aFile; |
64 iFile = *aFile; |
59 iFile.FullName( iFilename ); |
65 iFile.FullName( iFilename ); |
108 delete iBuffer; |
115 delete iBuffer; |
109 iBuffer = NULL; |
116 iBuffer = NULL; |
110 |
117 |
111 iFile.Close(); |
118 iFile.Close(); |
112 TN_DEBUG1("CThumbnailGenerateTask::~CThumbnailGenerateTask() - file handle closed"); |
119 TN_DEBUG1("CThumbnailGenerateTask::~CThumbnailGenerateTask() - file handle closed"); |
|
120 OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILGENERATETASK_CTHUMBNAILGENERATETASK, "CThumbnailGenerateTask::~CThumbnailGenerateTask - file handle closed" ); |
113 } |
121 } |
114 |
122 |
115 |
123 |
116 // --------------------------------------------------------------------------- |
124 // --------------------------------------------------------------------------- |
117 // CThumbnailGenerateTask::StartL() |
125 // CThumbnailGenerateTask::StartL() |
118 // --------------------------------------------------------------------------- |
126 // --------------------------------------------------------------------------- |
119 // |
127 // |
120 void CThumbnailGenerateTask::StartL() |
128 void CThumbnailGenerateTask::StartL() |
121 { |
129 { |
122 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::StartL()", this ); |
130 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::StartL()", this ); |
|
131 OstTrace1( TRACE_NORMAL, CTHUMBNAILGENERATETASK_STARTL, "CThumbnailGenerateTask::StartL;this=%o", this ); |
123 |
132 |
124 CThumbnailTask::StartL(); |
133 CThumbnailTask::StartL(); |
125 |
134 |
126 #ifdef _DEBUG |
135 #ifdef _DEBUG |
127 aStart.UniversalTime(); |
136 aStart.UniversalTime(); |
139 mimeType = iMimeType.Des8(); |
148 mimeType = iMimeType.Des8(); |
140 } |
149 } |
141 iProvider = iServer.ResolveProviderL(mimeType); |
150 iProvider = iServer.ResolveProviderL(mimeType); |
142 |
151 |
143 TN_DEBUG3( "CThumbnailGenerateTask(0x%08x) -- provider UID 0x%08x", this, iProvider->Uid()); |
152 TN_DEBUG3( "CThumbnailGenerateTask(0x%08x) -- provider UID 0x%08x", this, iProvider->Uid()); |
|
153 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILGENERATETASK_STARTL, "CThumbnailGenerateTask::StartL;this=%o", this ); |
144 |
154 |
145 __ASSERT_DEBUG(( iProvider ), ThumbnailPanic( EThumbnailNullPointer )); |
155 __ASSERT_DEBUG(( iProvider ), ThumbnailPanic( EThumbnailNullPointer )); |
146 |
156 |
147 iProvider->CancelGetThumbnail(); |
157 iProvider->CancelGetThumbnail(); |
148 iProvider->Reset(); |
158 iProvider->Reset(); |
176 DoBlacklisting( providerErr, TSize(0,0) ); |
186 DoBlacklisting( providerErr, TSize(0,0) ); |
177 |
187 |
178 User::LeaveIfError( providerErr ); |
188 User::LeaveIfError( providerErr ); |
179 |
189 |
180 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::StartL() end", this ); |
190 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::StartL() end", this ); |
|
191 OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILGENERATETASK_STARTL, "CThumbnailGenerateTask::StartL -end;this=%o", this ); |
181 } |
192 } |
182 |
193 |
183 |
194 |
184 // --------------------------------------------------------------------------- |
195 // --------------------------------------------------------------------------- |
185 // CThumbnailGenerateTask::RunL() |
196 // CThumbnailGenerateTask::RunL() |
272 void CThumbnailGenerateTask::ThumbnailProviderReady( const TInt aError, |
284 void CThumbnailGenerateTask::ThumbnailProviderReady( const TInt aError, |
273 CFbsBitmap* aBitmap, const TSize& aOriginalSize, const TBool aEXIF, const TBool aPortrait ) |
285 CFbsBitmap* aBitmap, const TSize& aOriginalSize, const TBool aEXIF, const TBool aPortrait ) |
274 { |
286 { |
275 TN_DEBUG4( |
287 TN_DEBUG4( |
276 "CThumbnailGenerateTask(0x%08x)::ThumbnailProviderReady(aError=%d, aBitmap=0x%08x)", this, aError, aBitmap ); |
288 "CThumbnailGenerateTask(0x%08x)::ThumbnailProviderReady(aError=%d, aBitmap=0x%08x)", this, aError, aBitmap ); |
|
289 OstTrace1( TRACE_NORMAL, CTHUMBNAILGENERATETASK_THUMBNAILPROVIDERREADY, "CThumbnailGenerateTask::ThumbnailProviderReady;this=%o", this ); |
|
290 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILGENERATETASK_THUMBNAILPROVIDERREADY, "CThumbnailGenerateTask::ThumbnailProviderReady;aError=%d", aError ); |
|
291 OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILGENERATETASK_THUMBNAILPROVIDERREADY, "CThumbnailGenerateTask::ThumbnailProviderReady;aBitmap=%o", aBitmap ); |
277 |
292 |
278 #ifdef _DEBUG |
293 #ifdef _DEBUG |
279 aStop.UniversalTime(); |
294 aStop.UniversalTime(); |
280 TN_DEBUG2( "CThumbnailGenerateTask::ThumbnailProviderReady() generate took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000); |
295 TN_DEBUG2( "CThumbnailGenerateTask::ThumbnailProviderReady() generate took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000); |
281 #endif |
296 #endif |
297 { |
312 { |
298 // CreateScaleTasksL will take ownership of bitmap |
313 // CreateScaleTasksL will take ownership of bitmap |
299 |
314 |
300 #ifdef _DEBUG |
315 #ifdef _DEBUG |
301 TN_DEBUG2( "CThumbnailGenerateTask::ThumbnailProviderReady() - displaymode is %d", aBitmap->DisplayMode()); |
316 TN_DEBUG2( "CThumbnailGenerateTask::ThumbnailProviderReady() - displaymode is %d", aBitmap->DisplayMode()); |
|
317 OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILGENERATETASK_THUMBNAILPROVIDERREADY, "CThumbnailGenerateTask::ThumbnailProviderReady;aBitmap->DisplayMode()=%u", aBitmap->DisplayMode() ); |
302 #endif |
318 #endif |
303 |
319 |
304 TRAPD( err, CreateScaleTasksL( aBitmap )); |
320 TRAPD( err, CreateScaleTasksL( aBitmap )); |
305 aBitmap = NULL; |
321 aBitmap = NULL; |
306 // If CreateScaleTasksL left, we are responsible for completing |
322 // If CreateScaleTasksL left, we are responsible for completing |
356 for ( TInt i( 0 ); i < count; i++ ) |
372 for ( TInt i( 0 ); i < count; i++ ) |
357 { |
373 { |
358 TThumbnailSize size = (*iMissingSizes)[ i ].iType; |
374 TThumbnailSize size = (*iMissingSizes)[ i ].iType; |
359 #ifdef _DEBUG |
375 #ifdef _DEBUG |
360 TN_DEBUG3( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() *iMissingSizes)[ i ].iType == %d", this, size ); |
376 TN_DEBUG3( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() *iMissingSizes)[ i ].iType == %d", this, size ); |
|
377 OstTrace1( TRACE_NORMAL, CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL;this=%o", this ); |
|
378 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL;size=%d", size ); |
361 #endif |
379 #endif |
362 |
380 |
363 if ( iPortrait ) |
381 if ( iPortrait ) |
364 { |
382 { |
365 if ( size == EFullScreenThumbnailSize || |
383 if ( size == EFullScreenThumbnailSize || |
366 size == EVideoFullScreenThumbnailSize || |
384 size == EVideoFullScreenThumbnailSize || |
367 size == EAudioFullScreenThumbnailSize || |
385 size == EAudioFullScreenThumbnailSize || |
368 size == EImageFullScreenThumbnailSize ) |
386 size == EImageFullScreenThumbnailSize ) |
369 { |
387 { |
|
388 TInt mis_width = (*iMissingSizes)[ i ].iSize.iWidth; |
370 TN_DEBUG2( "*iMissingSizes)[ i ].iWidth == %d", (*iMissingSizes)[ i ].iSize.iWidth ); |
389 TN_DEBUG2( "*iMissingSizes)[ i ].iWidth == %d", (*iMissingSizes)[ i ].iSize.iWidth ); |
|
390 OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL;width=%d", mis_width ); |
|
391 |
|
392 TInt mis_height = (*iMissingSizes)[ i ].iSize.iHeight; |
371 TN_DEBUG2( "*iMissingSizes)[ i ].iHeight == %d", (*iMissingSizes)[ i ].iSize.iHeight ); |
393 TN_DEBUG2( "*iMissingSizes)[ i ].iHeight == %d", (*iMissingSizes)[ i ].iSize.iHeight ); |
|
394 OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL;mis_height=%d", mis_height ); |
372 TInt width = (*iMissingSizes)[ i ].iSize.iWidth; |
395 TInt width = (*iMissingSizes)[ i ].iSize.iWidth; |
373 (*iMissingSizes)[ i ].iSize.iWidth = (*iMissingSizes)[ i ].iSize.iHeight; |
396 (*iMissingSizes)[ i ].iSize.iWidth = (*iMissingSizes)[ i ].iSize.iHeight; |
374 (*iMissingSizes)[ i ].iSize.iHeight = width; |
397 (*iMissingSizes)[ i ].iSize.iHeight = width; |
375 TN_DEBUG2( "*iMissingSizes)[ i ].iWidth == %d", (*iMissingSizes)[ i ].iSize.iWidth ); |
398 TN_DEBUG2( "*iMissingSizes)[ i ].iWidth == %d", (*iMissingSizes)[ i ].iSize.iWidth ); |
|
399 OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL;width=%d", width ); |
|
400 mis_height = (*iMissingSizes)[ i ].iSize.iHeight; |
376 TN_DEBUG2( "*iMissingSizes)[ i ].iHeight == %d", (*iMissingSizes)[ i ].iSize.iHeight ); |
401 TN_DEBUG2( "*iMissingSizes)[ i ].iHeight == %d", (*iMissingSizes)[ i ].iSize.iHeight ); |
|
402 OstTrace1( TRACE_NORMAL, DUP5_CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL;mis_height=%d", mis_height ); |
377 } |
403 } |
378 } |
404 } |
379 |
405 |
380 CThumbnailScaleTask* complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename, |
406 CThumbnailScaleTask* complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename, |
381 aBitmap, iOriginalSize, (*iMissingSizes)[ i ].iSize, (*iMissingSizes)[ i ].iCrop, iDisplayMode, |
407 aBitmap, iOriginalSize, (*iMissingSizes)[ i ].iSize, (*iMissingSizes)[ i ].iCrop, iDisplayMode, |
391 (*iMissingSizes)[ i ].iType == ECustomThumbnailSize || |
417 (*iMissingSizes)[ i ].iType == ECustomThumbnailSize || |
392 (*iMissingSizes)[ i ].iType == EUnknownThumbnailSize ) |
418 (*iMissingSizes)[ i ].iType == EUnknownThumbnailSize ) |
393 { |
419 { |
394 complTask->SetDoStore( EFalse ); |
420 complTask->SetDoStore( EFalse ); |
395 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() - do not store", this ); |
421 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() - do not store", this ); |
|
422 OstTrace1( TRACE_NORMAL, DUP6_CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL - do not store;this=%o", this ); |
396 } |
423 } |
397 else |
424 else |
398 { |
425 { |
399 complTask->SetDoStore( ETrue ); |
426 complTask->SetDoStore( ETrue ); |
400 } |
427 } |
440 iThumbnailSize == ECustomThumbnailSize || |
467 iThumbnailSize == ECustomThumbnailSize || |
441 iThumbnailSize == EUnknownThumbnailSize ) |
468 iThumbnailSize == EUnknownThumbnailSize ) |
442 { |
469 { |
443 complTask->SetDoStore( EFalse ); |
470 complTask->SetDoStore( EFalse ); |
444 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() - do not store", this ); |
471 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() - do not store", this ); |
|
472 OstTrace1( TRACE_NORMAL, DUP7_CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL - do not store;this=%o", this ); |
445 } |
473 } |
446 else |
474 else |
447 { |
475 { |
448 complTask->SetDoStore( ETrue ); |
476 complTask->SetDoStore( ETrue ); |
449 } |
477 } |
477 // --------------------------------------------------------------------------- |
505 // --------------------------------------------------------------------------- |
478 // |
506 // |
479 void CThumbnailGenerateTask::CreateBlackListedL( const TSize& aOriginalSize ) |
507 void CThumbnailGenerateTask::CreateBlackListedL( const TSize& aOriginalSize ) |
480 { |
508 { |
481 TN_DEBUG1( "CThumbnailGenerateTask::CreateBlackListedL()"); |
509 TN_DEBUG1( "CThumbnailGenerateTask::CreateBlackListedL()"); |
|
510 OstTrace0( TRACE_NORMAL, CTHUMBNAILGENERATETASK_CREATEBLACKLISTEDL, "CThumbnailGenerateTask::CreateBlackListedL" ); |
482 CFbsBitmap* tempBitmap = 0; |
511 CFbsBitmap* tempBitmap = 0; |
483 tempBitmap = new (ELeave) CFbsBitmap(); |
512 tempBitmap = new (ELeave) CFbsBitmap(); |
484 CleanupStack::PushL( tempBitmap ); |
513 CleanupStack::PushL( tempBitmap ); |
485 TSize tempSize( 1, 1 ); |
514 TSize tempSize( 1, 1 ); |
486 User::LeaveIfError( tempBitmap->Create( tempSize, iDisplayMode ) ); |
515 User::LeaveIfError( tempBitmap->Create( tempSize, iDisplayMode ) ); |
513 // --------------------------------------------------------------------------- |
542 // --------------------------------------------------------------------------- |
514 // |
543 // |
515 void CThumbnailGenerateTask::DoBlacklisting( const TInt aError, const TSize& aOriginalSize ) |
544 void CThumbnailGenerateTask::DoBlacklisting( const TInt aError, const TSize& aOriginalSize ) |
516 { |
545 { |
517 TN_DEBUG1( "CThumbnailGenerateTask::DoBlacklisting()"); |
546 TN_DEBUG1( "CThumbnailGenerateTask::DoBlacklisting()"); |
|
547 OstTrace0( TRACE_NORMAL, CTHUMBNAILGENERATETASK_DOBLACKLISTING, "CThumbnailGenerateTask::DoBlacklisting" ); |
518 // Create a temporary bitmap of size 1 for storing blacklisted thumbnail |
548 // Create a temporary bitmap of size 1 for storing blacklisted thumbnail |
519 // Because no actual bitmap data is generated, there is no reason to |
549 // Because no actual bitmap data is generated, there is no reason to |
520 // add bitmap to server bitmap pool. Completion of client request with |
550 // add bitmap to server bitmap pool. Completion of client request with |
521 // error code just results in applications showing their default bitmap. |
551 // error code just results in applications showing their default bitmap. |
522 if( aError != KErrNone && (iFilename != KNullDesC || iTargetUri != KNullDesC )) |
552 if( aError != KErrNone && (iFilename != KNullDesC || iTargetUri != KNullDesC )) |
531 { |
561 { |
532 |
562 |
533 if(iMissingSizes) |
563 if(iMissingSizes) |
534 { |
564 { |
535 TN_DEBUG2( "CThumbnailGenerateTask::DoBlacklisting() - blacklist missing sizes count = %d", iMissingSizes->Count() ); |
565 TN_DEBUG2( "CThumbnailGenerateTask::DoBlacklisting() - blacklist missing sizes count = %d", iMissingSizes->Count() ); |
|
566 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILGENERATETASK_DOBLACKLISTING, "CThumbnailGenerateTask::DoBlacklisting - blacklist missing sizes count;iMissingSizes->Count()=%d", iMissingSizes->Count() ); |
536 |
567 |
537 for ( TInt i( 0 ); i < iMissingSizes->Count(); i++ ) |
568 for ( TInt i( 0 ); i < iMissingSizes->Count(); i++ ) |
538 { |
569 { |
539 iThumbnailSize = (*iMissingSizes)[ i ].iType; |
570 iThumbnailSize = (*iMissingSizes)[ i ].iType; |
540 TRAPD( err, CreateBlackListedL( aOriginalSize ) ); |
571 TRAPD( err, CreateBlackListedL( aOriginalSize ) ); |
541 if (err != KErrNone) |
572 if (err != KErrNone) |
542 { |
573 { |
543 TN_DEBUG3( "CThumbnailGenerateTask::DoBlacklisting() - blacklisting missing size %d failed with code %d", iThumbnailSize, err ); |
574 TN_DEBUG3( "CThumbnailGenerateTask::DoBlacklisting() - blacklisting missing size %d failed with code %d", iThumbnailSize, err ); |
|
575 OstTraceExt2( TRACE_NORMAL, DUP2_CTHUMBNAILGENERATETASK_DOBLACKLISTING, "CThumbnailGenerateTask::DoBlacklisting - - blacklisting missing size failed with error;iThumbnailSize=%u;err=%d", iThumbnailSize, err ); |
544 } |
576 } |
545 } |
577 } |
546 return; |
578 return; |
547 } |
579 } |
548 else |
580 else |
549 { |
581 { |
550 TN_DEBUG1( "CThumbnailGenerateTask::DoBlacklisting() - blacklist single size" ); |
582 TN_DEBUG1( "CThumbnailGenerateTask::DoBlacklisting() - blacklist single size" ); |
|
583 OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILGENERATETASK_DOBLACKLISTING, "CThumbnailGenerateTask::DoBlacklisting - blacklist single size" ); |
551 TRAPD( err, CreateBlackListedL( aOriginalSize ) ); |
584 TRAPD( err, CreateBlackListedL( aOriginalSize ) ); |
552 if (err != KErrNone) |
585 if (err != KErrNone) |
553 { |
586 { |
554 TN_DEBUG2( "CThumbnailGenerateTask::DoBlacklisting() - blacklisting failed with code %d", err ); |
587 TN_DEBUG2( "CThumbnailGenerateTask::DoBlacklisting() - blacklisting failed with code %d", err ); |
|
588 OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILGENERATETASK_DOBLACKLISTING, "CThumbnailGenerateTask::DoBlacklisting - blacklisting failed with code;err=%d", err ); |
555 } |
589 } |
556 return; |
590 return; |
557 } |
591 } |
558 } |
592 } |
559 TN_DEBUG1( "CThumbnailGenerateTask::DoBlacklisting() - not blacklisted " ); |
593 TN_DEBUG1( "CThumbnailGenerateTask::DoBlacklisting() - not blacklisted " ); |
|
594 OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILGENERATETASK_DOBLACKLISTING, "CThumbnailGenerateTask::DoBlacklisting - not blacklisted" ); |
560 } |
595 } |
561 } |
596 } |
562 |
597 |
563 |
598 |