29 #include "thumbnaildataimpl.h" |
29 #include "thumbnaildataimpl.h" |
30 #include "thumbnailpanic.h" |
30 #include "thumbnailpanic.h" |
31 #include "thumbnaillog.h" |
31 #include "thumbnaillog.h" |
32 |
32 |
33 #include "thumbnailmanagerimpl.h" |
33 #include "thumbnailmanagerimpl.h" |
|
34 #include "OstTraceDefinitions.h" |
|
35 #ifdef OST_TRACE_COMPILER_IN_USE |
|
36 #include "thumbnailrequestactiveTraces.h" |
|
37 #endif |
|
38 |
34 |
39 |
35 // ======== MEMBER FUNCTIONS ======== |
40 // ======== MEMBER FUNCTIONS ======== |
36 |
41 |
37 // --------------------------------------------------------------------------- |
42 // --------------------------------------------------------------------------- |
38 // CThumbnailRequestActive::~CThumbnailRequestActive() |
43 // CThumbnailRequestActive::~CThumbnailRequestActive() |
130 // --------------------------------------------------------------------------- |
136 // --------------------------------------------------------------------------- |
131 // |
137 // |
132 void CThumbnailRequestActive::StartL() |
138 void CThumbnailRequestActive::StartL() |
133 { |
139 { |
134 TN_DEBUG3( "CThumbnailRequestActive::StartL(0x%08x) reqid = %d", this, iRequestId ); |
140 TN_DEBUG3( "CThumbnailRequestActive::StartL(0x%08x) reqid = %d", this, iRequestId ); |
|
141 OstTrace1( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_STARTL, "CThumbnailRequestActive::StartL;iRequestId=%u", iRequestId ); |
135 |
142 |
136 iRequestActive = ETrue; |
143 iRequestActive = ETrue; |
137 |
144 |
138 #ifdef _DEBUG |
145 #ifdef _DEBUG |
139 TTime stop; |
146 TTime stop; |
140 stop.UniversalTime(); |
147 stop.UniversalTime(); |
141 TN_DEBUG3( "CThumbnailRequestActive::StartL() req id = %d, queuing time %d ms", |
148 TN_DEBUG3( "CThumbnailRequestActive::StartL() req id = %d, queuing time %d ms", |
|
149 iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); |
|
150 OstTraceExt2( TRACE_NORMAL, DUP1_CTHUMBNAILREQUESTACTIVE_STARTL, "CThumbnailRequestActive::StartL - req id = %d, queuing time %d ms", |
142 iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); |
151 iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); |
143 #endif |
152 #endif |
144 |
153 |
145 switch (iRequestType) |
154 switch (iRequestType) |
146 { |
155 { |
155 // custom thumbnails are never stored in db |
164 // custom thumbnails are never stored in db |
156 if (iParams.iThumbnailSize == ECustomThumbnailSize && |
165 if (iParams.iThumbnailSize == ECustomThumbnailSize && |
157 iParams.iOriginalControlFlags != EThumbnailGeneratePersistentSizesOnly) |
166 iParams.iOriginalControlFlags != EThumbnailGeneratePersistentSizesOnly) |
158 { |
167 { |
159 TN_DEBUG1( "CThumbnaiRequestActive::StartL()- custom size request" ); |
168 TN_DEBUG1( "CThumbnaiRequestActive::StartL()- custom size request" ); |
|
169 OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILREQUESTACTIVE_STARTL, "CThumbnailRequestActive::StartL - custom size request" ); |
160 |
170 |
161 iFile.Close(); |
171 iFile.Close(); |
162 User::LeaveIfError( iFile.Open( iFs, iPath, EFileShareReadersOrWriters ) ); |
172 User::LeaveIfError( iFile.Open( iFs, iPath, EFileShareReadersOrWriters ) ); |
163 |
173 |
164 TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iPath ); |
174 TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iPath ); |
|
175 OstTraceExt1( TRACE_NORMAL, DUP3_CTHUMBNAILREQUESTACTIVE_STARTL, "CThumbnailRequestActive::StartL;iPath=%S", iPath ); |
165 |
176 |
166 CleanupClosePushL( iFile ); |
177 CleanupClosePushL( iFile ); |
167 |
178 |
168 if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview ) |
179 if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview ) |
169 { |
180 { |
202 // open file handle |
213 // open file handle |
203 iFile.Close(); |
214 iFile.Close(); |
204 User::LeaveIfError( iFile.Open( iFs, iTargetUri, EFileShareReadersOrWriters ) ); |
215 User::LeaveIfError( iFile.Open( iFs, iTargetUri, EFileShareReadersOrWriters ) ); |
205 |
216 |
206 TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iTargetUri ); |
217 TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iTargetUri ); |
|
218 OstTraceExt1( TRACE_NORMAL, DUP4_CTHUMBNAILREQUESTACTIVE_STARTL, "CThumbnailRequestActive::StartL - file handle opened;iTargetUri=%S", iTargetUri ); |
207 |
219 |
208 CleanupClosePushL( iFile ); |
220 CleanupClosePushL( iFile ); |
209 |
221 |
210 if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview ) |
222 if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview ) |
211 { |
223 { |
242 // open file handle |
254 // open file handle |
243 iFile.Close(); |
255 iFile.Close(); |
244 User::LeaveIfError( iFile.Open( iFs, iParams.iFileName, EFileShareReadersOrWriters ) ); |
256 User::LeaveIfError( iFile.Open( iFs, iParams.iFileName, EFileShareReadersOrWriters ) ); |
245 |
257 |
246 TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iParams.iFileName ); |
258 TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iParams.iFileName ); |
|
259 OstTraceExt1( TRACE_NORMAL, DUP5_CTHUMBNAILREQUESTACTIVE_STARTL, "CThumbnailRequestActive::StartL;iParams.iFileName=%S", iParams.iFileName ); |
247 |
260 |
248 CleanupClosePushL( iFile ); |
261 CleanupClosePushL( iFile ); |
249 |
262 |
250 if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview ) |
263 if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview ) |
251 { |
264 { |
278 // --------------------------------------------------------------------------- |
291 // --------------------------------------------------------------------------- |
279 // |
292 // |
280 void CThumbnailRequestActive::RunL() |
293 void CThumbnailRequestActive::RunL() |
281 { |
294 { |
282 TN_DEBUG2( "CThumbnailRequestActive::RunL() - request ID: %d", iParams.iRequestId ); |
295 TN_DEBUG2( "CThumbnailRequestActive::RunL() - request ID: %d", iParams.iRequestId ); |
|
296 OstTrace1( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;iParams.iRequestId=%u", iParams.iRequestId ); |
283 |
297 |
284 if ( iParams.iControlFlags == EThumbnailPreviewThumbnail ) |
298 if ( iParams.iControlFlags == EThumbnailPreviewThumbnail ) |
285 { |
299 { |
286 iRequestCompleted = EFalse; |
300 iRequestCompleted = EFalse; |
287 iProcessingPreview = ETrue; |
301 iProcessingPreview = ETrue; |
311 #ifdef _DEBUG |
325 #ifdef _DEBUG |
312 TTime stop; |
326 TTime stop; |
313 stop.UniversalTime(); |
327 stop.UniversalTime(); |
314 TN_DEBUG3( "CThumbnailRequestActive::RunL() total execution time of req %d is %d ms", |
328 TN_DEBUG3( "CThumbnailRequestActive::RunL() total execution time of req %d is %d ms", |
315 iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); |
329 iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); |
|
330 OstTraceExt2( TRACE_NORMAL, DUP1_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - total execution time of req %d is %d ms", |
|
331 iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); |
316 #endif |
332 #endif |
317 } |
333 } |
318 else if (iCanceled || iRequestType == EReqRenameThumbnails) |
334 else if (iCanceled || iRequestType == EReqRenameThumbnails) |
319 { |
335 { |
320 if (iCanceled) |
336 if (iCanceled) |
335 #ifdef _DEBUG |
351 #ifdef _DEBUG |
336 TTime stop; |
352 TTime stop; |
337 stop.UniversalTime(); |
353 stop.UniversalTime(); |
338 TN_DEBUG3( "CThumbnailRequestActive::RunL() total execution time of req %d is %d ms", |
354 TN_DEBUG3( "CThumbnailRequestActive::RunL() total execution time of req %d is %d ms", |
339 iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); |
355 iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); |
|
356 OstTraceExt2( TRACE_NORMAL, DUP2_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - total execution time of req %d is %d ms", |
|
357 iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); |
340 #endif |
358 #endif |
341 } |
359 } |
342 else if ( iStatus.Int() == KThumbnailErrThumbnailNotFound && iParams.iFileName.Length() && |
360 else if ( iStatus.Int() == KThumbnailErrThumbnailNotFound && iParams.iFileName.Length() && |
343 !( iParams.iFlags& CThumbnailManager::EDoNotCreate )) |
361 !( iParams.iFlags& CThumbnailManager::EDoNotCreate )) |
344 { |
362 { |
345 TN_DEBUG2( "CThumbnaiRequestActive::RunL() - no thumbnail found - lets try with file handle %S", &iParams.iFileName ); |
363 TN_DEBUG2( "CThumbnaiRequestActive::RunL() - no thumbnail found - lets try with file handle %S", &iParams.iFileName ); |
|
364 OstTraceExt1( TRACE_NORMAL, DUP3_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - no thumbnail found - lets try with file handle;iParams.iFileName=%S", iParams.iFileName ); |
346 iRequestCompleted = EFalse; |
365 iRequestCompleted = EFalse; |
347 |
366 |
348 // We tried to get thumbnail using file path, but it was not found in |
367 // We tried to get thumbnail using file path, but it was not found in |
349 // the database. We need to open the file now (on the client side) and |
368 // the database. We need to open the file now (on the client side) and |
350 // use file handle. |
369 // use file handle. |
351 iFile.Close(); |
370 iFile.Close(); |
352 TInt err = iFile.Open( iFs, iParams.iFileName, EFileShareReadersOrWriters ); |
371 TInt err = iFile.Open( iFs, iParams.iFileName, EFileShareReadersOrWriters ); |
353 TN_DEBUG2( "CThumbnaiRequestActive::RunL() - file handle open err = %d", err ); |
372 TN_DEBUG2( "CThumbnaiRequestActive::RunL() - file handle open err = %d", err ); |
|
373 OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - file handle open err;err=%d", err ); |
354 User::LeaveIfError( err ); |
374 User::LeaveIfError( err ); |
355 |
375 |
356 CleanupClosePushL( iFile ); |
376 CleanupClosePushL( iFile ); |
357 |
377 |
358 TN_DEBUG2( "CThumbnaiRequestActive::RunL() - file handle opened for %S", &iParams.iFileName ); |
378 TN_DEBUG2( "CThumbnaiRequestActive::RunL() - file handle opened for %S", &iParams.iFileName ); |
|
379 OstTraceExt1( TRACE_NORMAL, DUP5_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;iParams.iFileName=%S", iParams.iFileName ); |
359 |
380 |
360 iSession.RequestThumbnailL( iFile, iParams.iFileName, iParamsPckg, iStatus ); |
381 iSession.RequestThumbnailL( iFile, iParams.iFileName, iParamsPckg, iStatus ); |
361 CleanupStack::PopAndDestroy( &iFile ); |
382 CleanupStack::PopAndDestroy( &iFile ); |
362 |
383 |
363 iTimer->Start( KClientRequestTimeout, KClientRequestTimeout, |
384 iTimer->Start( KClientRequestTimeout, KClientRequestTimeout, |
373 } |
394 } |
374 //1st round thumb ready from exif (stored) |
395 //1st round thumb ready from exif (stored) |
375 else if (iParams.iOriginalControlFlags == EThumbnailGeneratePersistentSizesOnly && !iProcessingPreview) |
396 else if (iParams.iOriginalControlFlags == EThumbnailGeneratePersistentSizesOnly && !iProcessingPreview) |
376 { |
397 { |
377 TN_DEBUG1( "CThumbnaiRequestActive::RunL()- generate persistent sizes thumbnailready" ); |
398 TN_DEBUG1( "CThumbnaiRequestActive::RunL()- generate persistent sizes thumbnailready" ); |
|
399 OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - generate persistent sizes thumbnailready" ); |
378 iBitmapHandle = iParams.iBitmapHandle; |
400 iBitmapHandle = iParams.iBitmapHandle; |
379 |
401 |
380 TN_DEBUG2( "CThumbnaiRequestActive::RunL() - iObserver.ThumbnailReady %d", iParams.iRequestId ); |
402 TN_DEBUG2( "CThumbnaiRequestActive::RunL() - iObserver.ThumbnailReady %d", iParams.iRequestId ); |
|
403 OstTrace1( TRACE_NORMAL, DUP7_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;iParams.iRequestId=%u", iParams.iRequestId ); |
381 iObserver.ThumbnailReady( iStatus.Int(), *iCallbackThumbnail, iParams.iRequestId ); |
404 iObserver.ThumbnailReady( iStatus.Int(), *iCallbackThumbnail, iParams.iRequestId ); |
382 |
405 |
383 ReleaseServerBitmap(); |
406 ReleaseServerBitmap(); |
384 |
407 |
385 iFile.Close(); |
408 iFile.Close(); |
390 #ifdef _DEBUG |
413 #ifdef _DEBUG |
391 TTime stop; |
414 TTime stop; |
392 stop.UniversalTime(); |
415 stop.UniversalTime(); |
393 TN_DEBUG3( "CThumbnailRequestActive::RunL() total execution time %d, %d ms", |
416 TN_DEBUG3( "CThumbnailRequestActive::RunL() total execution time %d, %d ms", |
394 iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); |
417 iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); |
|
418 OstTraceExt2( TRACE_NORMAL, DUP8_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - total execution time %d, %d ms", |
|
419 iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); |
|
420 |
395 #endif |
421 #endif |
396 } |
422 } |
397 //1st round preview ready from too low quality exif/exif not found (not-stored) |
423 //1st round preview ready from too low quality exif/exif not found (not-stored) |
398 //relauch using normal decoding |
424 //relauch using normal decoding |
399 else if (iParams.iOriginalControlFlags == EThumbnailGeneratePersistentSizesOnly && iProcessingPreview) |
425 else if (iParams.iOriginalControlFlags == EThumbnailGeneratePersistentSizesOnly && iProcessingPreview) |
400 { |
426 { |
401 TN_DEBUG1( "CThumbnaiRequestActive::RunL()- generate persistent sizes thumbnailpreviewready" ); |
427 TN_DEBUG1( "CThumbnaiRequestActive::RunL()- generate persistent sizes thumbnailpreviewready" ); |
|
428 OstTrace0( TRACE_NORMAL, DUP9_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - generate persistent sizes thumbnailpreviewready" ); |
402 iBitmapHandle = iParams.iBitmapHandle; |
429 iBitmapHandle = iParams.iBitmapHandle; |
403 |
430 |
404 TN_DEBUG2( "CThumbnaiRequestActive::RunL() - iObserver.ThumbnailPreviewReady %d", iParams.iRequestId ); |
431 TN_DEBUG2( "CThumbnaiRequestActive::RunL() - iObserver.ThumbnailPreviewReady %d", iParams.iRequestId ); |
|
432 OstTrace1( TRACE_NORMAL, DUP10_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;iParams.iRequestId=%u", iParams.iRequestId ); |
405 iObserver.ThumbnailPreviewReady( *iCallbackThumbnail, iParams.iRequestId ); |
433 iObserver.ThumbnailPreviewReady( *iCallbackThumbnail, iParams.iRequestId ); |
406 |
434 |
407 iProcessingPreview = EFalse; |
435 iProcessingPreview = EFalse; |
408 |
436 |
409 ReleaseServerBitmap(); |
437 ReleaseServerBitmap(); |
445 CleanupStack::Pop( bitmap ); |
474 CleanupStack::Pop( bitmap ); |
446 |
475 |
447 // reduce bpp value (displaymode to match reqested bits per pixel) |
476 // reduce bpp value (displaymode to match reqested bits per pixel) |
448 #ifdef _DEBUG |
477 #ifdef _DEBUG |
449 TN_DEBUG2( "CThumbnailRequestActive::RunL() - displaymode is %d", bitmap->DisplayMode()); |
478 TN_DEBUG2( "CThumbnailRequestActive::RunL() - displaymode is %d", bitmap->DisplayMode()); |
|
479 OstTrace1( TRACE_NORMAL, DUP12_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;bitmap->DisplayMode()=%u", bitmap->DisplayMode() ); |
450 #endif |
480 #endif |
451 |
481 |
452 if( bitmap->DisplayMode() > iParams.iDisplayMode ) |
482 if( bitmap->DisplayMode() > iParams.iDisplayMode ) |
453 { |
483 { |
454 bitmap->SetDisplayMode( iParams.iDisplayMode ); |
484 bitmap->SetDisplayMode( iParams.iDisplayMode ); |
455 #ifdef _DEBUG |
485 #ifdef _DEBUG |
456 TN_DEBUG2( "CThumbnailRequestActive::RunL() - displaymode is now %d", bitmap->DisplayMode()); |
486 TN_DEBUG2( "CThumbnailRequestActive::RunL() - displaymode is now %d", bitmap->DisplayMode()); |
|
487 OstTrace1( TRACE_NORMAL, DUP13_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;bitmap->DisplayMode()=%u", bitmap->DisplayMode() ); |
457 #endif |
488 #endif |
458 } |
489 } |
459 |
490 |
460 iCallbackThumbnail->Set( bitmap, iClientData ); |
491 iCallbackThumbnail->Set( bitmap, iClientData ); |
461 bitmap = NULL; // Owned by iCallbackThumbnail or client now |
492 bitmap = NULL; // Owned by iCallbackThumbnail or client now |
462 } |
493 } |
463 |
494 |
464 if ( iProcessingPreview ) |
495 if ( iProcessingPreview ) |
465 { |
496 { |
466 TN_DEBUG2( "CThumbnailRequestActive::RunL() - iObserver.ThumbnailPreviewReady %d", iParams.iRequestId ); |
497 TN_DEBUG2( "CThumbnailRequestActive::RunL() - iObserver.ThumbnailPreviewReady %d", iParams.iRequestId ); |
|
498 OstTrace1( TRACE_NORMAL, DUP14_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - iObserver.ThumbnailPreviewReady;iParams.iRequestId=%u", iParams.iRequestId ); |
467 |
499 |
468 //increase priority of 2nd round (both, AO and request itself) |
500 //increase priority of 2nd round (both, AO and request itself) |
469 this->SetPriority(this->Priority() + 1); |
501 this->SetPriority(this->Priority() + 1); |
470 iParams.iPriority++; |
502 iParams.iPriority++; |
471 iObserver.ThumbnailPreviewReady( *iCallbackThumbnail, iParams.iRequestId ); |
503 iObserver.ThumbnailPreviewReady( *iCallbackThumbnail, iParams.iRequestId ); |
478 Get2ndPhaseThumbnailL(); |
510 Get2ndPhaseThumbnailL(); |
479 } |
511 } |
480 else |
512 else |
481 { |
513 { |
482 TN_DEBUG2( "CThumbnailRequestActive::RunL() - iObserver.ThumbnailReady %d", iParams.iRequestId ); |
514 TN_DEBUG2( "CThumbnailRequestActive::RunL() - iObserver.ThumbnailReady %d", iParams.iRequestId ); |
|
515 OstTrace1( TRACE_NORMAL, DUP15_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;iParams.iRequestId=%u", iParams.iRequestId ); |
483 |
516 |
484 iObserver.ThumbnailReady( iStatus.Int(), * iCallbackThumbnail, iParams.iRequestId ); |
517 iObserver.ThumbnailReady( iStatus.Int(), * iCallbackThumbnail, iParams.iRequestId ); |
485 ReleaseServerBitmap(); |
518 ReleaseServerBitmap(); |
486 |
519 |
487 iFile.Close(); |
520 iFile.Close(); |
490 iRequestQueue->RequestComplete(this); |
523 iRequestQueue->RequestComplete(this); |
491 |
524 |
492 #ifdef _DEBUG |
525 #ifdef _DEBUG |
493 TTime stop; |
526 TTime stop; |
494 stop.UniversalTime(); |
527 stop.UniversalTime(); |
|
528 TInt tookTime = (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000; |
495 TN_DEBUG4( "CThumbnailRequestActive::RunL(0x%08x) total execution time of req %d is %d ms", |
529 TN_DEBUG4( "CThumbnailRequestActive::RunL(0x%08x) total execution time of req %d is %d ms", |
496 this, iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); |
530 this, iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 ); |
|
531 OstTrace1( TRACE_NORMAL, DUP16_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;this=%o", this ); |
|
532 OstTraceExt2( TRACE_NORMAL, DUP17_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;iParams.iRequestId=%u;tookTime=%d", iParams.iRequestId, tookTime ); |
497 #endif |
533 #endif |
498 } |
534 } |
499 } |
535 } |
500 |
536 |
501 delete iBitmap; |
537 delete iBitmap; |
514 // --------------------------------------------------------------------------- |
550 // --------------------------------------------------------------------------- |
515 // |
551 // |
516 TInt CThumbnailRequestActive::RunError( TInt aError ) |
552 TInt CThumbnailRequestActive::RunError( TInt aError ) |
517 { |
553 { |
518 TN_DEBUG1( "CThumbnailRequestActive::RunError"); |
554 TN_DEBUG1( "CThumbnailRequestActive::RunError"); |
|
555 OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_RUNERROR, "CThumbnailRequestActive::RunError" ); |
519 |
556 |
520 iTimer->Cancel(); |
557 iTimer->Cancel(); |
521 |
558 |
522 // If RunL() left, the client did not get any callbacks yet. |
559 // If RunL() left, the client did not get any callbacks yet. |
523 // We need to notify it of the error now. |
560 // We need to notify it of the error now. |
550 // --------------------------------------------------------------------------- |
588 // --------------------------------------------------------------------------- |
551 // |
589 // |
552 void CThumbnailRequestActive::AsyncCancel() |
590 void CThumbnailRequestActive::AsyncCancel() |
553 { |
591 { |
554 TN_DEBUG1( "CThumbnailRequestActive::AsyncCancel"); |
592 TN_DEBUG1( "CThumbnailRequestActive::AsyncCancel"); |
|
593 OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_ASYNCCANCEL, "CThumbnailRequestActive::AsyncCancel" ); |
555 |
594 |
556 __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId )); |
595 __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId )); |
557 |
596 |
558 iCanceled = ETrue; |
597 iCanceled = ETrue; |
559 iSession.CancelRequest( iRequestId ); |
598 iSession.CancelRequest( iRequestId ); |
586 // --------------------------------------------------------------------------- |
626 // --------------------------------------------------------------------------- |
587 // |
627 // |
588 void CThumbnailRequestActive::HandleError() |
628 void CThumbnailRequestActive::HandleError() |
589 { |
629 { |
590 TN_DEBUG1( "CThumbnailRequestActive::HandleError"); |
630 TN_DEBUG1( "CThumbnailRequestActive::HandleError"); |
|
631 OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_HANDLEERROR, "CThumbnailRequestActive::HandleError" ); |
591 |
632 |
592 if ( iError ) |
633 if ( iError ) |
593 { |
634 { |
594 if( iError == KErrServerTerminated) |
635 if( iError == KErrServerTerminated) |
595 { |
636 { |
596 iSession.Close(); |
637 iSession.Close(); |
597 TInt connErr = iSession.Connect(); |
638 TInt connErr = iSession.Connect(); |
598 if (connErr != KErrNone) |
639 if (connErr != KErrNone) |
599 { |
640 { |
600 TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - session reconnect err %d", connErr ); |
641 TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - session reconnect err %d", connErr ); |
|
642 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILREQUESTACTIVE_HANDLEERROR, "CThumbnailRequestActive::HandleError;err=%d", connErr ); |
601 } |
643 } |
602 else |
644 else |
603 { |
645 { |
604 TN_DEBUG1( "CThumbnailRequestActive::HandleError() - session reconnected"); |
646 TN_DEBUG1( "CThumbnailRequestActive::HandleError() - session reconnected"); |
|
647 OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILREQUESTACTIVE_HANDLEERROR, "CThumbnailRequestActive::HandleError - session reconnected" ); |
605 } |
648 } |
606 } |
649 } |
607 |
650 |
608 if (iRequestObserver && iRequestType == EReqDeleteThumbnails) |
651 if (iRequestObserver && iRequestType == EReqDeleteThumbnails) |
609 { |
652 { |
610 TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iRequestObserver->ThumbnailRequestReady %d", iParams.iRequestId ); |
653 TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iRequestObserver->ThumbnailRequestReady %d", iParams.iRequestId ); |
|
654 OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILREQUESTACTIVE_HANDLEERROR, "CThumbnailRequestActive::HandleError;iParams.iRequestId=%u", iParams.iRequestId ); |
611 iRequestObserver->ThumbnailRequestReady(iError, ERequestDeleteThumbnails ,iParams.iRequestId); |
655 iRequestObserver->ThumbnailRequestReady(iError, ERequestDeleteThumbnails ,iParams.iRequestId); |
612 } |
656 } |
613 else |
657 else |
614 { |
658 { |
615 iCallbackThumbnail->Set( NULL, iClientData ); |
659 iCallbackThumbnail->Set( NULL, iClientData ); |
626 |
670 |
627 if(iRetry < KMaxRequestRetryCount ) |
671 if(iRetry < KMaxRequestRetryCount ) |
628 { |
672 { |
629 iRetry++; |
673 iRetry++; |
630 TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - KErrServerTerminated, retry %d", iRetry); |
674 TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - KErrServerTerminated, retry %d", iRetry); |
|
675 OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILREQUESTACTIVE_HANDLEERROR, "CThumbnailRequestActive::HandleError - KErrServerTerminated;iRetry=%d", iRetry ); |
631 iError = KErrNone; |
676 iError = KErrNone; |
632 TRAPD(err, StartL()); |
677 TRAPD(err, StartL()); |
633 return; |
678 return; |
634 } |
679 } |
635 } |
680 } |
636 #endif |
681 #endif |
637 TN_DEBUG3( "CThumbnaiRequestActive::HandleError() - iObserver.ThumbnailReady req=%d err=%d", iParams.iRequestId, iError ); |
682 TN_DEBUG3( "CThumbnaiRequestActive::HandleError() - iObserver.ThumbnailReady req=%d err=%d", iParams.iRequestId, iError ); |
|
683 OstTrace1( TRACE_NORMAL, DUP5_CTHUMBNAILREQUESTACTIVE_HANDLEERROR, "CThumbnailRequestActive::HandleError - iObserver.ThumbnailReady %u", iParams.iRequestId ); |
638 iObserver.ThumbnailReady( iError, *iCallbackThumbnail, iParams.iRequestId ); |
684 iObserver.ThumbnailReady( iError, *iCallbackThumbnail, iParams.iRequestId ); |
639 |
685 |
640 } |
686 } |
641 |
687 |
642 iError = KErrNone; |
688 iError = KErrNone; |
657 // CThumbnailRequestActive::GetThumbnailL() |
703 // CThumbnailRequestActive::GetThumbnailL() |
658 // Get a thumbnail for an object file. |
704 // Get a thumbnail for an object file. |
659 // --------------------------------------------------------------------------- |
705 // --------------------------------------------------------------------------- |
660 // |
706 // |
661 void CThumbnailRequestActive::GetThumbnailL( const RFile64& aFile, TThumbnailId aThumbnailId, |
707 void CThumbnailRequestActive::GetThumbnailL( const RFile64& aFile, TThumbnailId aThumbnailId, |
662 CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager |
708 const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager |
663 ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const |
709 ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const |
664 TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly, |
710 TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly, |
665 const TDesC& aTargetUri, TThumbnailSize aThumbnailSize) |
711 const TDesC& aTargetUri, TThumbnailSize aThumbnailSize) |
666 { |
712 { |
667 iRequestType = EReqGetThumbnailHandle; |
713 iRequestType = EReqGetThumbnailHandle; |
678 iClientData = aClientData; |
724 iClientData = aClientData; |
679 iParams.iControlFlags = (aGeneratePersistentSizesOnly ? |
725 iParams.iControlFlags = (aGeneratePersistentSizesOnly ? |
680 EThumbnailGeneratePersistentSizesOnly : |
726 EThumbnailGeneratePersistentSizesOnly : |
681 EThumbnailNoControlFlags); |
727 EThumbnailNoControlFlags); |
682 iParams.iOriginalControlFlags = iParams.iControlFlags; |
728 iParams.iOriginalControlFlags = iParams.iControlFlags; |
|
729 iParams.iMimeType = TDataType( aMimeType ); |
683 iParams.iBitmapHandle = 0; |
730 iParams.iBitmapHandle = 0; |
684 iParams.iSize = aSize; |
731 iParams.iSize = aSize; |
685 iParams.iDisplayMode = aDisplayMode; |
732 iParams.iDisplayMode = aDisplayMode; |
686 User::LeaveIfError( aFile.FullName( iParams.iFileName )); |
733 User::LeaveIfError( aFile.FullName( iParams.iFileName )); |
687 iParams.iRequestId = iRequestId; |
734 iParams.iRequestId = iRequestId; |
712 // CThumbnailRequestActive::GetThumbnailL() |
759 // CThumbnailRequestActive::GetThumbnailL() |
713 // Get a thumbnail opening an object file later. |
760 // Get a thumbnail opening an object file later. |
714 // --------------------------------------------------------------------------- |
761 // --------------------------------------------------------------------------- |
715 // |
762 // |
716 void CThumbnailRequestActive::GetThumbnailL( TThumbnailId aThumbnailId, |
763 void CThumbnailRequestActive::GetThumbnailL( TThumbnailId aThumbnailId, |
717 const TDesC& aPath, CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager |
764 const TDesC& aPath, const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags, |
718 ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const |
765 CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const |
719 TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly, |
766 TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly, |
720 const TDesC& aTargetUri, TThumbnailSize aThumbnailSize) |
767 const TDesC& aTargetUri, TThumbnailSize aThumbnailSize) |
721 { |
768 { |
722 iRequestType = EReqGetThumbnailHandleLater; |
769 iRequestType = EReqGetThumbnailHandleLater; |
723 |
770 |
724 iClientData = aClientData; |
771 iClientData = aClientData; |
725 iParams.iControlFlags = (aGeneratePersistentSizesOnly ? |
772 iParams.iControlFlags = (aGeneratePersistentSizesOnly ? |
726 EThumbnailGeneratePersistentSizesOnly : |
773 EThumbnailGeneratePersistentSizesOnly : |
727 EThumbnailNoControlFlags); |
774 EThumbnailNoControlFlags); |
728 iParams.iOriginalControlFlags = iParams.iControlFlags; |
775 iParams.iOriginalControlFlags = iParams.iControlFlags; |
|
776 iParams.iMimeType = TDataType( aMimeType ); |
729 iParams.iBitmapHandle = 0; |
777 iParams.iBitmapHandle = 0; |
730 iParams.iSize = aSize; |
778 iParams.iSize = aSize; |
731 iParams.iDisplayMode = aDisplayMode; |
779 iParams.iDisplayMode = aDisplayMode; |
732 iParams.iFileName = aPath; |
780 iParams.iFileName = aPath; |
733 iParams.iRequestId = iRequestId; |
781 iParams.iRequestId = iRequestId; |
756 // CThumbnailRequestActive::GetThumbnailL() |
804 // CThumbnailRequestActive::GetThumbnailL() |
757 // Get a thumbnail for an object file. |
805 // Get a thumbnail for an object file. |
758 // --------------------------------------------------------------------------- |
806 // --------------------------------------------------------------------------- |
759 // |
807 // |
760 void CThumbnailRequestActive::GetThumbnailL( const TDesC& aPath, TThumbnailId aThumbnailId, |
808 void CThumbnailRequestActive::GetThumbnailL( const TDesC& aPath, TThumbnailId aThumbnailId, |
761 CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager |
809 const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager |
762 ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const |
810 ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const |
763 TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly, |
811 TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly, |
764 const TDesC& aTargetUri, TThumbnailSize aThumbnailSize) |
812 const TDesC& aTargetUri, TThumbnailSize aThumbnailSize) |
765 { |
813 { |
766 iRequestType = EReqGetThumbnailPath; |
814 iRequestType = EReqGetThumbnailPath; |
768 iClientData = aClientData; |
816 iClientData = aClientData; |
769 iParams.iControlFlags = (aGeneratePersistentSizesOnly ? |
817 iParams.iControlFlags = (aGeneratePersistentSizesOnly ? |
770 EThumbnailGeneratePersistentSizesOnly : |
818 EThumbnailGeneratePersistentSizesOnly : |
771 EThumbnailNoControlFlags); |
819 EThumbnailNoControlFlags); |
772 iParams.iOriginalControlFlags = iParams.iControlFlags; |
820 iParams.iOriginalControlFlags = iParams.iControlFlags; |
|
821 iParams.iMimeType = TDataType( aMimeType ); |
773 iParams.iBitmapHandle = 0; |
822 iParams.iBitmapHandle = 0; |
774 iParams.iSize = aSize; |
823 iParams.iSize = aSize; |
775 iParams.iDisplayMode = aDisplayMode; |
824 iParams.iDisplayMode = aDisplayMode; |
776 iParams.iRequestId = iRequestId; |
825 iParams.iRequestId = iRequestId; |
777 iParams.iPriority = aPriority; |
826 iParams.iPriority = aPriority; |
896 } |
945 } |
897 else if (!iParams.iVirtualUri) |
946 else if (!iParams.iVirtualUri) |
898 { |
947 { |
899 // memory low, create thumbs using filehandle |
948 // memory low, create thumbs using filehandle |
900 TN_DEBUG1( "CThumbnaiRequestActive::SetThumbnailbyBitmap() - memory low, create thumbs using filehandle!" ); |
949 TN_DEBUG1( "CThumbnaiRequestActive::SetThumbnailbyBitmap() - memory low, create thumbs using filehandle!" ); |
|
950 OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_SETTHUMBNAILL, "CThumbnailRequestActive::SetThumbnailL - memory low, create thumbs using filehandle!" ); |
901 delete aBitmap; |
951 delete aBitmap; |
902 aBitmap = NULL; |
952 aBitmap = NULL; |
903 iParams.iPriority = aPriority - 1; |
953 iParams.iPriority = aPriority - 1; |
904 iRequestType = EReqGetThumbnailHandleLater; |
954 iRequestType = EReqGetThumbnailHandleLater; |
905 } |
955 } |
1023 // --------------------------------------------------------------------------- |
1073 // --------------------------------------------------------------------------- |
1024 // |
1074 // |
1025 void CThumbnailRequestActive::Get2ndPhaseThumbnailL() |
1075 void CThumbnailRequestActive::Get2ndPhaseThumbnailL() |
1026 { |
1076 { |
1027 TN_DEBUG2( "CThumbnailRequestActive::Get2ndPhaseThumbnailL() %d", iParams.iRequestId ); |
1077 TN_DEBUG2( "CThumbnailRequestActive::Get2ndPhaseThumbnailL() %d", iParams.iRequestId ); |
|
1078 OstTrace1( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_GET2NDPHASETHUMBNAILL, "CThumbnailRequestActive::Get2ndPhaseThumbnailL;iParams.iRequestId=%u", iParams.iRequestId ); |
1028 |
1079 |
1029 iParams.iQualityPreference = CThumbnailManager::EOptimizeForQuality; |
1080 iParams.iQualityPreference = CThumbnailManager::EOptimizeForQuality; |
1030 iParams.iControlFlags = EThumbnailNoControlFlags; |
1081 iParams.iControlFlags = EThumbnailNoControlFlags; |
1031 |
1082 |
1032 if ( iMyFileHandle.SubSessionHandle()) |
1083 if ( iMyFileHandle.SubSessionHandle()) |
1086 // --------------------------------------------------------------------------- |
1139 // --------------------------------------------------------------------------- |
1087 // |
1140 // |
1088 TInt CThumbnailRequestActive::TimerCallBack(TAny* aAny) |
1141 TInt CThumbnailRequestActive::TimerCallBack(TAny* aAny) |
1089 { |
1142 { |
1090 TN_DEBUG1( "CThumbnailRequestActive::TimerCallBack() - request timeout"); |
1143 TN_DEBUG1( "CThumbnailRequestActive::TimerCallBack() - request timeout"); |
|
1144 OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_TIMERCALLBACK, "CThumbnailRequestActive::TimerCallBack" ); |
1091 |
1145 |
1092 CThumbnailRequestActive* self = static_cast<CThumbnailRequestActive*>( aAny ); |
1146 CThumbnailRequestActive* self = static_cast<CThumbnailRequestActive*>( aAny ); |
1093 |
1147 |
1094 self->iTimer->Cancel(); |
1148 self->iTimer->Cancel(); |
1095 |
1149 |