# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1272376675 -10800 # Node ID 85a88bc05e459ecf7f3cc47709a005b44ad7310e # Parent ee674526fac515f90d2afd718b96100870c6a1ea Revision: 201015 Kit: 201017 diff -r ee674526fac5 -r 85a88bc05e45 imagehandling_plat/thumbnailmanager_api/tsrc/group/bld.inf --- a/imagehandling_plat/thumbnailmanager_api/tsrc/group/bld.inf Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandling_plat/thumbnailmanager_api/tsrc/group/bld.inf Tue Apr 27 16:57:55 2010 +0300 @@ -44,10 +44,10 @@ ../data/mmc/ThumbnailManagerTest/TestMBM.mbm /epoc32/winscw/c/data/ThumbnailManagerTest/TestMBM.mbm ../data/mmc/ThumbnailManagerTest/mp3.mp3 /epoc32/winscw/c/data/ThumbnailManagerTest/mp3.mp3 ../data/mmc/ThumbnailManagerTest/camera.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/camera.jpg -../data/mmc/ThumbnailManagerTest/camera.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/mp3_png.mp3 -../data/mmc/ThumbnailManagerTest/camera.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/no_exif.jpg -../data/mmc/ThumbnailManagerTest/camera.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/wma.wma -../data/mmc/ThumbnailManagerTest/camera.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/wma_empty.wma -../data/mmc/ThumbnailManagerTest/camera.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/wma_png.wma -../data/mmc/ThumbnailManagerTest/camera.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/exif.jpg +../data/mmc/ThumbnailManagerTest/mp3_png.mp3 /epoc32/winscw/c/data/ThumbnailManagerTest/mp3_png.mp3 +../data/mmc/ThumbnailManagerTest/no_exif.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/no_exif.jpg +../data/mmc/ThumbnailManagerTest/wma.wma /epoc32/winscw/c/data/ThumbnailManagerTest/wma.wma +../data/mmc/ThumbnailManagerTest/wma_empty.wma /epoc32/winscw/c/data/ThumbnailManagerTest/wma_empty.wma +../data/mmc/ThumbnailManagerTest/wma_png.wma /epoc32/winscw/c/data/ThumbnailManagerTest/wma_png.wma +../data/mmc/ThumbnailManagerTest/exif.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/exif.jpg // End of File diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h --- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Tue Apr 27 16:57:55 2010 +0300 @@ -51,12 +51,15 @@ //insert to temp table first wo indexing and move data to main table as batch //actual batch size will vary and will be between min...max batch size values below + //minimum batch size const TUint KMInBatchItems = 3; //maximum batch size const TUint KMaxBatchItems = 18; //Max allowed flush time const TUint KMaxFlushDelay = 3000; //ms +// fixed batch size for MTP +const TUint KMaxBatchItemsMTP = 60; //how many items daemon will query at once from MDS const TUint KMaxQueryItems = 100; diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/inc/thumbnailpanic.h --- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailpanic.h Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailpanic.h Tue Apr 27 16:57:55 2010 +0300 @@ -31,7 +31,7 @@ = 2, EThumbnailBadPath = 3, EThumbnailUnknownMessage = 4, EThumbnailMessageNotCompleted = 5, EThumbnailBitmapNotReleased = 6, EThumbnailEmptyDescriptor = 7, EThumbnailWrongId = 8, EThumbnailAlreadyRunning = - 9, EThumbnailDatabaseUnrecoverable = 10 + 9, EThumbnailDatabaseUnrecoverable = 10, EThumbnailSQLTransaction = 11 }; /** diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/plugins/audio/group/thumbnailaudioprovider.mmp --- a/imagehandlingutilities/thumbnailmanager/plugins/audio/group/thumbnailaudioprovider.mmp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/group/thumbnailaudioprovider.mmp Tue Apr 27 16:57:55 2010 +0300 @@ -57,5 +57,7 @@ DEBUGLIBRARY flogger.lib +OPTION ARMCC -O3 -OTime + PAGED BYTEPAIRCOMPRESSTARGET diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/plugins/image/group/thumbnailimageprovider.mmp --- a/imagehandlingutilities/thumbnailmanager/plugins/image/group/thumbnailimageprovider.mmp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/plugins/image/group/thumbnailimageprovider.mmp Tue Apr 27 16:57:55 2010 +0300 @@ -56,5 +56,7 @@ DEBUGLIBRARY flogger.lib +OPTION ARMCC -O3 -OTime + PAGED BYTEPAIRCOMPRESSTARGET diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp --- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp Tue Apr 27 16:57:55 2010 +0300 @@ -553,7 +553,6 @@ reader = CExifRead::NewL( *iBuffer, CExifRead::ENoJpeg ); } - CleanupStack::PushL( reader ); iExifThumbImage = reader->GetThumbnailL(); @@ -591,16 +590,6 @@ User::LeaveIfError( err ); } -/* - // If the Exif thumbnail is smaller than requested it will not be used - TFrameInfo frame = iDecoder->FrameInfo( 0 ); - - if ( frame.iOverallSizeInPixels.iWidth < iSize.iWidth || - frame.iOverallSizeInPixels.iHeight < iSize.iHeight ) - { - User::Leave( KErrGeneral ); - } - */ TN_DEBUG1( "CThumbnailImageDecoder::CreateExifDecoderL() end" ); } diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/plugins/video/group/thumbnailvideoprovider.mmp --- a/imagehandlingutilities/thumbnailmanager/plugins/video/group/thumbnailvideoprovider.mmp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/plugins/video/group/thumbnailvideoprovider.mmp Tue Apr 27 16:57:55 2010 +0300 @@ -50,6 +50,8 @@ DEBUGLIBRARY flogger.lib +OPTION ARMCC -O3 -OTime + PAGED BYTEPAIRCOMPRESSTARGET diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/thumbagdaemon/group/thumbagdaemon.mmp --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/group/thumbagdaemon.mmp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/group/thumbagdaemon.mmp Tue Apr 27 16:57:55 2010 +0300 @@ -67,6 +67,8 @@ DEBUGLIBRARY flogger.lib +OPTION ARMCC -O3 -OTime + PAGED BYTEPAIRCOMPRESSTARGET diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Tue Apr 27 16:57:55 2010 +0300 @@ -158,7 +158,19 @@ */ void QueryL( RArray& aIDArray ); + /** + * QueryPlaceholdersL + * + * @since S60 v5.0 + */ void QueryPlaceholdersL(); + + /** + * DeleteAndCancelQuery + * + * @since Symbian^3 + */ + void DeleteAndCancelQuery(); protected: @@ -272,22 +284,33 @@ //reference to current processing queue RArray* iLastQueue; + //background generation state + // EFalse = 1st round, create only grid size thumbnail for images and videos + // ETrue = 2nds round, create all missing sizes for all media items TBool i2ndRound; + //MDS query issues TBool iQueryActive; + //MDS query complete TBool iQueryReady; + //Processing MDS itens which are modified TBool iModify; TInt iProcessingCount; - //Flag is MDS Harvester harevsting + //MDS harvester's overall state TBool iHarvesting; TBool iHarvestingTemp; - - //Flag is MDS placeholder harvesting active + + //MDS Harvester's placeholder harvesting state TBool iPHHarvesting; TBool iPHHarvestingTemp; + //MDS Harvester's SD card harvesting state + TBool iMMCHarvesting; + TBool iMMCHarvestingTemp; + + CPeriodic* iPeriodicTimer; //MDS Harvester client diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Tue Apr 27 16:57:55 2010 +0300 @@ -186,7 +186,6 @@ { // 2 observers TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) ); -//modify TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) ); #ifdef MDS_URI_OBSERVER // remove observer with uri @@ -374,8 +373,7 @@ iProcessor->RemoveFromQueues( aObjectIdArray, EFalse); } - // Add event to processing queue by type and enable force run - + // Add event to processing queue by type and enable force run RPointerArray dummyArray; TRAPD(err, iProcessor->AddToQueueL(aType, aObjectIdArray, dummyArray, EFalse)); if (err != KErrNone) diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Tue Apr 27 16:57:55 2010 +0300 @@ -369,23 +369,8 @@ } else { - TInt itemIndex(KErrNotFound); - - //cleanup current queue - while(iQueryQueue.Count()) - { - itemIndex = iLastQueue->FindInOrder(iQueryQueue[0], Compare); - if(itemIndex >= 0) - { - iLastQueue->Remove( itemIndex ); - } - iQueryQueue.Remove(0); - } - - delete iQuery; - iQuery = NULL; - iProcessingCount = 0; - TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() Query FAILED!"); + DeleteAndCancelQuery(); + TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() Query FAILED!"); } } else @@ -746,11 +731,12 @@ TInt maxCount = aIDArray.Count(); TN_DEBUG3( "CThumbAGProcessor::QueryL() - fill begin aIDArray == %d, iQueryQueue == %d", aIDArray.Count(), iQueryQueue.Count() ); - - for(TInt i=0;i < KMaxQueryItems && i < maxCount; i++) + + for(TInt i=0; i < KMaxQueryItems && i < maxCount; i++) { - TN_DEBUG2( "CThumbAGProcessor::QueryL() - fill %d", aIDArray[i] ); - iQueryQueue.InsertInOrder(aIDArray[i], Compare); + TN_DEBUG2( "CThumbAGProcessor::QueryL() - fill %d", aIDArray[0] ); + iQueryQueue.InsertInOrder(aIDArray[0], Compare); + aIDArray.Remove(0); } TN_DEBUG3( "CThumbAGProcessor::QueryL() - fill end aIDArray == %d, iQueryQueue == %d", aIDArray.Count(), iQueryQueue.Count() ); @@ -911,7 +897,7 @@ if( err == KErrNone ) { TN_DEBUG1( "CThumbAGProcessor::RunL() add iHarvesterClient observer"); - err = iHarvesterClient.AddHarvesterEventObserver( *this, EHEObserverTypeOverall | EHEObserverTypePlaceholder, KMaxTInt ); + err = iHarvesterClient.AddHarvesterEventObserver( *this, EHEObserverTypeOverall | EHEObserverTypeMMC | EHEObserverTypePlaceholder, KMaxTInt ); TN_DEBUG2( "CThumbAGProcessor::RunL() iHarvesterClient observer err = %d", err); __ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), !iHarvesterClient "), err)); } @@ -983,14 +969,9 @@ { TN_DEBUG1( "void CThumbAGProcessor::RunL() skip idle detection!"); CancelTimeout(); - } + } else { - if(iActivityManager) - { - iIdle = iActivityManager->IsInactive(); - } - if( !iIdle || iHarvesting || iMPXHarvesting || iPeriodicTimer->IsActive() ) { TN_DEBUG1( "void CThumbAGProcessor::RunL() device not idle"); @@ -1025,15 +1006,15 @@ const CMdEObject* object = &iQuery->Result( iProcessingCount-1 ); iProcessingCount--; - TInt itemIndex = iLastQueue->FindInOrder(object->Id(), Compare); - if(itemIndex >= 0) - { - iLastQueue->Remove(itemIndex); - } - - // process one item at once if ( object ) { + TInt itemIndex = iLastQueue->FindInOrder(object->Id(), Compare); + if(itemIndex >= 0) + { + iLastQueue->Remove(itemIndex); + } + + //process one item at once //remove item from queryQueue when request is issued itemIndex = iQueryQueue.FindInOrder(object->Id(), Compare); if(itemIndex >= 0) @@ -1049,28 +1030,9 @@ //force is coming, but executing non-forced query complete-> cancel old else { - TN_DEBUG1( "CThumbAGProcessor::RunL() - deleting query 1" ); - delete iQuery; - iQuery = NULL; - iQueryReady = EFalse; - iProcessingCount = 0; - - //move remainig IDs in query queue back to original queue - while(iQueryQueue.Count()) - { - if(iLastQueue) - { - if(iLastQueue->FindInOrder(iQueryQueue[0], Compare) == KErrNotFound) - { - //ignore if fails - iLastQueue->InsertInOrder(iQueryQueue[0], Compare); - } - } - iQueryQueue.Remove(0); - } - iLastQueue = NULL; - ActivateAO(); - return; + DeleteAndCancelQuery(); + ActivateAO(); + return; } //is last query item @@ -1088,32 +1050,7 @@ { if(iForceRun && !iModify) { - if(iQuery) - { - TN_DEBUG1( "CThumbAGProcessor::RunL() - deleting query 2" ); - iQuery->Cancel(); - delete iQuery; - iQuery = NULL; - } - - iQueryReady = EFalse; - iQueryActive = EFalse; - - //move remainig IDs in query queue back to original queue - while(iQueryQueue.Count()) - { - if(iLastQueue) - { - if(iLastQueue->FindInOrder(iQueryQueue[0], Compare) == KErrNotFound) - { - //ignore if fails - iLastQueue->InsertInOrder(iQueryQueue[0], Compare); - } - } - iQueryQueue.Remove(0); - } - iLastQueue = NULL; - + DeleteAndCancelQuery(); ActivateAO(); } else @@ -1186,6 +1123,44 @@ } // --------------------------------------------------------------------------- +// CThumbAGProcessor::DeleteAndCancelQuery() +// --------------------------------------------------------------------------- +// +void CThumbAGProcessor::DeleteAndCancelQuery() + { + TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() in" ); + + if(iQuery) + { + TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() - deleting query" ); + iQuery->Cancel(); + delete iQuery; + iQuery = NULL; + } + + iQueryReady = EFalse; + iQueryActive = EFalse; + iProcessingCount = 0; + + //move remainig IDs in query queue back to original queue + while(iQueryQueue.Count()) + { + if(iLastQueue) + { + if(iLastQueue->FindInOrder(iQueryQueue[0], Compare) == KErrNotFound) + { + //ignore if fails + iLastQueue->InsertInOrder(iQueryQueue[0], Compare); + } + } + iQueryQueue.Remove(0); + } + iLastQueue = NULL; + + TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() out" ); + } + +// --------------------------------------------------------------------------- // CThumbAGProcessor::DoCancel() // --------------------------------------------------------------------------- // @@ -1286,8 +1261,48 @@ } } } + //MMC harvesting + else if( aHEObserverType == EHEObserverTypeMMC) + { + switch(aHarvesterEventState) + { + case EHEStateStarted: + case EHEStateHarvesting: + case EHEStatePaused: + case EHEStateResumed: + { + iMMCHarvestingTemp = ETrue; + break; + } + case EHEStateFinished: + case EHEStateUninitialized: + { + iMMCHarvestingTemp = EFalse; + break; + } + }; + + if(iMMCHarvestingTemp != iMMCHarvesting) + { + iMMCHarvesting = iMMCHarvestingTemp; + + if( iMMCHarvesting ) + { + TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS MMC harvesterin started"); + if(iPreviousItemsLeft != KErrNotReady) + { + iPreviousItemsLeft = KErrNotReady; + RProperty::Set(KTAGDPSNotification, KDaemonProcessing, iPreviousItemsLeft); + } + } + else + { + TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS MMC harvesting finished "); + } + } + } - TN_DEBUG3( "CThumbAGProcessor::HarvestingUpdated -- end() iHarvesting == %d, iPHHarvesting == %d ", iHarvesting, iPHHarvesting); + TN_DEBUG4( "CThumbAGProcessor::HarvestingUpdated -- end() iHarvesting == %d, iPHHarvesting == %d iMMCHarvesting == %d ", iHarvesting, iPHHarvesting, iMMCHarvesting); } // --------------------------------------------------------------------------- @@ -1770,19 +1785,19 @@ daemonProcessing = ETrue; } - //disable 2nd round generarion when there is items in 1st round queues - //or 2nd queue is empty - if( !i2ndRoundGenerateQueue.Count() || itemsLeft ) - { - i2ndRound = EFalse; - } - //adjust items left to containing also items not yet processed but removed from queue under processing if((iLastQueue == &iModifyQueue || iLastQueue == &iAddQueue) && !i2ndRound) { itemsLeft +=iQueryQueue.Count(); } + //cancel 2nd round generarion when there is items in 1st round queues + if(itemsLeft && i2ndRound) + { + DeleteAndCancelQuery(); + i2ndRound = EFalse; + } + TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() KItemsleft == %d", itemsLeft); if(aDefine) diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/thumbnailclient/group/thumbnailmanager.mmp --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/group/thumbnailmanager.mmp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/group/thumbnailmanager.mmp Tue Apr 27 16:57:55 2010 +0300 @@ -54,5 +54,7 @@ DEBUGLIBRARY flogger.lib +OPTION ARMCC -O3 -OTime + PAGED BYTEPAIRCOMPRESSTARGET diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Tue Apr 27 16:57:55 2010 +0300 @@ -843,8 +843,16 @@ CThumbnailRequestActive* self = static_cast( aAny ); + self->iTimer->Cancel(); + + if (self->IsActive()) + { + // hangs without this + TRequestStatus* statusPtr = &self->iStatus; + User::RequestComplete( statusPtr, KErrTimedOut ); + } + self->Cancel(); - self->iTimer->Cancel(); if (self->iStartError != KErrNone) { @@ -857,6 +865,8 @@ self->HandleError(); + TN_DEBUG1( "CThumbnailRequestActive::TimerCallBack() - end"); + return KErrNone; } diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/thumbnailserver/group/thumbnailserver.mmp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/group/thumbnailserver.mmp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/group/thumbnailserver.mmp Tue Apr 27 16:57:55 2010 +0300 @@ -33,10 +33,11 @@ EPOCHEAPSIZE 4096 0x3000000 // max heap 48MB #endif - CAPABILITY ALL -TCB -DRM VENDORID VID_DEFAULT +EPOCPROCESSPRIORITY background + SOURCEPATH ../src SOURCE thumbnailserver.cpp SOURCE thumbnailserversession.cpp @@ -91,7 +92,7 @@ DEBUGLIBRARY flogger.lib -BYTEPAIRCOMPRESSTARGET -EPOCPROCESSPRIORITY background +OPTION ARMCC -O3 -OTime UNPAGED +BYTEPAIRCOMPRESSTARGET diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailfetchedchecker.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailfetchedchecker.h Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailfetchedchecker.h Tue Apr 27 16:57:55 2010 +0300 @@ -34,7 +34,7 @@ NONSHARABLE_CLASS( CEntry ) : public CBase { public: - static CEntry* New( const TDesC& aUri, TInt aError ); + static CEntry* NewL( const TDesC& aUri, TInt aError ); static TInt FindCB( const TDesC* aUri, const CEntry& aEntry ); static TInt InsertCB( const CEntry& aEntry1, const CEntry& aEntry2 ); CEntry(); diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailstore.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailstore.h Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailstore.h Tue Apr 27 16:57:55 2010 +0300 @@ -40,7 +40,7 @@ { enum TState { - EOpen, EError, EClosed + EOpen, EOldOpen, EError, EClosed }; public: RThumbnailTransaction( RSqlDatabase& aDatabase ); diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp Tue Apr 27 16:57:55 2010 +0300 @@ -17,7 +17,7 @@ #include "thumbnailfetchedchecker.h" -const int KMaxStoredEntries = 50; +const int KMaxStoredEntries = 100; // ----------------------------------------------------------------------------- // CThumbnailFetchedChecker::CThumbnailFetchedChecker() @@ -78,10 +78,11 @@ else { // Add or update - CEntry* entry = CEntry::New( aUri, aError ); - if ( entry ) + CEntry* entry = NULL; + TRAPD( err, entry = CEntry::NewL( aUri, aError ) ); + if ( !err && entry ) { - TInt err = iNotFetched.Find( entry ); + err = iNotFetched.Find( entry ); if ( err != KErrNotFound ) { TInt i = iNotFetched.FindInOrder( aUri, CEntry::FindCB ); @@ -118,10 +119,10 @@ // CThumbnailFetchedChecker::CEntry::New() // ----------------------------------------------------------------------------- // -CThumbnailFetchedChecker::CEntry* CThumbnailFetchedChecker::CEntry::New( +CThumbnailFetchedChecker::CEntry* CThumbnailFetchedChecker::CEntry::NewL( const TDesC& aUri, TInt aError ) { - CEntry* self = new (ELeave) CEntry(); + CEntry* self = new (ELeave) CEntry(); if ( self ) { self->iUri = aUri.Alloc(); diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Tue Apr 27 16:57:55 2010 +0300 @@ -621,6 +621,7 @@ TN_DEBUG2( "CThumbnailServer::DeleteThumbnailsL(%S)", &aPath); StoreForPathL( aPath )->DeleteThumbnailsL( aPath ); + if( iFetchedChecker ) { iFetchedChecker->SetFetchResult( aPath, KErrNone ); @@ -936,16 +937,14 @@ // CThumbnailStore::PersistentSizeL() // --------------------------------------------------------------------------- // -TThumbnailPersistentSize & CThumbnailServer::PersistentSizeL( TThumbnailSize - aThumbnailSize ) +TThumbnailPersistentSize & CThumbnailServer::PersistentSizeL( TThumbnailSize aThumbnailSize ) { if ( !iCenrep ) - { - iCenrep = CThumbnailCenRep::NewL(); - } + { + iCenrep = CThumbnailCenRep::NewL(); + } - return iCenrep->PersistentSizeL( aThumbnailSize ); - + return iCenrep->PersistentSizeL( aThumbnailSize ); } // ----------------------------------------------------------------------------- @@ -1200,6 +1199,11 @@ // delete old thumbs store->DeleteThumbnailsL(aPath, ETrue); + if( iFetchedChecker ) + { + iFetchedChecker->SetFetchResult( aPath, KErrNone ); + } + // need to create new thumbs } else @@ -1226,6 +1230,12 @@ TN_DEBUG2( "CThumbnailServer::RenameThumbnailsL(%S)", &aCurrentPath); StoreForPathL( aCurrentPath )->RenameThumbnailsL( aCurrentPath, aNewPath ); + + if( iFetchedChecker ) + { + iFetchedChecker->SetFetchResult( aNewPath, iFetchedChecker->LastFetchResult(aCurrentPath) ); + iFetchedChecker->SetFetchResult( aCurrentPath, KErrNone ); + } } // ----------------------------------------------------------------------------- diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Tue Apr 27 16:57:55 2010 +0300 @@ -652,9 +652,14 @@ { TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType; TDataType mimetype; - Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype ); - sourceType = Server()->SourceTypeFromMimeType( mimetype ); - ModifyThumbnailSize(sourceType); + TInt ret = Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype ); + + if( ret == KErrNone ) + { + sourceType = Server()->SourceTypeFromMimeType( mimetype ); + ModifyThumbnailSize(sourceType); + } + User::LeaveIfError( ret ); } TInt bufferSize = aMessage.Int2(); diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Tue Apr 27 16:57:55 2010 +0300 @@ -35,7 +35,7 @@ #include "thumbnailserver.h" -_LIT8( KThumbnailSqlConfig, "page_size=1024; cache_size=32;" ); +_LIT8( KThumbnailSqlConfig, "page_size=16384; cache_size=32;" ); const TInt KStreamBufferSize = 1024 * 8; const TInt KMajor = 3; @@ -68,7 +68,18 @@ // --------------------------------------------------------------------------- // void RThumbnailTransaction::BeginL() - { + { + if (iDatabase.InTransaction()) + { + TN_DEBUG1( "RThumbnailTransaction::BeginL() - error: old transaction open!" ); + __ASSERT_DEBUG(( !iDatabase.InTransaction() ), ThumbnailPanic( EThumbnailSQLTransaction )); + + // old transaction already open, don't open another + iState = EOldOpen; + + return; + } + const TInt err = iDatabase.Exec( KThumbnailBeginTransaction ); if ( err >= 0 ) { @@ -91,7 +102,7 @@ // void RThumbnailTransaction::Close() { - if ( iState != EClosed ) + if ( iState != EClosed && iState != EOldOpen ) { Rollback(); } @@ -103,13 +114,16 @@ // void RThumbnailTransaction::CommitL() { - TInt ret = iDatabase.Exec( KThumbnailCommitTransaction ); + if ( iState != EOldOpen ) + { + TInt ret = iDatabase.Exec( KThumbnailCommitTransaction ); #ifdef _DEBUG TPtrC errorMsg = iDatabase.LastErrorMessage(); TN_DEBUG3( "RThumbnailTransaction::CommitL() lastError %S, ret = %d" , &errorMsg, ret); #endif User::LeaveIfError( ret ); + } iState = EClosed; } @@ -120,12 +134,20 @@ // TInt RThumbnailTransaction::Rollback() { - const TInt err = iDatabase.Exec( KThumbnailRollbackTransaction ); - if ( err >= 0 ) + if ( iState != EOldOpen ) { - iState = EClosed; + const TInt err = iDatabase.Exec( KThumbnailRollbackTransaction ); + if ( err >= 0 ) + { + iState = EClosed; + } + + return err; } - return err; + + iState = EClosed; + + return KErrNone; } @@ -1766,12 +1788,15 @@ CleanupStack::PopAndDestroy( stmt_infodata ); CleanupStack::PopAndDestroy( stmt_info ); + CleanupStack::PopAndDestroy( stmt ); //remove delete mark User::LeaveIfError( iDatabase.Exec( KThumbnailSqlDeleteFromDeleted ) ); } else { + TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- add to Deleted" ); + // only add path to deleted table stmt = &iStmt_KThumbnailSqlInsertDeleted; CleanupStack::PushL(TCleanupItem(ResetStatement, stmt)); @@ -1781,9 +1806,9 @@ User::LeaveIfError( stmt->BindText( paramIndex, *path )); count = stmt->Exec(); - } - - CleanupStack::PopAndDestroy( stmt ); + + CleanupStack::PopAndDestroy( stmt ); + } if (aTransaction) { @@ -1911,13 +1936,28 @@ return; } - if(iBatchItemCount < iBatchFlushItemCount && !aForce) + // fixed batch size if MTP sync on + TInt MPXHarvesting(0); + TInt ret = RProperty::Get(KTAGDPSNotification, KMPXHarvesting, MPXHarvesting); + if(ret != KErrNone) + { + TN_DEBUG2( "CThumbnailStore::FlushCacheTable() error checking MTP sync: %d", ret); + } + + if(MPXHarvesting && iBatchItemCount < KMaxBatchItemsMTP && !aForce) + { + TN_DEBUG1("CThumbnailStore::FlushCacheTable() MTP sync, fixed batch..."); + + //some items in cache + StartAutoFlush(); + return; + } + else if(!MPXHarvesting && iBatchItemCount < iBatchFlushItemCount && !aForce) { //some items in cache StartAutoFlush(); return; - } - + } iStartFlush.UniversalTime(); @@ -1972,25 +2012,29 @@ // open new TRAP_IGNORE(OpenDatabaseL(ETrue)); } - - //adjust batch size dynamically between min and max based on read flush speed. + iStopFlush.UniversalTime(); TInt aFlushDelay = (TInt)iStopFlush.MicroSecondsFrom(iStartFlush).Int64()/1000; + TN_DEBUG2( "CThumbnailStore::FlushCacheTable() took %d ms", aFlushDelay); + //adjust batch size dynamically between min and max based on read flush speed + if (!MPXHarvesting) + { + //increase batch count if there room for one more item (based on average time per item) + if( aFlushDelay < KMaxFlushDelay && iBatchFlushItemCount < KMaxBatchItems ) + { + iBatchFlushItemCount++; + } + //decrease batch count if we exeeced max time allowed in flushing the TEMP table + else if(aFlushDelay > KMaxFlushDelay && iBatchFlushItemCount > KMInBatchItems ) + { + iBatchFlushItemCount--; + } + } + //cache flushed iBatchItemCount = 0; - - //increase batch count if there room for one more item (based on average time per item) - if( aFlushDelay < KMaxFlushDelay && iBatchFlushItemCount < KMaxBatchItems ) - { - iBatchFlushItemCount++; - } - //decrease batch count if we exeeced max time allowed in flushing the TEMP table - else if(aFlushDelay > KMaxFlushDelay && iBatchFlushItemCount > KMInBatchItems ) - { - iBatchFlushItemCount--; - } TN_DEBUG2("CThumbnailStore::FlushCacheTable() out iBatchFlushItemCount = %d", iBatchFlushItemCount); } @@ -2159,7 +2203,7 @@ { self->StartMaintenance(); } - else + else if (!self->iDeleteThumbs && !self->iCheckFilesExist) { // no need to monitor activity anymore self->iActivityManager->Cancel(); diff -r ee674526fac5 -r 85a88bc05e45 imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp --- a/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp Wed Apr 14 16:16:51 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp Tue Apr 27 16:57:55 2010 +0300 @@ -66,6 +66,7 @@ { TN_DEBUG1( "CTMActivityManager::ConstructL()"); iTimer.CreateLocal(); + iWatch = ENone; } // --------------------------------------------------------------------------- @@ -112,8 +113,6 @@ { TN_DEBUG1( "CTMActivityManager::Start()"); - iFirstRound = ETrue; - #ifdef MONITOR_LIGHTS if(!iLight) { @@ -121,11 +120,16 @@ } #endif - if( !IsActive() ) + if ( iWatch == ENone ) { - SetActive(); - TRequestStatus* statusPtr = &iStatus; - User::RequestComplete( statusPtr, KErrNone ); + iFirstRound = ETrue; + + if( !IsActive() ) + { + SetActive(); + TRequestStatus* statusPtr = &iStatus; + User::RequestComplete( statusPtr, KErrNone ); + } } } @@ -161,12 +165,12 @@ TN_DEBUG1( "CTMActivityManager::RunL() inactive"); NotifyObserver(); - if (!IsActive()) //observer might have called a Reset() - { - iTimer.Inactivity(iStatus,0); - iWatch = EWaitingForActivity; + if (!IsActive()) //observer might have called a Reset() + { + iTimer.Inactivity(iStatus,0); + iWatch = EWaitingForActivity; + } } - } else { iTimer.Inactivity(iStatus,iTimeout); @@ -174,8 +178,8 @@ } else if (iWatch == EWaitingForActivity) { - TN_DEBUG1( "CTMActivityManager::RunL() active"); - NotifyObserver(); + TN_DEBUG1( "CTMActivityManager::RunL() active"); + NotifyObserver(); if (!IsActive()) //observer might have called a Reset() {