35 #include "thumbnailpanic.h" |
35 #include "thumbnailpanic.h" |
36 #include "thumbnailcenrep.h" |
36 #include "thumbnailcenrep.h" |
37 #include "thumbnailmemorycardobserver.h" |
37 #include "thumbnailmemorycardobserver.h" |
38 #include "tmgetimei.h" |
38 #include "tmgetimei.h" |
39 #include "thumbnailfetchedchecker.h" |
39 #include "thumbnailfetchedchecker.h" |
40 #include "OstTraceDefinitions.h" |
|
41 #ifdef OST_TRACE_COMPILER_IN_USE |
|
42 #include "thumbnailserverTraces.h" |
|
43 #endif |
|
44 |
|
45 |
40 |
46 |
41 |
47 _LIT8( KThumbnailMimeWildCard, "*" ); |
42 _LIT8( KThumbnailMimeWildCard, "*" ); |
48 _LIT8( KThumbnailMimeImage, "image" ); |
43 _LIT8( KThumbnailMimeImage, "image" ); |
49 _LIT8( KThumbnailMimeVideo, "video" ); |
44 _LIT8( KThumbnailMimeVideo, "video" ); |
352 void CThumbnailServer::HandleSessionOpened( CMdESession& /* aSession */, TInt aError ) |
345 void CThumbnailServer::HandleSessionOpened( CMdESession& /* aSession */, TInt aError ) |
353 #else |
346 #else |
354 void CThumbnailServer::HandleSessionOpened( CMdESession& /* aSession */, TInt /*aError*/ ) |
347 void CThumbnailServer::HandleSessionOpened( CMdESession& /* aSession */, TInt /*aError*/ ) |
355 #endif |
348 #endif |
356 { |
349 { |
357 #ifdef _DEBUG |
|
358 TN_DEBUG2( "CThumbnailServer::HandleSessionOpened error == %d", aError ); |
350 TN_DEBUG2( "CThumbnailServer::HandleSessionOpened error == %d", aError ); |
359 OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_HANDLESESSIONOPENED, "CThumbnailServer::HandleSessionOpened;aError=%d", aError ); |
|
360 #endif |
|
361 } |
351 } |
362 |
352 |
363 // ----------------------------------------------------------------------------- |
353 // ----------------------------------------------------------------------------- |
364 // CThumbnailServer::HandleSessionError |
354 // CThumbnailServer::HandleSessionError |
365 // ----------------------------------------------------------------------------- |
355 // ----------------------------------------------------------------------------- |
366 // |
356 // |
367 void CThumbnailServer::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) |
357 void CThumbnailServer::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) |
368 { |
358 { |
369 TN_DEBUG2( "CThumbnailServer::HandleSessionError == %d", aError ); |
359 TN_DEBUG2( "CThumbnailServer::HandleSessionError == %d", aError ); |
370 OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_HANDLESESSIONERROR, "CThumbnailServer::HandleSessionError;aError=%d", aError ); |
|
371 if (aError != KErrNone && !iShutdown && !iSessionError) |
360 if (aError != KErrNone && !iShutdown && !iSessionError) |
372 { |
361 { |
373 iSessionError = ETrue; |
362 iSessionError = ETrue; |
374 |
363 |
375 if (!iReconnect->IsActive()) |
364 if (!iReconnect->IsActive()) |
376 { |
365 { |
377 iReconnect->Start( KMdEReconnect, KMdEReconnect, |
366 iReconnect->Start( KMdEReconnect, KMdEReconnect, |
378 TCallBack(ReconnectCallBack, this)); |
367 TCallBack(ReconnectCallBack, this)); |
379 |
368 |
380 TN_DEBUG1( "CThumbnailServer::HandleSessionError() - reconnect timer started" ); |
369 TN_DEBUG1( "CThumbnailServer::HandleSessionError() - reconnect timer started" ); |
381 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_HANDLESESSIONERROR, "CThumbnailServer::HandleSessionError - reconnect timer started" ); |
|
382 } |
370 } |
383 } |
371 } |
384 } |
372 } |
385 |
373 |
386 // ----------------------------------------------------------------------------- |
374 // ----------------------------------------------------------------------------- |
421 server = CThumbnailServer::NewL(); // Adds server in scheduler |
409 server = CThumbnailServer::NewL(); // Adds server in scheduler |
422 // No need to CleanupStack::PushL(server) since no leaves can happen |
410 // No need to CleanupStack::PushL(server) since no leaves can happen |
423 RProcess::Rendezvous( KErrNone ); |
411 RProcess::Rendezvous( KErrNone ); |
424 TN_DEBUG1( |
412 TN_DEBUG1( |
425 "CThumbnailServer::ThreadFunctionL() -- CActiveScheduler::Start() in" ); |
413 "CThumbnailServer::ThreadFunctionL() -- CActiveScheduler::Start() in" ); |
426 OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_THREADFUNCTIONL, "CThumbnailServer::ThreadFunctionL -- CActiveScheduler::Start() in" ); |
|
427 CActiveScheduler::Start(); |
414 CActiveScheduler::Start(); |
428 TN_DEBUG1( |
415 TN_DEBUG1( |
429 "CThumbnailServer::ThreadFunctionL() -- CActiveScheduler::Start() out" ); |
416 "CThumbnailServer::ThreadFunctionL() -- CActiveScheduler::Start() out" ); |
430 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_THREADFUNCTIONL, "CThumbnailServer::ThreadFunctionL - out" ); |
|
431 // Comes here if server gets shut down |
417 // Comes here if server gets shut down |
432 delete server; |
418 delete server; |
433 server = NULL; |
419 server = NULL; |
434 CleanupStack::PopAndDestroy( scheduler ); |
420 CleanupStack::PopAndDestroy( scheduler ); |
435 } |
421 } |
455 // |
440 // |
456 void CThumbnailServer::DropSession(CThumbnailServerSession* aSession) |
441 void CThumbnailServer::DropSession(CThumbnailServerSession* aSession) |
457 { |
442 { |
458 TN_DEBUG2( "CThumbnailServer::DropSession() iSessionCount was %d", |
443 TN_DEBUG2( "CThumbnailServer::DropSession() iSessionCount was %d", |
459 iSessionCount ); |
444 iSessionCount ); |
460 OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_DROPSESSION, "CThumbnailServer::DropSession;iSessionCount=%d", iSessionCount ); |
|
461 iSessionCount--; |
445 iSessionCount--; |
462 |
446 |
463 if(iProcessor) |
447 if(iProcessor) |
464 { |
448 { |
465 iProcessor->RemoveTasks(aSession); |
449 iProcessor->RemoveTasks(aSession); |
466 } |
450 } |
467 |
451 |
468 TN_DEBUG2( "CThumbnailServer::DropSession() aSession = 0x%08x", aSession ); |
452 TN_DEBUG2( "CThumbnailServer::DropSession() aSession = 0x%08x", aSession ); |
469 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_DROPSESSION, "CThumbnailServer::DropSession;aSession=%o", aSession ); |
|
470 |
453 |
471 // clean-up bitmap pool |
454 // clean-up bitmap pool |
472 THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool ); |
455 THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool ); |
473 |
456 |
474 // const pointer to a non-const object |
457 // const pointer to a non-const object |
477 while ( ref ) |
460 while ( ref ) |
478 { |
461 { |
479 if ( ref->iSession == aSession ) |
462 if ( ref->iSession == aSession ) |
480 { |
463 { |
481 TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession ); |
464 TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession ); |
482 OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_DROPSESSION, "CThumbnailServer::DropSession;ref->iSession=%o", ref->iSession ); |
|
483 |
465 |
484 delete ref->iBitmap; |
466 delete ref->iBitmap; |
485 bpiter.RemoveCurrent(); |
467 bpiter.RemoveCurrent(); |
486 |
468 |
487 TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", iBitmapPool.Count()); |
469 TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", iBitmapPool.Count()); |
488 OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_DROPSESSION, "CThumbnailServer::DropSession;iBitmapPool.Count()=%d", iBitmapPool.Count() ); |
|
489 } |
470 } |
490 |
471 |
491 ref = bpiter.NextValue(); |
472 ref = bpiter.NextValue(); |
492 } |
473 } |
493 |
474 |
510 // ----------------------------------------------------------------------------- |
491 // ----------------------------------------------------------------------------- |
511 // |
492 // |
512 void CThumbnailServer::ShutdownNotification() |
493 void CThumbnailServer::ShutdownNotification() |
513 { |
494 { |
514 TN_DEBUG1( "CThumbnailServer::ShutdownNotification()"); |
495 TN_DEBUG1( "CThumbnailServer::ShutdownNotification()"); |
515 OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_SHUTDOWNNOTIFICATION, "CThumbnailServer::ShutdownNotification" ); |
|
516 if (!iShutdown) |
496 if (!iShutdown) |
517 { |
497 { |
518 TN_DEBUG1( "CThumbnailServer::ShutdownNotification() shutdown"); |
498 TN_DEBUG1( "CThumbnailServer::ShutdownNotification() shutdown"); |
519 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_SHUTDOWNNOTIFICATION, "CThumbnailServer::ShutdownNotification - shutdown" ); |
|
520 CActiveScheduler::Stop(); |
499 CActiveScheduler::Stop(); |
521 iShutdown = ETrue; |
500 iShutdown = ETrue; |
522 } |
501 } |
523 } |
502 } |
524 |
503 |
532 CFbsBitmap* aBitmap, TThumbnailServerRequestId aRequestId ) |
511 CFbsBitmap* aBitmap, TThumbnailServerRequestId aRequestId ) |
533 { |
512 { |
534 if( !aBitmap ) |
513 if( !aBitmap ) |
535 { |
514 { |
536 TN_DEBUG1( "CThumbnailServer::AddBitmapToPoolL() - KErrArgument"); |
515 TN_DEBUG1( "CThumbnailServer::AddBitmapToPoolL() - KErrArgument"); |
537 OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_ADDBITMAPTOPOOLL, "CThumbnailServer::AddBitmapToPoolL - KErrArgument" ); |
|
538 User::Leave( KErrArgument ); |
516 User::Leave( KErrArgument ); |
539 } |
517 } |
540 TN_DEBUG4( |
518 TN_DEBUG4( |
541 "CThumbnailServer::AddBitmapToPoolL(aSession=0x%08x, aBitmap=0x%08x), handle=%d", aSession, aBitmap, aBitmap->Handle()); |
519 "CThumbnailServer::AddBitmapToPoolL(aSession=0x%08x, aBitmap=0x%08x), handle=%d", aSession, aBitmap, aBitmap->Handle()); |
542 |
520 |
543 TThumbnailBitmapRef* ptr = iBitmapPool.Find( aBitmap->Handle()); |
521 TThumbnailBitmapRef* ptr = iBitmapPool.Find( aBitmap->Handle()); |
544 |
522 |
545 TN_DEBUG2( "CThumbnailServer::AddBitmapToPoolL() - req id = %d", aRequestId.iRequestId ); |
523 TN_DEBUG2( "CThumbnailServer::AddBitmapToPoolL() - req id = %d", aRequestId.iRequestId ); |
546 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_ADDBITMAPTOPOOLL, "CThumbnailServer::AddBitmapToPoolL;aRequestId.iRequestId=%u", aRequestId.iRequestId ); |
|
547 |
524 |
548 if ( ptr ) |
525 if ( ptr ) |
549 { |
526 { |
550 ptr->iRefCount++; |
527 ptr->iRefCount++; |
551 } |
528 } |
560 iBitmapPool.InsertL( aBitmap->Handle(), ref ); |
537 iBitmapPool.InsertL( aBitmap->Handle(), ref ); |
561 } |
538 } |
562 |
539 |
563 #ifdef _DEBUG |
540 #ifdef _DEBUG |
564 TN_DEBUG2( "CThumbnailServer::BITMAP-POOL-COUNTER----------, Bitmaps = %d", iBitmapPool.Count() ); |
541 TN_DEBUG2( "CThumbnailServer::BITMAP-POOL-COUNTER----------, Bitmaps = %d", iBitmapPool.Count() ); |
565 OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_ADDBITMAPTOPOOLL, "CThumbnailServer::AddBitmapToPoolL;iBitmapPool.Count()=%d", iBitmapPool.Count() ); |
|
566 #endif |
542 #endif |
567 } |
543 } |
568 |
544 |
569 |
545 |
570 // ----------------------------------------------------------------------------- |
546 // ----------------------------------------------------------------------------- |
575 const TSize& aOriginalSize, const TBool aCropped, const TThumbnailSize aThumbnailSize, |
551 const TSize& aOriginalSize, const TBool aCropped, const TThumbnailSize aThumbnailSize, |
576 const TInt64 aModified, const TBool aThumbFromPath, const TBool aCheckExist ) |
552 const TInt64 aModified, const TBool aThumbFromPath, const TBool aCheckExist ) |
577 { |
553 { |
578 TN_DEBUG6( |
554 TN_DEBUG6( |
579 "CThumbnailServer::StoreBitmapL(aPath=%S, aBitmap=0x%08x, aOriginalSize=%dx%d, aCropped=%d)", &aPath, aBitmap, aOriginalSize.iWidth, aOriginalSize.iHeight, aCropped ); |
555 "CThumbnailServer::StoreBitmapL(aPath=%S, aBitmap=0x%08x, aOriginalSize=%dx%d, aCropped=%d)", &aPath, aBitmap, aOriginalSize.iWidth, aOriginalSize.iHeight, aCropped ); |
580 OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL;aBitmap=%o", aBitmap ); |
|
581 OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL;aPath=%S", aPath ); |
|
582 OstTraceExt3( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL;aOriginalSize.iWidth=%d;aOriginalSize.iHeight=%d;aCropped=%u", aOriginalSize.iWidth, aOriginalSize.iHeight, aCropped ); |
|
583 |
|
584 #ifdef _DEBUG |
556 #ifdef _DEBUG |
585 TN_DEBUG2( "CThumbnailServer::StoreThumbnailL() - iScaledBitmap displaymode is %d", aBitmap->DisplayMode()); |
557 TN_DEBUG2( "CThumbnailServer::StoreThumbnailL() - iScaledBitmap displaymode is %d", aBitmap->DisplayMode()); |
586 OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL;aBitmap->DisplayMode()=%u", aBitmap->DisplayMode() ); |
|
587 #endif |
558 #endif |
588 |
559 |
589 if (!aCheckExist) |
560 if (!aCheckExist) |
590 { |
561 { |
591 StoreForPathL( aPath )->StoreThumbnailL( aPath, aBitmap, aOriginalSize, |
562 StoreForPathL( aPath )->StoreThumbnailL( aPath, aBitmap, aOriginalSize, |
597 aCropped, aThumbnailSize, aModified, aThumbFromPath, EFalse ); |
568 aCropped, aThumbnailSize, aModified, aThumbFromPath, EFalse ); |
598 } |
569 } |
599 else |
570 else |
600 { |
571 { |
601 TN_DEBUG1( "CThumbnailServer::StoreThumbnailL() - file doesn't exists anymore, skip store!"); |
572 TN_DEBUG1( "CThumbnailServer::StoreThumbnailL() - file doesn't exists anymore, skip store!"); |
602 OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL - file doesn't exists anymore, skip store!" ); |
|
603 } |
573 } |
604 |
574 |
605 if( iFetchedChecker ) |
575 if( iFetchedChecker ) |
606 { |
576 { |
607 iFetchedChecker->SetFetchResult( aPath, aThumbnailSize, KErrNone ); |
577 iFetchedChecker->SetFetchResult( aPath, aThumbnailSize, KErrNone ); |
615 // |
585 // |
616 void CThumbnailServer::FetchThumbnailL( const TDesC& aPath, CFbsBitmap* & |
586 void CThumbnailServer::FetchThumbnailL( const TDesC& aPath, CFbsBitmap* & |
617 aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aOriginalSize ) |
587 aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aOriginalSize ) |
618 { |
588 { |
619 TN_DEBUG3( "CThumbnailServer::FetchThumbnailL(aPath=%S aThumbnailSize=%d)", &aPath, aThumbnailSize ); |
589 TN_DEBUG3( "CThumbnailServer::FetchThumbnailL(aPath=%S aThumbnailSize=%d)", &aPath, aThumbnailSize ); |
620 OstTraceExt2( TRACE_NORMAL, CTHUMBNAILSERVER_FETCHTHUMBNAILL, "CThumbnailServer::FetchThumbnailL;aPath=%S;aThumbnailSize=%hu", aPath, aThumbnailSize ); |
|
621 if( iFetchedChecker ) |
590 if( iFetchedChecker ) |
622 { |
591 { |
623 TInt err( iFetchedChecker->LastFetchResult( aPath, aThumbnailSize ) ); |
592 TInt err( iFetchedChecker->LastFetchResult( aPath, aThumbnailSize ) ); |
624 if ( err == KErrNone ) // To avoid useless sql gets that fails for sure |
593 if ( err == KErrNone ) // To avoid useless sql gets that fails for sure |
625 { |
594 { |
657 // ----------------------------------------------------------------------------- |
626 // ----------------------------------------------------------------------------- |
658 // |
627 // |
659 void CThumbnailServer::DeleteBitmapFromPool( TInt aHandle ) |
628 void CThumbnailServer::DeleteBitmapFromPool( TInt aHandle ) |
660 { |
629 { |
661 TN_DEBUG2( "CThumbnailServer::DeleteBitmapFromPool(%d)", aHandle ); |
630 TN_DEBUG2( "CThumbnailServer::DeleteBitmapFromPool(%d)", aHandle ); |
662 OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool;aHandle=%d", aHandle ); |
|
663 |
631 |
664 TThumbnailBitmapRef* ptr = iBitmapPool.Find( aHandle ); |
632 TThumbnailBitmapRef* ptr = iBitmapPool.Find( aHandle ); |
665 if ( ptr ) |
633 if ( ptr ) |
666 { |
634 { |
667 ptr->iRefCount--; |
635 ptr->iRefCount--; |
668 if ( !ptr->iRefCount ) |
636 if ( !ptr->iRefCount ) |
669 { |
637 { |
670 TN_DEBUG3( |
638 TN_DEBUG3( |
671 "CThumbnailServer::DeleteBitmapFromPool(%d) -- deleting 0x%08x)", aHandle, ptr ); |
639 "CThumbnailServer::DeleteBitmapFromPool(%d) -- deleting 0x%08x)", aHandle, ptr ); |
672 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool -- deleting;ptr=%o", ptr ); |
|
673 delete ptr->iBitmap; |
640 delete ptr->iBitmap; |
674 ptr->iBitmap = NULL; |
641 ptr->iBitmap = NULL; |
675 iBitmapPool.Remove( aHandle ); |
642 iBitmapPool.Remove( aHandle ); |
676 TN_DEBUG2( "CThumbnailServer::DeleteBitmapFromPool -- items left %d", iBitmapPool.Count() ); |
643 TN_DEBUG2( "CThumbnailServer::DeleteBitmapFromPool -- items left %d", iBitmapPool.Count() ); |
677 OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool -- items left;iBitmapPool.Count()=%d", iBitmapPool.Count() ); |
|
678 } |
644 } |
679 else |
645 else |
680 { |
646 { |
681 TN_DEBUG3( |
647 TN_DEBUG3( |
682 "CThumbnailServer::DeleteBitmapFromPool(%d) -- refcount now %d", |
648 "CThumbnailServer::DeleteBitmapFromPool(%d) -- refcount now %d", |
683 aHandle, ptr->iRefCount ); |
649 aHandle, ptr->iRefCount ); |
684 OstTraceExt2( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool) -- refcount now;aHandle=%d;ptr->iRefCount=%d", aHandle, ptr->iRefCount ); |
|
685 } |
650 } |
686 } |
651 } |
687 else |
652 else |
688 { |
653 { |
689 //__ASSERT_DEBUG(( EFalse ), ThumbnailPanic( EThumbnailBitmapNotReleased )); |
654 //__ASSERT_DEBUG(( EFalse ), ThumbnailPanic( EThumbnailBitmapNotReleased )); |
690 TN_DEBUG2( "CThumbnailServer::DeleteBitmapFromPool(%d) -- not found!", |
655 TN_DEBUG2( "CThumbnailServer::DeleteBitmapFromPool(%d) -- not found!", |
691 aHandle ); |
656 aHandle ); |
692 OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool -- not found!;aHandle=%d", aHandle ); |
|
693 } |
657 } |
694 } |
658 } |
695 |
659 |
696 |
660 |
697 // ----------------------------------------------------------------------------- |
661 // ----------------------------------------------------------------------------- |
699 // ----------------------------------------------------------------------------- |
663 // ----------------------------------------------------------------------------- |
700 // |
664 // |
701 void CThumbnailServer::DeleteThumbnailsL( const TDesC& aPath ) |
665 void CThumbnailServer::DeleteThumbnailsL( const TDesC& aPath ) |
702 { |
666 { |
703 TN_DEBUG2( "CThumbnailServer::DeleteThumbnailsL(%S)", &aPath); |
667 TN_DEBUG2( "CThumbnailServer::DeleteThumbnailsL(%S)", &aPath); |
704 OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSERVER_DELETETHUMBNAILSL, "CThumbnailServer::DeleteThumbnailsL;aPath=%S", aPath ); |
|
705 |
668 |
706 StoreForPathL( aPath )->DeleteThumbnailsL( aPath ); |
669 StoreForPathL( aPath )->DeleteThumbnailsL( aPath ); |
707 |
670 |
708 if( iFetchedChecker ) |
671 if( iFetchedChecker ) |
709 { |
672 { |
735 |
698 |
736 if ( drm && filetype != ContentAccess::EOma1Dcf ) |
699 if ( drm && filetype != ContentAccess::EOma1Dcf ) |
737 { |
700 { |
738 // cannot handle other than Oma DRM 1.x files |
701 // cannot handle other than Oma DRM 1.x files |
739 TN_DEBUG1( "CThumbnailStore::ResolveMimeTypeL()- only OMA DRM 1.0 supported"); |
702 TN_DEBUG1( "CThumbnailStore::ResolveMimeTypeL()- only OMA DRM 1.0 supported"); |
740 OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_RESOLVEMIMETYPEL, "CThumbnailServer::ResolveMimeTypeL - only OMA DRM 1.0 supported" ); |
|
741 User::Leave(KErrNotSupported); |
703 User::Leave(KErrNotSupported); |
742 } |
704 } |
743 |
705 |
744 TDataRecognitionResult res; |
706 TDataRecognitionResult res; |
745 if ( iRecognizer.Handle() == KNullHandle ) |
707 if ( iRecognizer.Handle() == KNullHandle ) |
770 { |
732 { |
771 #ifdef _DEBUG |
733 #ifdef _DEBUG |
772 TBuf < KMaxDataTypeLength > buf; // 16-bit descriptor for debug prints |
734 TBuf < KMaxDataTypeLength > buf; // 16-bit descriptor for debug prints |
773 buf.Copy( aMimeType ); |
735 buf.Copy( aMimeType ); |
774 TN_DEBUG2( "CThumbnailServer::ResolveProviderL(%S)", &buf ); |
736 TN_DEBUG2( "CThumbnailServer::ResolveProviderL(%S)", &buf ); |
775 OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_RESOLVEMIMETYPEL, "CThumbnailServer::ResolveMimeTypeL;buf=%S", buf ); |
|
776 #endif |
737 #endif |
777 |
738 |
778 CThumbnailProvider* ret = NULL; |
739 CThumbnailProvider* ret = NULL; |
779 |
740 |
780 TInt separatorPos = aMimeType.Locate( KThumbnailMimeSeparatorChar ); |
741 TInt separatorPos = aMimeType.Locate( KThumbnailMimeSeparatorChar ); |
795 !pSubType.CompareF( subType )) |
756 !pSubType.CompareF( subType )) |
796 { |
757 { |
797 #ifdef _DEBUG |
758 #ifdef _DEBUG |
798 TN_DEBUG3( |
759 TN_DEBUG3( |
799 "CThumbnailServer::ResolveProviderL(%S) -- using provider 0x%08x", &buf, iPluginInfoArray[i]->ImplementationUid().iUid ); |
760 "CThumbnailServer::ResolveProviderL(%S) -- using provider 0x%08x", &buf, iPluginInfoArray[i]->ImplementationUid().iUid ); |
800 OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_RESOLVEPROVIDERL, "CThumbnailServer::ResolveProviderL;buf=%S", buf ); |
|
801 OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_RESOLVEPROVIDERL, "CThumbnailServer::ResolveProviderL;iPluginInfoArray[i]->ImplementationUid().iUid=%o", iPluginInfoArray[i]->ImplementationUid().iUid ); |
|
802 #endif |
761 #endif |
803 ret = GetProviderL( iPluginInfoArray[i]->ImplementationUid()); |
762 ret = GetProviderL( iPluginInfoArray[i]->ImplementationUid()); |
804 } |
763 } |
805 } |
764 } |
806 } |
765 } |
837 TN_DEBUG2( |
795 TN_DEBUG2( |
838 "CThumbnailServer::GetProviderL() -- loading plug-in, UID 0x%08x", |
796 "CThumbnailServer::GetProviderL() -- loading plug-in, UID 0x%08x", |
839 aImplUid ); |
797 aImplUid ); |
840 res = CThumbnailProvider::NewL( aImplUid ); |
798 res = CThumbnailProvider::NewL( aImplUid ); |
841 TN_DEBUG1( "CThumbnailServer::GetProviderL() -- loading complete" ); |
799 TN_DEBUG1( "CThumbnailServer::GetProviderL() -- loading complete" ); |
842 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_GETPROVIDERL, "CThumbnailServer::GetProviderL -- loading complete" ); |
|
843 CleanupStack::PushL( res ); |
800 CleanupStack::PushL( res ); |
844 iProviders.InsertL( aImplUid.iUid, res ); |
801 iProviders.InsertL( aImplUid.iUid, res ); |
845 CleanupStack::Pop( res ); |
802 CleanupStack::Pop( res ); |
846 } |
803 } |
847 |
804 |
854 // ----------------------------------------------------------------------------- |
811 // ----------------------------------------------------------------------------- |
855 // |
812 // |
856 void CThumbnailServer::PreLoadProviders( ) |
813 void CThumbnailServer::PreLoadProviders( ) |
857 { |
814 { |
858 TN_DEBUG1( "CThumbnailServer::PreLoadProvidersL()" ); |
815 TN_DEBUG1( "CThumbnailServer::PreLoadProvidersL()" ); |
859 OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_PRELOADPROVIDERS, "CThumbnailServer::PreLoadProviders" ); |
|
860 TInt err(KErrNone); |
816 TInt err(KErrNone); |
861 |
817 |
862 for(TInt i=0; i< iPluginInfoArray.Count(); i++) |
818 for(TInt i=0; i< iPluginInfoArray.Count(); i++) |
863 { |
819 { |
864 TRAP(err, GetProviderL( iPluginInfoArray[i]->ImplementationUid())); |
820 TRAP(err, GetProviderL( iPluginInfoArray[i]->ImplementationUid())); |
894 const TThumbnailBitmapRef* ref = bpiter.NextValue(); |
850 const TThumbnailBitmapRef* ref = bpiter.NextValue(); |
895 |
851 |
896 while ( ref ) |
852 while ( ref ) |
897 { |
853 { |
898 TN_DEBUG2( "CThumbnailServer::DequeTask() - ref->iRequestId = %d", ref->iRequestId ); |
854 TN_DEBUG2( "CThumbnailServer::DequeTask() - ref->iRequestId = %d", ref->iRequestId ); |
899 OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_DEQUETASK, "CThumbnailServer::DequeTask;ref->iRequestId=%u", ref->iRequestId ); |
|
900 |
855 |
901 if ( ref->iSession == aRequestId.iSession && |
856 if ( ref->iSession == aRequestId.iSession && |
902 ref->iRequestId == aRequestId.iRequestId ) |
857 ref->iRequestId == aRequestId.iRequestId ) |
903 { |
858 { |
904 delete ref->iBitmap; |
859 delete ref->iBitmap; |
905 bpiter.RemoveCurrent(); |
860 bpiter.RemoveCurrent(); |
906 |
861 |
907 TN_DEBUG2( "CThumbnailServer::DequeTask() - deleted bitmap, left=%d", |
862 TN_DEBUG2( "CThumbnailServer::DequeTask() - deleted bitmap, left=%d", |
908 iBitmapPool.Count()); |
863 iBitmapPool.Count()); |
909 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_DEQUETASK, "CThumbnailServer::DequeTask;iBitmapPool.Count()=%d", iBitmapPool.Count() ); |
|
910 } |
864 } |
911 |
865 |
912 ref = bpiter.NextValue(); |
866 ref = bpiter.NextValue(); |
913 } |
867 } |
914 |
868 |
976 // ----------------------------------------------------------------------------- |
930 // ----------------------------------------------------------------------------- |
977 // |
931 // |
978 CThumbnailStore* CThumbnailServer::StoreForDriveL( const TInt aDrive ) |
932 CThumbnailStore* CThumbnailServer::StoreForDriveL( const TInt aDrive ) |
979 { |
933 { |
980 TN_DEBUG2( "CThumbnailServer::StoreForDriveL() drive=%d", aDrive ); |
934 TN_DEBUG2( "CThumbnailServer::StoreForDriveL() drive=%d", aDrive ); |
981 OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL;aDrive=%d", aDrive ); |
|
982 |
935 |
983 if(iUnmountedDrives.Find( aDrive ) >= KErrNone) |
936 if(iUnmountedDrives.Find( aDrive ) >= KErrNone) |
984 { |
937 { |
985 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() unmount in progress, skip!"); |
938 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() unmount in progress, skip!"); |
986 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - unmount in progress, skip!" ); |
|
987 User::Leave( KErrDisMounted ); |
939 User::Leave( KErrDisMounted ); |
988 } |
940 } |
989 |
941 |
990 CThumbnailStore** resPtr = iStores.Find( aDrive ); |
942 CThumbnailStore** resPtr = iStores.Find( aDrive ); |
991 CThumbnailStore* res = NULL; |
943 CThumbnailStore* res = NULL; |
997 else |
949 else |
998 { |
950 { |
999 if( iFormatting ) |
951 if( iFormatting ) |
1000 { |
952 { |
1001 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - FORMATTING! - ABORT"); |
953 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - FORMATTING! - ABORT"); |
1002 OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - FORMATTING! - ABORT" ); |
|
1003 User::Leave( KErrNotSupported ); |
954 User::Leave( KErrNotSupported ); |
1004 } |
955 } |
1005 |
956 |
1006 TVolumeInfo volumeInfo; |
957 TVolumeInfo volumeInfo; |
1007 TInt err = iFs.Volume( volumeInfo, aDrive ); |
958 TInt err = iFs.Volume( volumeInfo, aDrive ); |
1008 |
959 |
1009 if ( err ) |
960 if ( err ) |
1010 { |
961 { |
1011 // Locked |
962 // Locked |
1012 TN_DEBUG2( "CThumbnailServer::StoreForDriveL() - err %d", err); |
963 TN_DEBUG2( "CThumbnailServer::StoreForDriveL() - err %d", err); |
1013 OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL;err=%d", err ); |
|
1014 User::Leave( err); |
964 User::Leave( err); |
1015 } |
965 } |
1016 else if( volumeInfo.iDrive.iMediaAtt& KMediaAttLocked ) |
966 else if( volumeInfo.iDrive.iMediaAtt& KMediaAttLocked ) |
1017 { |
967 { |
1018 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - locked"); |
968 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - locked"); |
1019 OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - locked" ); |
|
1020 User::Leave( KErrAccessDenied ); |
969 User::Leave( KErrAccessDenied ); |
1021 } |
970 } |
1022 else if ( volumeInfo.iDrive.iDriveAtt& KDriveAttRom || |
971 else if ( volumeInfo.iDrive.iDriveAtt& KDriveAttRom || |
1023 volumeInfo.iDrive.iDriveAtt& KDriveAttRemote || |
972 volumeInfo.iDrive.iDriveAtt& KDriveAttRemote || |
1024 volumeInfo.iDrive.iMediaAtt& KMediaAttWriteProtected ) |
973 volumeInfo.iDrive.iMediaAtt& KMediaAttWriteProtected ) |
1025 { |
974 { |
1026 // We support ROM disks and remote disks in read only mode. |
975 // We support ROM disks and remote disks in read only mode. |
1027 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - rom/remote/write protected"); |
976 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - rom/remote/write protected"); |
1028 OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - rom/remote/write protected" ); |
|
1029 res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, ETrue ); |
977 res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, ETrue ); |
1030 } |
978 } |
1031 else |
979 else |
1032 { |
980 { |
1033 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - normal"); |
981 TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - normal"); |
1034 OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - normal" ); |
|
1035 res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, EFalse ); |
982 res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, EFalse ); |
1036 } |
983 } |
1037 |
984 |
1038 CleanupStack::PushL( res ); |
985 CleanupStack::PushL( res ); |
1039 iStores.InsertL( aDrive, res ); |
986 iStores.InsertL( aDrive, res ); |
1057 CThumbnailStore* CThumbnailServer::StoreForPathL( const TDesC& aPath ) |
1004 CThumbnailStore* CThumbnailServer::StoreForPathL( const TDesC& aPath ) |
1058 { |
1005 { |
1059 if(aPath.Length() < 3 || aPath.Length() > KMaxPath) |
1006 if(aPath.Length() < 3 || aPath.Length() > KMaxPath) |
1060 { |
1007 { |
1061 TN_DEBUG1( "CThumbnailServer::StoreForPathL() - KErrArgument"); |
1008 TN_DEBUG1( "CThumbnailServer::StoreForPathL() - KErrArgument"); |
1062 OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_STOREFORPATHL, "CThumbnailServer::StoreForPathL - KErrArgument" ); |
|
1063 User::Leave(KErrArgument); |
1009 User::Leave(KErrArgument); |
1064 } |
1010 } |
1065 TInt drive = 0; |
1011 TInt drive = 0; |
1066 User::LeaveIfError( RFs::CharToDrive( aPath[0], drive )); |
1012 User::LeaveIfError( RFs::CharToDrive( aPath[0], drive )); |
1067 return StoreForDriveL( drive ); |
1013 return StoreForDriveL( drive ); |
1121 // ----------------------------------------------------------------------------- |
1066 // ----------------------------------------------------------------------------- |
1122 // |
1067 // |
1123 void CThumbnailServer::CloseStoreForDriveL( const TInt aDrive ) |
1068 void CThumbnailServer::CloseStoreForDriveL( const TInt aDrive ) |
1124 { |
1069 { |
1125 TN_DEBUG2( "CThumbnailServer::CloseStoreForDriveL drive=%d", aDrive); |
1070 TN_DEBUG2( "CThumbnailServer::CloseStoreForDriveL drive=%d", aDrive); |
1126 OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_CLOSESTOREFORDRIVEL, "CThumbnailServer::CloseStoreForDriveL;aDrive=%d", aDrive ); |
|
1127 CThumbnailStore** store = iStores.Find( aDrive ); |
1071 CThumbnailStore** store = iStores.Find( aDrive ); |
1128 |
1072 |
1129 StartUnmountTimeout( aDrive); |
1073 StartUnmountTimeout( aDrive); |
1130 |
1074 |
1131 if (store) |
1075 if (store) |
1188 |
1132 |
1189 // if removable drive, add observer |
1133 // if removable drive, add observer |
1190 if (!err && driveInfo.iDriveAtt& KDriveAttRemovable) |
1134 if (!err && driveInfo.iDriveAtt& KDriveAttRemovable) |
1191 { |
1135 { |
1192 TN_DEBUG2( "CThumbnailServer::AddOnMountObserver drive=%d", drive); |
1136 TN_DEBUG2( "CThumbnailServer::AddOnMountObserver drive=%d", drive); |
1193 OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_ADDUNMOUNTOBSERVERSL, "CThumbnailServer::AddUnmountObserversL;drive=%d", drive ); |
|
1194 CThumbnailDiskUnmountObserver* obs = CThumbnailDiskUnmountObserver::NewL( iFs, drive, this ); |
1137 CThumbnailDiskUnmountObserver* obs = CThumbnailDiskUnmountObserver::NewL( iFs, drive, this ); |
1195 CleanupStack::PushL( obs ); |
1138 CleanupStack::PushL( obs ); |
1196 iUnmountObservers.AppendL( obs ); |
1139 iUnmountObservers.AppendL( obs ); |
1197 CleanupStack::Pop( obs ); |
1140 CleanupStack::Pop( obs ); |
1198 } |
1141 } |
1204 // --------------------------------------------------------------------------- |
1147 // --------------------------------------------------------------------------- |
1205 // |
1148 // |
1206 void CThumbnailServer::MemoryCardStatusChangedL() |
1149 void CThumbnailServer::MemoryCardStatusChangedL() |
1207 { |
1150 { |
1208 TN_DEBUG1( "CThumbnailServer::MemoryCardStatusChangedL in()" ); |
1151 TN_DEBUG1( "CThumbnailServer::MemoryCardStatusChangedL in()" ); |
1209 OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL - in" ); |
|
1210 TDriveList driveList; |
1152 TDriveList driveList; |
1211 TInt drive; |
1153 TInt drive; |
1212 TVolumeInfo volumeInfo; |
1154 TVolumeInfo volumeInfo; |
1213 TDriveInfo driveInfo; |
1155 TDriveInfo driveInfo; |
1214 |
1156 |
1230 if (!err && !err_drive |
1172 if (!err && !err_drive |
1231 && driveInfo.iType != EMediaNotPresent |
1173 && driveInfo.iType != EMediaNotPresent |
1232 && driveInfo.iDriveAtt& KDriveAttRemovable ) |
1174 && driveInfo.iDriveAtt& KDriveAttRemovable ) |
1233 { |
1175 { |
1234 TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL mount drive==%d", drive); |
1176 TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL mount drive==%d", drive); |
1235 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL;drive=%d", drive ); |
|
1236 |
1177 |
1237 CThumbnailStore** resPtr = iStores.Find( drive ); |
1178 CThumbnailStore** resPtr = iStores.Find( drive ); |
1238 |
1179 |
1239 if ( resPtr ) |
1180 if ( resPtr ) |
1240 { |
1181 { |
1241 TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() already mounted, skip %d", drive); |
1182 TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() already mounted, skip %d", drive); |
1242 OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL;drive=%d", drive ); |
|
1243 continue; |
1183 continue; |
1244 } |
1184 } |
1245 |
1185 |
1246 // ignore errors |
1186 // ignore errors |
1247 TRAP_IGNORE( StoreForDriveL( drive )); |
1187 TRAP_IGNORE( StoreForDriveL( drive )); |
1251 TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() driveStatus = %d", driveStatus); |
1191 TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() driveStatus = %d", driveStatus); |
1252 if (!(driveStatus & DriveInfo::EDriveUsbMemory) && |
1192 if (!(driveStatus & DriveInfo::EDriveUsbMemory) && |
1253 !(driveStatus & DriveInfo::EDriveRemote)) |
1193 !(driveStatus & DriveInfo::EDriveRemote)) |
1254 { |
1194 { |
1255 TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() update KItemsleft = %d", KErrNotReady); |
1195 TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() update KItemsleft = %d", KErrNotReady); |
1256 OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL;KErrNotReady=%d - update KItemsleft", KErrNotReady ); |
|
1257 RProperty::Set(KTAGDPSNotification, KItemsleft, KErrNotReady ); |
1196 RProperty::Set(KTAGDPSNotification, KItemsleft, KErrNotReady ); |
1258 } |
1197 } |
1259 |
1198 |
1260 TInt index = iUnmountedDrives.Find( drive ); |
1199 TInt index = iUnmountedDrives.Find( drive ); |
1261 |
1200 |
1265 } |
1204 } |
1266 |
1205 |
1267 if(!iUnmountedDrives.Count()&& iUnmount && iUnmount->IsActive()) |
1206 if(!iUnmountedDrives.Count()&& iUnmount && iUnmount->IsActive()) |
1268 { |
1207 { |
1269 TN_DEBUG1( "CThumbnailServer::MemoryCardStatusChangedL() cancel unmount timer"); |
1208 TN_DEBUG1( "CThumbnailServer::MemoryCardStatusChangedL() cancel unmount timer"); |
1270 OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL - cancel unmount timer" ); |
|
1271 iUnmount->Cancel(); |
1209 iUnmount->Cancel(); |
1272 } |
1210 } |
1273 } |
1211 } |
1274 |
1212 |
1275 //dismount -- if removable drive, close store |
1213 //dismount -- if removable drive, close store |
1276 else if(err && !err_drive && driveInfo.iDriveAtt& KDriveAttRemovable ) |
1214 else if(err && !err_drive && driveInfo.iDriveAtt& KDriveAttRemovable ) |
1277 { |
1215 { |
1278 TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() unmount drive==%d", drive); |
1216 TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() unmount drive==%d", drive); |
1279 OstTrace1( TRACE_NORMAL, DUP5_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL - unmount drive;drive=%d", drive ); |
|
1280 CloseStoreForDriveL( drive); |
1217 CloseStoreForDriveL( drive); |
1281 } |
1218 } |
1282 } |
1219 } |
1283 |
1220 |
1284 TN_DEBUG1( "CThumbnailServer::MemoryCardStatusChangedL out()" ); |
1221 TN_DEBUG1( "CThumbnailServer::MemoryCardStatusChangedL out()" ); |
1285 OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL - out" ); |
|
1286 } |
1222 } |
1287 |
1223 |
1288 |
1224 |
1289 // ----------------------------------------------------------------------------- |
1225 // ----------------------------------------------------------------------------- |
1290 // Get the required size (in characters) for a buffer that contains the |
1226 // Get the required size (in characters) for a buffer that contains the |
1339 // |
1275 // |
1340 TBool CThumbnailServer::UpdateThumbnailsL( const TDesC& aPath, |
1276 TBool CThumbnailServer::UpdateThumbnailsL( const TDesC& aPath, |
1341 const TInt /*aOrientation*/, const TInt64 aModified ) |
1277 const TInt /*aOrientation*/, const TInt64 aModified ) |
1342 { |
1278 { |
1343 TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL()"); |
1279 TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL()"); |
1344 OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL" ); |
|
1345 |
1280 |
1346 // 1. check path change |
1281 // 1. check path change |
1347 // 2. check timestamp change |
1282 // 2. check timestamp change |
1348 TBool modifiedChanged = EFalse; |
1283 TBool modifiedChanged = EFalse; |
1349 |
1284 |
1350 CThumbnailStore* store = StoreForPathL( aPath ); |
1285 CThumbnailStore* store = StoreForPathL( aPath ); |
1351 |
1286 |
1352 TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exist"); |
1287 TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exist"); |
1353 OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - exist" ); |
|
1354 |
1288 |
1355 TBool exists = store->CheckModifiedByPathL(aPath, aModified, modifiedChanged); |
1289 TBool exists = store->CheckModifiedByPathL(aPath, aModified, modifiedChanged); |
1356 |
1290 |
1357 if(!exists) |
1291 if(!exists) |
1358 { |
1292 { |
1359 TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exists NO"); |
1293 TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exists NO"); |
1360 OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - exists NO" ); |
|
1361 //not found, needs to be generated |
1294 //not found, needs to be generated |
1362 return EFalse; |
1295 return EFalse; |
1363 } |
1296 } |
1364 |
1297 |
1365 TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified ?"); |
1298 TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified ?"); |
1366 OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - modified ?" ); |
|
1367 |
1299 |
1368 if (modifiedChanged) |
1300 if (modifiedChanged) |
1369 { |
1301 { |
1370 TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified YES"); |
1302 TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified YES"); |
1371 OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - modified YES" ); |
|
1372 |
1303 |
1373 // delete old thumbs |
1304 // delete old thumbs |
1374 store->DeleteThumbnailsL(aPath, ETrue); |
1305 store->DeleteThumbnailsL(aPath, ETrue); |
1375 |
1306 |
1376 if( iFetchedChecker ) |
1307 if( iFetchedChecker ) |
1381 // need to create new thumbs |
1312 // need to create new thumbs |
1382 } |
1313 } |
1383 else |
1314 else |
1384 { |
1315 { |
1385 TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified NO"); |
1316 TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified NO"); |
1386 OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - modified NO" ); |
|
1387 |
1317 |
1388 // not modified |
1318 // not modified |
1389 return ETrue; |
1319 return ETrue; |
1390 } |
1320 } |
1391 |
1321 |
1392 TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - no thumbs found, create new"); |
1322 TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - no thumbs found, create new"); |
1393 OstTrace0( TRACE_NORMAL, DUP7_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - no thumbs found, create new" ); |
|
1394 |
1323 |
1395 return EFalse; |
1324 return EFalse; |
1396 } |
1325 } |
1397 |
1326 |
1398 // ----------------------------------------------------------------------------- |
1327 // ----------------------------------------------------------------------------- |
1400 // ----------------------------------------------------------------------------- |
1329 // ----------------------------------------------------------------------------- |
1401 // |
1330 // |
1402 void CThumbnailServer::RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath ) |
1331 void CThumbnailServer::RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath ) |
1403 { |
1332 { |
1404 TN_DEBUG2( "CThumbnailServer::RenameThumbnailsL(%S)", &aCurrentPath); |
1333 TN_DEBUG2( "CThumbnailServer::RenameThumbnailsL(%S)", &aCurrentPath); |
1405 OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSERVER_RENAMETHUMBNAILSL, "CThumbnailServer::RenameThumbnailsL;aCurrentPath=%S", aCurrentPath ); |
|
1406 |
1334 |
1407 StoreForPathL( aCurrentPath )->RenameThumbnailsL( aCurrentPath, aNewPath ); |
1335 StoreForPathL( aCurrentPath )->RenameThumbnailsL( aCurrentPath, aNewPath ); |
1408 |
1336 |
1409 if( iFetchedChecker ) |
1337 if( iFetchedChecker ) |
1410 { |
1338 { |
1478 aMimeType = TDataType( KBmpMime ); |
1406 aMimeType = TDataType( KBmpMime ); |
1479 } |
1407 } |
1480 else if ( ext.CompareF( K3gpExt ) == 0 ) |
1408 else if ( ext.CompareF( K3gpExt ) == 0 ) |
1481 { |
1409 { |
1482 aMimeType = TDataType( KVideo3gppMime ); |
1410 aMimeType = TDataType( KVideo3gppMime ); |
1483 return KErrNotFound; |
|
1484 // 3gp can contain video or audio, should go to recognizer |
|
1485 } |
1411 } |
1486 else if ( ext.CompareF( K3gppExt ) == 0 ) |
1412 else if ( ext.CompareF( K3gppExt ) == 0 ) |
1487 { |
1413 { |
1488 aMimeType = TDataType( KVideo3gppMime ); |
1414 aMimeType = TDataType( KVideo3gppMime ); |
1489 return KErrNotFound; |
|
1490 // 3gp can contain video or audio, should go to recognizer |
|
1491 } |
1415 } |
1492 else if ( ext.CompareF( KAmrExt ) == 0 ) |
1416 else if ( ext.CompareF( KAmrExt ) == 0 ) |
1493 { |
1417 { |
1494 aMimeType = TDataType( KAudioAmrMime ); |
1418 aMimeType = TDataType( KAudioAmrMime ); |
1495 } |
1419 } |
1689 { |
1613 { |
1690 TRAP( result, CThumbnailServer::ThreadFunctionL()); |
1614 TRAP( result, CThumbnailServer::ThreadFunctionL()); |
1691 TN_DEBUG2( |
1615 TN_DEBUG2( |
1692 "CThumbnailServer::E32Main() -- thread function out, result=%d", |
1616 "CThumbnailServer::E32Main() -- thread function out, result=%d", |
1693 result ); |
1617 result ); |
1694 OstTrace1( TRACE_NORMAL, _E32MAIN, "::E32Main;result=%d - thread function out", result ); |
|
1695 delete cleanup; |
1618 delete cleanup; |
1696 cleanup = NULL; |
1619 cleanup = NULL; |
1697 } |
1620 } |
1698 if ( result != KErrNone ) |
1621 if ( result != KErrNone ) |
1699 { |
1622 { |
1700 // Signal the client that server creation failed |
1623 // Signal the client that server creation failed |
1701 TN_DEBUG1( "CThumbnailServer::E32Main() -- Rendezvous() in" ); |
1624 TN_DEBUG1( "CThumbnailServer::E32Main() -- Rendezvous() in" ); |
1702 OstTrace0( TRACE_NORMAL, DUP2__E32MAIN, "::E32Main - in" ); |
|
1703 RProcess::Rendezvous( result ); |
1625 RProcess::Rendezvous( result ); |
1704 TN_DEBUG1( "CThumbnailServer::E32Main() -- Rendezvous() out" ); |
1626 TN_DEBUG1( "CThumbnailServer::E32Main() -- Rendezvous() out" ); |
1705 OstTrace0( TRACE_NORMAL, DUP1__E32MAIN, "::E32Main - out" ); |
|
1706 } |
1627 } |
1707 |
1628 |
1708 __UHEAP_MARKEND; |
1629 __UHEAP_MARKEND; |
1709 return result; |
1630 return result; |
1710 } |
1631 } |
1735 |
1656 |
1736 // if removable drive, close store |
1657 // if removable drive, close store |
1737 if (!err && driveInfo.iDriveAtt& KDriveAttRemovable) |
1658 if (!err && driveInfo.iDriveAtt& KDriveAttRemovable) |
1738 { |
1659 { |
1739 TN_DEBUG2( "CThumbnailServer::CloseRemovableDrive drive=%d", drive); |
1660 TN_DEBUG2( "CThumbnailServer::CloseRemovableDrive drive=%d", drive); |
1740 OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_CLOSEREMOVABLEDRIVESL, "CThumbnailServer::CloseRemovableDrivesL;drive=%d", drive ); |
|
1741 CloseStoreForDriveL(drive); |
1661 CloseStoreForDriveL(drive); |
1742 } |
1662 } |
1743 } |
1663 } |
1744 iProcessor->RemoveAllTasks(); |
1664 iProcessor->RemoveAllTasks(); |
1745 } |
1665 } |
1770 |
1690 |
1771 // if removable drive, open store |
1691 // if removable drive, open store |
1772 if (!err && driveInfo.iDriveAtt& KDriveAttRemovable) |
1692 if (!err && driveInfo.iDriveAtt& KDriveAttRemovable) |
1773 { |
1693 { |
1774 TN_DEBUG2( "CThumbnailServer::OpenRemovableDrive drive=%d", drive); |
1694 TN_DEBUG2( "CThumbnailServer::OpenRemovableDrive drive=%d", drive); |
1775 OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_OPENREMOVABLEDRIVESL, "CThumbnailServer::OpenRemovableDrivesL;drive=%d", drive ); |
|
1776 StoreForDriveL(drive); |
1695 StoreForDriveL(drive); |
1777 } |
1696 } |
1778 } |
1697 } |
1779 } |
1698 } |
1780 |
1699 |
1793 // --------------------------------------------------------------------------- |
1712 // --------------------------------------------------------------------------- |
1794 // |
1713 // |
1795 void CThumbnailServer::FormatNotification( TBool aFormat ) |
1714 void CThumbnailServer::FormatNotification( TBool aFormat ) |
1796 { |
1715 { |
1797 TN_DEBUG2( "CThumbnailServer::FormatNotification(%d)", aFormat ); |
1716 TN_DEBUG2( "CThumbnailServer::FormatNotification(%d)", aFormat ); |
1798 OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_FORMATNOTIFICATION, "CThumbnailServer::FormatNotification;aFormat=%d", aFormat ); |
|
1799 |
1717 |
1800 if(aFormat) |
1718 if(aFormat) |
1801 { |
1719 { |
1802 TRAP_IGNORE( CloseRemovableDrivesL() ); |
1720 TRAP_IGNORE( CloseRemovableDrivesL() ); |
1803 } |
1721 } |
1812 // --------------------------------------------------------------------------- |
1730 // --------------------------------------------------------------------------- |
1813 // |
1731 // |
1814 TInt CThumbnailServer::ReconnectCallBack(TAny* aAny) |
1732 TInt CThumbnailServer::ReconnectCallBack(TAny* aAny) |
1815 { |
1733 { |
1816 TN_DEBUG1( "CThumbnailServer::ReconnectCallBack() - reconnect"); |
1734 TN_DEBUG1( "CThumbnailServer::ReconnectCallBack() - reconnect"); |
1817 OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_RECONNECTCALLBACK, "CThumbnailServer::ReconnectCallBack - reconnect" ); |
|
1818 |
1735 |
1819 CThumbnailServer* self = static_cast<CThumbnailServer*>( aAny ); |
1736 CThumbnailServer* self = static_cast<CThumbnailServer*>( aAny ); |
1820 |
1737 |
1821 self->iReconnect->Cancel(); |
1738 self->iReconnect->Cancel(); |
1822 |
1739 |
1868 // --------------------------------------------------------------------------- |
1782 // --------------------------------------------------------------------------- |
1869 // |
1783 // |
1870 void CThumbnailServer::StartUnmountTimeout( const TInt aDrive) |
1784 void CThumbnailServer::StartUnmountTimeout( const TInt aDrive) |
1871 { |
1785 { |
1872 TN_DEBUG2( "CThumbnailServer::StartUnmountTimeout(%d)", aDrive); |
1786 TN_DEBUG2( "CThumbnailServer::StartUnmountTimeout(%d)", aDrive); |
1873 OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_STARTUNMOUNTTIMEOUT, "CThumbnailServer::StartUnmountTimeout;aDrive=%d", aDrive ); |
|
1874 |
1787 |
1875 if(iUnmount ) |
1788 if(iUnmount ) |
1876 { |
1789 { |
1877 if(iUnmountedDrives.Find( aDrive ) == KErrNotFound) |
1790 if(iUnmountedDrives.Find( aDrive ) == KErrNotFound) |
1878 { |
1791 { |
1883 { |
1796 { |
1884 iUnmount->Cancel(); |
1797 iUnmount->Cancel(); |
1885 } |
1798 } |
1886 |
1799 |
1887 TN_DEBUG1( "CThumbnailServer::StartUnmountTimeout() start unmount timer"); |
1800 TN_DEBUG1( "CThumbnailServer::StartUnmountTimeout() start unmount timer"); |
1888 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_STARTUNMOUNTTIMEOUT, "CThumbnailServer::StartUnmountTimeout - start unmount timer" ); |
|
1889 iUnmount->Start( KUnmountTimerTimeout, KUnmountTimerTimeout, TCallBack(UnmountCallBack, this)); |
1801 iUnmount->Start( KUnmountTimerTimeout, KUnmountTimerTimeout, TCallBack(UnmountCallBack, this)); |
1890 } |
1802 } |
1891 __ASSERT_DEBUG(( iUnmount ), ThumbnailPanic( EThumbnailNullPointer )); |
1803 __ASSERT_DEBUG(( iUnmount ), ThumbnailPanic( EThumbnailNullPointer )); |
1892 } |
1804 } |
1893 |
1805 |
1897 // --------------------------------------------------------------------------- |
1809 // --------------------------------------------------------------------------- |
1898 // |
1810 // |
1899 TInt CThumbnailServer::UnmountCallBack(TAny* aAny) |
1811 TInt CThumbnailServer::UnmountCallBack(TAny* aAny) |
1900 { |
1812 { |
1901 TN_DEBUG1( "CThumbnailServer::UnmountCallBack() - unmount finished"); |
1813 TN_DEBUG1( "CThumbnailServer::UnmountCallBack() - unmount finished"); |
1902 OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_UNMOUNTCALLBACK, "CThumbnailServer::UnmountCallBack - unmount finished" ); |
|
1903 |
1814 |
1904 CThumbnailServer* self = static_cast<CThumbnailServer*>( aAny ); |
1815 CThumbnailServer* self = static_cast<CThumbnailServer*>( aAny ); |
1905 |
1816 |
1906 self->iUnmount->Cancel(); |
1817 self->iUnmount->Cancel(); |
1907 |
1818 |
1908 self->iUnmountedDrives.Reset(); |
1819 self->iUnmountedDrives.Reset(); |
1909 |
1820 |
1910 TN_DEBUG1( "CThumbAGDaemon::UnmountCallBack() - done"); |
1821 TN_DEBUG1( "CThumbAGDaemon::UnmountCallBack() - done"); |
1911 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_UNMOUNTCALLBACK, "CThumbnailServer::UnmountCallBack - done" ); |
|
1912 |
1822 |
1913 return KErrNone; |
1823 return KErrNone; |
1914 } |
1824 } |