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