# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1277125246 -10800 # Node ID ff2fb7658ff768a7384be123a578e26c72c5e640 # Parent f0aa341a25bff0ace492994d7f1e45e75d02b789 Revision: 201023 Kit: 2010125 diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/conf/102830B0.txt Binary file imagehandlingutilities/thumbnailmanager/conf/102830B0.txt has changed diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/conf/thumbnailmanager.confml Binary file imagehandlingutilities/thumbnailmanager/conf/thumbnailmanager.confml has changed diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h --- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Mon Jun 21 16:00:46 2010 +0300 @@ -69,10 +69,17 @@ // maximum number of active client side queue requests const TUint KMaxClientRequests = 2; +#ifdef __RETRY_ON_SERVERCRASH +// maximum number of request retry +const TUint KMaxRequestRetryCount = 2; +#endif + // maximum number of active daemon requests const TUint KMaxDaemonRequests = 2; -const TUint KMdEReconnect = 100000; //100 ms +const TUint KMdEReconnect = 1*1000*1000; //1 second + +const TUint KUnmountTimerTimeout = 5*1000*1000; //5 seconds const TUint KClientRequestTimeout = 60000000; //60 sec const TUint KClientRequestStartErrorTimeout = 100000; //100 ms @@ -83,9 +90,12 @@ const TInt KThumbnailErrThumbnailNotFound = -62000; -//give MDS 1000 msec time to settle before starting generating TNs +//give MDS some to settle before starting generating TNs const TInt KHarvestingCompleteTimeout = 10000000; //10 sec +//after MMC mount wait while before count is calculated +const TInt KMountTimeout = 5*1000*1000; //5 sec + const TInt KPSKeyTimeout = 10000000; //10 sec //Store's auto flush timeout const TInt KAutoFlushTimeout = 65; //65 sec @@ -487,75 +497,6 @@ EThumbnailFormatJpeg }; -struct TThumbnailDatabaseData - { -public: - /** - * Full path to object to which the imported thumb is to be linked. - */ - TPath iPath; - /** - * Thumbnail ID - */ - TInt iTnId; - /** - * Requested thumbnail size new requests. - */ - TInt iSize; - /** - * type of data - */ - TInt iFormat; - /** - * Path for the thumbnails - */ - TPath iTnPath; - /** - * Data if bitmap - */ - CFbsBitmap* iBlob; - /** - * Data if jpeg - */ - TDesC8* iData; - /** - * Width of thumbnail - */ - TInt iWidth; - /** - * Height of thumbnail - */ - TInt iHeight; - /** - * Original width of thumbnail - */ - TInt iOrigWidth; - /** - * Original height of thumbnail - */ - TInt iOrigHeight; - /** - * flags - */ - TInt iFlags; - /** - * videoposition - */ - TInt iVideoPosition; - /** - * thumb oritentation - */ - TInt iOrientation; - /** - * Thumb created from associated path - */ - TInt iThumbFromPath; - /** - * last modified - */ - TInt64 iModified; - - }; /** * MDS query modes used during thumbnail generation diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp --- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -95,6 +95,8 @@ TPtrC8 ptr = metaCont.Field8( EMetaDataJpeg ); HBufC8* data = ptr.AllocL(); + CleanupStack::PopAndDestroy(&wantedFields); + CleanupStack::PopAndDestroy(metaDataUtil); CleanupStack::PushL( data ); if(data->Length() == 0) @@ -111,12 +113,18 @@ iFlags = aFlags; //set default mode displaymode from global constants iDisplayMode = KStoreDisplayMode; - - iImageDecoderv3->CreateL( data, *iObserver, iFlags, iMimeType, iTargetSize ); - - CleanupStack::Pop( data ); - CleanupStack::PopAndDestroy(&wantedFields); - CleanupStack::PopAndDestroy(metaDataUtil); + TRAPD( err, iImageDecoderv3->CreateL( data, *iObserver, iFlags, iMimeType, iTargetSize ) ); + if (err == KErrNone) + { + CleanupStack::Pop( data ); + } + else + { + // this is because data buffer is already released in CreateDecoderL + // and we must prevent automatic PopAndDestroy + CleanupStack::Pop( data ); + User::Leave(err); + } iOriginalSize = iImageDecoderv3->OriginalSize(); iImageDecoderv3->DecodeL( iDisplayMode ); diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp --- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -137,8 +137,7 @@ TInt err = iBitmap->Create( loadSize, aDisplayMode ); if (err != KErrNone) { - delete iBitmap; - iBitmap = NULL; + Release(); User::Leave(err); } @@ -240,9 +239,7 @@ TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) ); if ( decErr != KErrNone ) { - delete iBuffer; - iBuffer = NULL; - + Release(); TN_DEBUG2( "CThumbnailImageDecoderv3::CreateDecoderL() - CImageDecoder error %d", decErr ); User::Leave( decErr ); @@ -282,6 +279,7 @@ //no sense to try other codecs if image is corrupted if( aError == KErrCorrupt || aError == KErrUnderflow) { + Release(); User::Leave( aError ); } } diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Mon Jun 21 16:00:46 2010 +0300 @@ -148,6 +148,9 @@ void RemoveFromQueues( const RArray& aIDArray, const TBool aRemoveFromDelete = EFalse); void SetForceRun( const TBool aForceRun ); + + //prepare processor for shutdown + void Shutdown(); protected: @@ -362,6 +365,8 @@ TBool iPreviousDaemonProcessing; //set ETrue when QueryAllItems needs to be run after placeholder query TBool iDoQueryAllItems; + + TBool iShutdown; }; #endif // THUMBAGPROCESSOR_H diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -120,6 +120,7 @@ // create processor if(iProcessor) { + iProcessor->Shutdown(); delete iProcessor; iProcessor = NULL; } @@ -179,6 +180,7 @@ if (iProcessor) { + iProcessor->Shutdown(); delete iProcessor; iProcessor = NULL; } @@ -281,26 +283,24 @@ void CThumbAGDaemon::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) { TN_DEBUG2( "CThumbAGDaemon::HandleSessionError == %d", aError ); - if (aError != KErrNone && !iSessionError) + if (aError != KErrNone && !iShutdown && !iSessionError) { iSessionError = ETrue; // kill processor right away, because it also has MdESession if(iProcessor) { + iProcessor->Shutdown(); delete iProcessor; iProcessor = NULL; } - if (!iShutdown) + if (!iReconnect->IsActive()) { - if (!iReconnect->IsActive()) - { - iReconnect->Start( KMdEReconnect, KMdEReconnect, - TCallBack(ReconnectCallBack, this)); - - TN_DEBUG1( "CThumbAGDaemon::HandleSessionError() - reconnect timer started" ); - } + iReconnect->Start( KMdEReconnect, KMdEReconnect, + TCallBack(ReconnectCallBack, this)); + + TN_DEBUG1( "CThumbAGDaemon::HandleSessionError() - reconnect timer started" ); } } @@ -319,6 +319,11 @@ { TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - begin" ); + if(!iProcessor || iShutdown) + { + return; + } + if(aType == ENotifyRemove) { TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - removed"); diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -65,6 +65,8 @@ { TN_DEBUG1( "CThumbAGProcessor::ConstructL() - begin" ); + iShutdown = EFalse; + iTMSession = CThumbnailManager::NewL( *this ); iTMSession->SetRequestObserver(*this); @@ -112,12 +114,15 @@ { TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - begin" ); + Shutdown(); + Cancel(); if(iPeriodicTimer) { iPeriodicTimer->Cancel(); delete iPeriodicTimer; + iPeriodicTimer = NULL; } if(iActivityManager) @@ -191,6 +196,17 @@ TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - end" ); } +// --------------------------------------------------------------------------- +// CThumbAGProcessor::Shutdown() +// --------------------------------------------------------------------------- +// +void CThumbAGProcessor::Shutdown() + { + TN_DEBUG1( "CThumbAGProcessor::Shutdown()" ); + iShutdown = ETrue; + UpdatePSValues(); + } + // ----------------------------------------------------------------------------- // CThumbAGProcessor::HandleQueryNewResults() // ----------------------------------------------------------------------------- @@ -200,6 +216,12 @@ const TInt aNewItemCount ) { // PH & AllItems query results are handled here + + if(iShutdown) + { + return; + } + if (aNewItemCount > 0) { if(&aQuery == iQueryPlaceholders) @@ -261,6 +283,11 @@ { TN_DEBUG3( "CThumbAGProcessor::HandleQueryCompleted, aError == %d Count== %d", aError, aQuery.Count()); + if(iShutdown) + { + return; + } + if(&aQuery == iQueryPlaceholders) { TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - iQueryPlaceholders completed"); @@ -737,7 +764,7 @@ __ASSERT_DEBUG((iMdESession), User::Panic(_L("CThumbAGProcessor::QueryL() !iMdeSession "), KErrBadHandle)); __ASSERT_DEBUG((iDefNamespace), User::Panic(_L("CThumbAGProcessor::QueryL() !iDefNamespace "), KErrBadHandle)); - if(!iMdESession || !iDefNamespace) + if(!iMdESession || !iDefNamespace || iShutdown) { return; } @@ -822,7 +849,7 @@ __ASSERT_DEBUG((iMdESession), User::Panic(_L("CThumbAGProcessor::QueryPlaceholdersL() !iMdeSession "), KErrBadHandle)); __ASSERT_DEBUG((iDefNamespace), User::Panic(_L("CThumbAGProcessor::QueryPlaceholdersL() !iDefNamespace "), KErrBadHandle)); - if(!iMdESession || !iDefNamespace) + if(!iMdESession || !iDefNamespace || iShutdown) { return; } @@ -880,6 +907,12 @@ void CThumbAGProcessor::RunL() { TN_DEBUG1( "CThumbAGProcessor::RunL() - begin" ); + + if(iShutdown) + { + TN_DEBUG1( "CThumbAGProcessor::RunL() - shutdown" ); + return; + } if (iSessionDied) { @@ -1209,6 +1242,11 @@ TInt /*aItemsLeft*/ ) { TN_DEBUG3( "CThumbAGProcessor::HarvestingUpdated -- start() aHEObserverType = %d, aHarvesterEventState = %d", aHEObserverType, aHarvesterEventState ); + + if(iShutdown) + { + return; + } #ifdef _DEBUG if( aHEObserverType == EHEObserverTypePlaceholder) @@ -1348,7 +1386,7 @@ TN_DEBUG1( "CThumbAGProcessor::StartTimeout()"); CancelTimeout(); - if(!iHarvesting && !iMPXHarvesting && !iPeriodicTimer->IsActive()) + if(!iHarvesting && !iMPXHarvesting && !iPeriodicTimer->IsActive() && !iShutdown) { iPeriodicTimer->Start( KHarvestingCompleteTimeout, KHarvestingCompleteTimeout, TCallBack(PeriodicTimerCallBack, this)); @@ -1427,7 +1465,7 @@ SetForceRun( EFalse ); } - if( !IsActive() && ((!iActive && !iQueryActive) || iForceRun )) + if( !IsActive() && !iShutdown && ((!iActive && !iQueryActive) || iForceRun )) { TN_DEBUG1( "CThumbAGProcessor::ActivateAO() - Activated"); SetActive(); @@ -1655,7 +1693,7 @@ // void CThumbAGProcessor::HandleCollectionMessage( CMPXMessage* aMessage, TInt aError ) { - if ( aError != KErrNone || !aMessage ) + if ( aError != KErrNone || !aMessage || iShutdown ) { return; } @@ -1815,6 +1853,13 @@ TInt itemsLeft = iModifyQueue.Count() + iAddQueue.Count(); TBool daemonProcessing = EFalse; + if(iShutdown) + { + RProperty::Set(KTAGDPSNotification, KDaemonProcessing, EFalse); + RProperty::Set(KTAGDPSNotification, KItemsleft, 0 ); + return; + } + if(itemsLeft + i2ndRoundGenerateQueue.Count() + iRemoveQueue.Count() > 0 ) { daemonProcessing = ETrue; diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h Mon Jun 21 16:00:46 2010 +0300 @@ -471,6 +471,11 @@ // request already canceled by client TBool iCanceled; +#ifdef __RETRY_ON_SERVERCRASH + //request retry count + TUint iRetry; +#endif + #ifdef _DEBUG TTime iStartExecTime; #endif diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -47,7 +47,11 @@ // CThumbnailManagerImpl::~CThumbnailManagerImpl() { - delete iRequestQueue; + TN_DEBUG1( "CThumbnailManagerImpl::~CThumbnailManagerImpl() - start" ); + + delete iRequestQueue; + iRequestQueue = NULL; + iSession.Close(); iFs.Close(); @@ -65,6 +69,8 @@ } delete iMimeTypeList; + + TN_DEBUG1( "CThumbnailManagerImpl::~CThumbnailManagerImpl() - end" ); } @@ -94,6 +100,7 @@ ( EOptimizeForQuality ), iRequestId( 0 ) { // No implementation required + TN_DEBUG1( "CThumbnailManagerImpl::CThumbnailManagerImpl()" ); } @@ -104,6 +111,8 @@ // void CThumbnailManagerImpl::ConstructL() { + TN_DEBUG1( "CThumbnailManagerImpl::ConstructL - start"); + User::LeaveIfError( iSession.Connect()); User::LeaveIfError( iFs.Connect()); User::LeaveIfError( iFs.ShareProtected()); @@ -129,11 +138,14 @@ { // Fbs connection was available in the beginning, no need to // increase the reference count + TN_DEBUG1( "CThumbnailManagerImpl::ConstructL - no need to update sessionCount"); } } // request processor iRequestQueue = CThumbnailRequestQueue::NewL(); + + TN_DEBUG1( "CThumbnailManagerImpl::ConstructL - end"); } diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -48,11 +48,15 @@ iTimer->Cancel(); } delete iTimer; + iTimer = NULL; ReleaseServerBitmap(); delete iCallbackThumbnail; + iCallbackThumbnail = NULL; delete iParams.iBuffer; + iParams.iBuffer = NULL; delete iBitmap; + iBitmap = NULL; iFile.Close(); iMyFileHandle.Close(); } @@ -89,6 +93,9 @@ CActive( aPriority ), iSession( aThumbnailSession ), iParamsPckg( iParams ), iObserver( aObserver ), iRequestObserver( aRequestObserver ), iFs( aFs ), iBitmapHandle( 0 ), iRequestId( aId ), iRequestQueue( aQueue ), iCanceled( EFalse ) +#ifdef __RETRY_ON_SERVERCRASH + ,iRetry(0) +#endif { CActiveScheduler::Add( this ); TN_DEBUG2( "CThumbnaiRequestActive::CThumbnailRequestActive() AO's priority = %d", Priority()); @@ -572,9 +579,24 @@ { iError = KErrNotFound; } - - TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iObserver.ThumbnailReady %d", iParams.iRequestId ); - iObserver.ThumbnailReady( iError, *iCallbackThumbnail, iParams.iRequestId ); + +#ifdef __RETRY_ON_SERVERCRASH + if(iError == KErrServerTerminated ) + { + + if(iRetry < KMaxRequestRetryCount ) + { + iRetry++; + TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - KErrServerTerminated, retry %d", iRetry); + iError = KErrNone; + TRAPD(err, StartL()); + return; + } + } +#endif + TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iObserver.ThumbnailReady %d", iParams.iRequestId ); + iObserver.ThumbnailReady( iError, *iCallbackThumbnail, iParams.iRequestId ); + } iError = KErrNone; diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailsession.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailsession.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailsession.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -31,6 +31,7 @@ RThumbnailSession::RThumbnailSession(): RSessionBase() { // No implementation required + TN_DEBUG1( "RThumbnailSession::RThumbnailSession"); } @@ -40,6 +41,8 @@ // TInt RThumbnailSession::Connect() { + TN_DEBUG1( "RThumbnailSession::Connect - start"); + StartServer(); // special case @@ -54,12 +57,16 @@ // old server still alive, wait and try again while (retry <= 10 && err != KErrNone) { + TN_DEBUG1( "RThumbnailSession::Connect - retry"); + User::After(retry * 50000); StartServer(); err = CreateSession( KThumbnailServerName, Version(), KMessageSlots ); retry++; } + TN_DEBUG1( "RThumbnailSession::Connect - end"); + return err; } @@ -71,6 +78,8 @@ // void RThumbnailSession::Close() { + TN_DEBUG1( "RThumbnailSession::Close"); + RSessionBase::Close(); } @@ -94,23 +103,29 @@ // TInt RThumbnailSession::StartServer() { + TN_DEBUG1( "RThumbnailSession::StartServer - start"); + TInt res( KErrNone ); // create server - if one of this name does not already exist TFindServer findServer( KThumbnailServerName ); TFullName name; if ( findServer.Next( name ) != KErrNone ) - // we don't exist already + // we don't exist already { + TN_DEBUG1( "RThumbnailSession::StartServer - server process doesn't exist yet"); + RProcess server; // Create the server process // KNullDesC param causes server's E32Main() to be run res = server.Create( KThumbnailServerExe, KNullDesC ); if ( res != KErrNone ) - // thread created ok - now start it going { + TN_DEBUG2( "RThumbnailSession::StartServer - error creating process: %d", res); return res; } + + TN_DEBUG1( "RThumbnailSession::StartServer - process created"); // Process created successfully TRequestStatus status; @@ -122,13 +137,18 @@ if ( status != KErrNone ) { + TN_DEBUG2( "RThumbnailSession::StartServer - status: %d, closing", status.Int() ); + server.Close(); return status.Int(); } + // Server created successfully server.Close(); // we're no longer interested in the other process - } + + TN_DEBUG1( "RThumbnailSession::StartServer - end"); + return res; } diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/thumbnailserver/group/thumbnailserver.mmp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/group/thumbnailserver.mmp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/group/thumbnailserver.mmp Mon Jun 21 16:00:46 2010 +0300 @@ -82,6 +82,7 @@ LIBRARY centralrepository.lib LIBRARY platformenv.lib LIBRARY imageconversion.lib +LIBRARY iclextjpegapi.lib LIBRARY caf.lib LIBRARY cafutils.lib LIBRARY mdeclient.lib diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h Mon Jun 21 16:00:46 2010 +0300 @@ -234,6 +234,14 @@ * @return Thumbnail provider. */ CThumbnailProvider* ResolveProviderL( const TDesC8& aMimeType ); + + /** + * Preload provider plugins + * + * @since S^3 + */ + void PreLoadProviders(); + /** * Add thumbnailtask to processor queue. @@ -538,6 +546,20 @@ */ static TInt ReconnectCallBack(TAny* aAny); + /** + * Start unmount timer + * + * @since S60 S^3 + */ + void StartUnmountTimeout( const TInt aDrive); + + /** + * Callback for unmount timer + * + * @since S60 S^3 + */ + static TInt UnmountCallBack(TAny* aAny); + private: /** @@ -690,6 +712,12 @@ // reconnect timer CPeriodic* iReconnect; + + // unmount timer + CPeriodic* iUnmount; + + // array of unmounte + RArray < TInt > iUnmountedDrives; #ifdef _DEBUG TUint32 iPlaceholderCounter; diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -96,12 +96,15 @@ if( iNotFetched.Count() < KMaxStoredEntries ) { TInt err = iNotFetched.InsertInOrder( entry, CEntry::InsertCB ); - if ( err != KErrNone ) + if ( err == KErrNone ) { - delete entry; + entry = NULL; // owned by array now } } } + + delete entry; + entry = NULL; } } } diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailscaletask.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailscaletask.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailscaletask.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -134,11 +134,15 @@ if ( !iCrop ) { + TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() - cropping OFF", this ); + // target size at max, keep aspect ratio CalculateTargetSize(); } else { + TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() - cropping ON", this ); + // exact target size, crop excess CalculateCropRectangle(); } diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -234,6 +234,9 @@ REComSession::ListImplementationsL( TUid::Uid( THUMBNAIL_PROVIDER_IF_UID ), iPluginInfoArray ); + //preload provide plugins + PreLoadProviders(); + CTMGetImei * imeiGetter = CTMGetImei::NewLC(); iImei = imeiGetter->GetIMEI(); @@ -252,10 +255,13 @@ iFormatting = EFalse; - //OpenStoresL(); + OpenStoresL(); AddUnmountObserversL(); iFetchedChecker = CThumbnailFetchedChecker::NewL(); + + // Unmount timeout timer + iUnmount = CPeriodic::NewL(CActive::EPriorityIdle); } @@ -269,6 +275,15 @@ iShutdown = ETrue; + if(iUnmount) + { + iUnmount->Cancel(); + delete iUnmount; + iUnmount = NULL; + } + + iUnmountedDrives.Close(); + delete iFetchedChecker; delete iShutdownObserver; delete iProcessor; @@ -318,9 +333,13 @@ // CThumbnailServer::HandleSessionOpened // ----------------------------------------------------------------------------- // +#ifdef _DEBUG +void CThumbnailServer::HandleSessionOpened( CMdESession& /* aSession */, TInt aError ) +#else void CThumbnailServer::HandleSessionOpened( CMdESession& /* aSession */, TInt /*aError*/ ) +#endif { - TN_DEBUG1( "CThumbnailServer::HandleSessionOpened"); + TN_DEBUG2( "CThumbnailServer::HandleSessionOpened error == %d", aError ); } // ----------------------------------------------------------------------------- @@ -444,12 +463,12 @@ if ( iSessionCount <= 0 ) { - // rename thread - User::RenameThread( KThumbnailServerShutdown ); - // server shutdown if (!iShutdown) { + // rename thread + User::RenameThread( KThumbnailServerShutdown ); + CActiveScheduler::Stop(); iShutdown = ETrue; } @@ -462,8 +481,10 @@ // void CThumbnailServer::ShutdownNotification() { + TN_DEBUG1( "CThumbnailServer::ShutdownNotification()"); if (!iShutdown) { + TN_DEBUG1( "CThumbnailServer::ShutdownNotification() shutdown"); CActiveScheduler::Stop(); iShutdown = ETrue; } @@ -775,6 +796,22 @@ // ----------------------------------------------------------------------------- +// CThumbnailServer::GetProviderL() +// ----------------------------------------------------------------------------- +// +void CThumbnailServer::PreLoadProviders( ) + { + TN_DEBUG1( "CThumbnailServer::PreLoadProvidersL()" ); + TInt err(KErrNone); + + for(TInt i=0; i< iPluginInfoArray.Count(); i++) + { + TRAP(err, GetProviderL( iPluginInfoArray[i]->ImplementationUid())); + } + } + + +// ----------------------------------------------------------------------------- // CThumbnailServer::QueueTaskL() // Adds thumbnailtask to processor queue. // ----------------------------------------------------------------------------- @@ -887,6 +924,13 @@ CThumbnailStore* CThumbnailServer::StoreForDriveL( const TInt aDrive ) { TN_DEBUG2( "CThumbnailServer::StoreForDriveL() drive=%d", aDrive ); + + if(iUnmountedDrives.Find( aDrive ) >= KErrNone) + { + TN_DEBUG1( "CThumbnailServer::StoreForDriveL() unmount in progress, skip!"); + User::Leave( KErrDisMounted ); + } + CThumbnailStore** resPtr = iStores.Find( aDrive ); CThumbnailStore* res = NULL; @@ -901,8 +945,10 @@ TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - FORMATTING! - ABORT"); User::Leave( KErrNotSupported ); } + TVolumeInfo volumeInfo; TInt err = iFs.Volume( volumeInfo, aDrive ); + if ( err || volumeInfo.iDrive.iDriveAtt& KDriveAttRom || volumeInfo.iDrive.iDriveAtt& KDriveAttRemote || volumeInfo.iDrive.iMediaAtt& KMediaAttWriteProtected || @@ -912,14 +958,14 @@ // must be read-write and not locked. User::Leave( KErrAccessDenied); } - + res = CThumbnailStore::NewL( iFs, aDrive, iImei, this ); CleanupStack::PushL( res ); iStores.InsertL( aDrive, res ); res->SetPersistentSizes(iPersistentSizes); CleanupStack::Pop( res ); - for(TInt i = 0; iStartNotify(); } @@ -1002,6 +1048,8 @@ TN_DEBUG2( "CThumbnailServer::CloseStoreForDriveL drive=%d", aDrive); CThumbnailStore** store = iStores.Find( aDrive ); + StartUnmountTimeout( aDrive); + if (store) { delete *store; @@ -1098,15 +1146,40 @@ TInt err_drive = iFs.Drive(driveInfo, drive); // mount -- if removable drive, add new store - if (!err && !err_drive && driveInfo.iDriveAtt& KDriveAttRemovable) + if (!err && !err_drive + && driveInfo.iType != EMediaNotPresent + && driveInfo.iDriveAtt& KDriveAttRemovable ) { + TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL mount drive==%d", drive); + + CThumbnailStore** resPtr = iStores.Find( drive ); + + if ( resPtr ) + { + TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() already mounted, skip %d", drive); + continue; + } + // ignore errors - //TRAP_IGNORE( StoreForDriveL( drive )); + TRAP_IGNORE( StoreForDriveL( drive )); + TInt index = iUnmountedDrives.Find( drive ); + + if(index >= KErrNone) + { + iUnmountedDrives.Remove( index ); + } + + if(!iUnmountedDrives.Count()&& iUnmount && iUnmount->IsActive()) + { + TN_DEBUG1( "CThumbnailServer::MemoryCardStatusChangedL() cancel unmount timer"); + iUnmount->Cancel(); + } } //dismount -- if removable drive, close store - else if(err && !err_drive && driveInfo.iDriveAtt& KDriveAttRemovable) + else if(err && !err_drive && driveInfo.iDriveAtt& KDriveAttRemovable ) { + TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() unmount drive==%d", drive); CloseStoreForDriveL( drive); } } @@ -1665,3 +1738,48 @@ return ETrue; } +// --------------------------------------------------------------------------- +// CThumbnailServer::StartUnmount() +// --------------------------------------------------------------------------- +// +void CThumbnailServer::StartUnmountTimeout( const TInt aDrive) + { + TN_DEBUG2( "CThumbnailServer::StartUnmountTimeout(%d)", aDrive); + + if(iUnmount ) + { + if(iUnmountedDrives.Find( aDrive ) == KErrNotFound) + { + iUnmountedDrives.Append( aDrive ); + } + + if(iUnmount->IsActive()) + { + iUnmount->Cancel(); + } + + TN_DEBUG1( "CThumbnailServer::StartUnmountTimeout() start unmount timer"); + iUnmount->Start( KUnmountTimerTimeout, KUnmountTimerTimeout, TCallBack(UnmountCallBack, this)); + } + __ASSERT_DEBUG(( iUnmount ), ThumbnailPanic( EThumbnailNullPointer )); + } + + +// --------------------------------------------------------------------------- +// CThumbnailServer::ReconnectCallBack() +// --------------------------------------------------------------------------- +// +TInt CThumbnailServer::UnmountCallBack(TAny* aAny) + { + TN_DEBUG1( "CThumbnailServer::UnmountCallBack() - unmount finished"); + + CThumbnailServer* self = static_cast( aAny ); + + self->iUnmount->Cancel(); + + self->iUnmountedDrives.Reset(); + + TN_DEBUG1( "CThumbAGDaemon::UnmountCallBack() - done"); + + return KErrNone; + } diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -444,6 +444,7 @@ const TThumbnailRequestParams& params = iRequestParams(); RFile64 file; + CleanupClosePushL(file); User::LeaveIfError( file.AdoptFromClient( aMessage, 2, 3 )); ResolveMimeTypeL(&file); @@ -461,9 +462,10 @@ if (params.iControlFlags == EThumbnailGeneratePersistentSizesOnly) { TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - EThumbnailGeneratePersistentSizesOnly" ); - CleanupClosePushL( file ); CreateGenerateTaskFromFileHandleL( &file ); - CleanupStack::Pop( &file ); + + // ownership of the file transferred + CleanupStack::Pop(&file); } // single thumbnail request else @@ -477,13 +479,16 @@ aMessage.Complete( err ); iMessage = RMessage2(); + + // close file + CleanupStack::PopAndDestroy(&file); } else if ( !err && iBitmap ) { TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - bitmap " ); // Thumbnail already stored - file.Close(); + CleanupStack::PopAndDestroy(&file); TN_DEBUG1("CThumbnailServerSession::RequestThumbByFileHandleAsyncL - file handle closed"); ProcessBitmapL(); @@ -493,6 +498,9 @@ { TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - KErrNotFound & !EDoNotCreate" ); CreateGenerateTaskFromFileHandleL( &file); + + // ownership of the file transferred + CleanupStack::Pop(&file); } else if (!err && iBuffer) { @@ -511,7 +519,9 @@ //CThumbnailDecodeTask is responsible freeing iBuffer = NULL; - file.Close(); + + // close file + CleanupStack::PopAndDestroy(&file); TN_DEBUG1("CThumbnailServerSession::RequestThumbByFileHandleAsyncL - file handle closed"); } else @@ -520,6 +530,9 @@ aMessage.Complete( ConvertSqlErrToE32Err( err )); iMessage = RMessage2(); + + // close file + CleanupStack::PopAndDestroy(&file); } } } @@ -1099,16 +1112,6 @@ { TThumbnailRequestParams& params = iRequestParams(); - // in import case store bitmap - if ( params.iTargetUri != KNullDesC && params.iFileName != KNullDesC && - params.iFileName.CompareF(params.iTargetUri) != 0 ) - { - Server()->StoreThumbnailL( params.iTargetUri, iBitmap, iOriginalSize, - params.iFlags& CThumbnailManager::ECropToAspectRatio, - params.iThumbnailSize, params.iModified, - EFalse, EFalse); - } - if ( ClientThreadAlive() ) { TN_DEBUG2("CThumbnailServerSession::ProcessBitmapL(), iBitmap handle= 0x%08x", iBitmap->Handle()); diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -44,6 +44,7 @@ const TInt KStoreUnrecoverableErr = KErrCorrupt; // Database path without drive letter +//Symbian^3 v4 _LIT( KThumbnailDatabaseName, ":[102830AB]thumbnail_v4.db" ); _LIT( KDrv, ":"); @@ -211,11 +212,6 @@ iMaintenanceTimer = NULL; } - if(!iServer->IsFormatting()) - { - FlushCacheTable( ETrue ); - } - CloseStatements(); iDatabase.Close(); @@ -570,7 +566,7 @@ stmt.Close(); - if(ret < 0) + if(rowStatus < 0) { #ifdef _DEBUG TPtrC errorMsg2 = iDatabase.LastErrorMessage(); @@ -595,7 +591,7 @@ stmt.Close(); - if(ret < 0) + if( rowStatus < 0) { #ifdef _DEBUG TPtrC errorMsg2 = iDatabase.LastErrorMessage(); @@ -647,7 +643,7 @@ stmt.Close(); - if(ret < 0 ) + if( rowStatus < 0 ) { #ifdef _DEBUG TPtrC errorMsg = iDatabase.LastErrorMessage(); @@ -698,7 +694,7 @@ stmt.Close(); - if(ret < 0 ) + if( rowStatus < 0 ) { #ifdef _DEBUG TPtrC errorMsg = iDatabase.LastErrorMessage(); @@ -1266,7 +1262,39 @@ HBufC8* data = NULL; CleanupStack::PushL( data ); - CImageEncoder* encoder = CImageEncoder::DataNewL( data, KJpegMime(), CImageEncoder::EOptionAlwaysThread ); + CImageEncoder* encoder = NULL; + TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::EHwImplementation, data, CImageEncoder::EOptionAlwaysThread ) ); + if ( decErr != KErrNone ) + { + TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - HW CExtJpegEncoder failed %d", decErr); + + TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::ESwImplementation, data, CImageEncoder::EOptionAlwaysThread ) ); + if ( decErr != KErrNone ) + { + TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - SW CExtJpegEncoder failed %d", decErr); + + TRAPD( decErr, encoder = CImageEncoder::DataNewL( data, KJpegMime(), CImageEncoder::EOptionAlwaysThread ) ); + if ( decErr != KErrNone ) + { + TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - CImageEncoder failed %d", decErr); + + User::Leave(decErr); + } + else + { + TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - CImageEncoder created" ); + } + } + else + { + TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - SW CExtJpegEncoder created" ); + } + } + else + { + TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - HW CExtJpegEncoder created" ); + } + CleanupStack::Pop( data ); CleanupStack::PushL( encoder ); diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp --- a/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -53,12 +53,15 @@ { TN_DEBUG1( "CTMActivityManager::~CTMActivityManager()"); + iObserver = NULL; + Cancel(); + #ifdef MONITOR_LIGHTS delete iLight; iLight = NULL; #endif - - Cancel(); + + iTimer.Cancel(); iTimer.Close(); } diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/tmcommon/src/tmformatobserver.cpp --- a/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmformatobserver.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmformatobserver.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -81,6 +81,7 @@ } delete iBackupSession; + iBackupSession = NULL; } // --------------------------------------------------------------------------- diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/tmcommon/src/tmshutdownobserver.cpp --- a/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmshutdownobserver.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmshutdownobserver.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -20,6 +20,7 @@ #include "tmshutdownobserver.h" #include "thumbnailmanagerconstants.h" +#include "thumbnaillog.h" // --------------------------------------------------------------------------- // CTMShutdownObserver::NewL() @@ -60,19 +61,23 @@ // void CTMShutdownObserver::ConstructL() { + TN_DEBUG1( "CTMShutdownObserver::ConstructL()" ); // define P&S property types if (iDefineKey) { + TN_DEBUG1( "CTMShutdownObserver::ConstructL() define" ); RProperty::Define(iKeyCategory,iPropertyKey, RProperty::EInt,KAllowAllPolicy,KPowerMgmtPolicy); } // attach to the property TInt err = iProperty.Attach(iKeyCategory,iPropertyKey,EOwnerThread); + TN_DEBUG2( "CTMShutdownObserver::ConstructL() attach err = %d", err ); User::LeaveIfError(err); // wait for the previously attached property to be updated iProperty.Subscribe(iStatus); + TN_DEBUG1( "CTMShutdownObserver::ConstructL() subscribe" ); SetActive(); } @@ -82,6 +87,7 @@ // CTMShutdownObserver::~CTMShutdownObserver() { + TN_DEBUG1( "CTMShutdownObserver::~CTMShutdownObserver()" ); Cancel(); iProperty.Close(); } @@ -92,13 +98,16 @@ // void CTMShutdownObserver::RunL() { + TN_DEBUG2( "CTMShutdownObserver::RunL(%d)", iStatus.Int() ); // resubscribe before processing new value to prevent missing updates iProperty.Subscribe(iStatus); SetActive(); // retrieve the value TInt value = 0; - iProperty.Get(value); + TInt err = iProperty.Get(value); + + TN_DEBUG2( "CTMShutdownObserver::RunL() Get err = %d", err ); // observer callback if (value) @@ -113,6 +122,7 @@ // void CTMShutdownObserver::DoCancel() { + TN_DEBUG1( "CTMShutdownObserver::DoCancel()" ); iProperty.Cancel(); } diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/tmiadrestart/src/tmiadrestart.cpp --- a/imagehandlingutilities/thumbnailmanager/tmiadrestart/src/tmiadrestart.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/tmiadrestart/src/tmiadrestart.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -19,12 +19,14 @@ #include #include #include +#include "thumbnaillog.h" #include "thumbnailmanagerconstants.h" LOCAL_C void MainL() { // delay so that cenrep has time to read new config + TN_DEBUG1( "MainL() after" ); User::After(5000000); TInt res( KErrNone ); @@ -32,50 +34,66 @@ TFullName name; // find and terminate Thumb AG Daemon + TN_DEBUG1( "MainL() KTAGDaemonProcess find" ); TFindProcess findProcess( KTAGDaemonProcess ); + if ( findProcess.Next(name) == KErrNone ) { res = process.Open(name); + TN_DEBUG2( "MainL() KTAGDaemonProcess open res = %d", res ); // logon to get termination signal TRequestStatus status; + TN_DEBUG1( "MainL() KTAGDaemonProcess logon" ); process.Logon(status); - + // shutdown using P&S key - RProperty::Set(KTAGDPSNotification,KShutdown,1); - + TN_DEBUG2( "MainL() KTAGDaemonProcess Set = %d", res ); + res = RProperty::Set(KTAGDPSNotification,KShutdown,1); + // blocks here until thread is terminated - User::WaitForRequest(status); + TN_DEBUG1( "MainL() KTAGDaemonProcess wait" ); + User::WaitForRequest(status); // reset key - RProperty::Set(KTAGDPSNotification,KShutdown,0); + TN_DEBUG1( "MainL() KTAGDaemonProcess reset" ); + res = RProperty::Set(KTAGDPSNotification, KShutdown, 0); + TN_DEBUG1( "MainL() KTAGDaemonProcess close" ); process.Close(); } // find and terminate Thumbnail Server TFindProcess findProcess2( KThumbnailServerProcess ); + TN_DEBUG1( "MainL() KThumbnailServerProcess find" ); if ( findProcess2.Next(name) == KErrNone ) { res = process.Open(name); - + TN_DEBUG2( "MainL() KThumbnailServerProcess open res = %d", res ); + // logon to get termination signal TRequestStatus status; + TN_DEBUG1( "MainL() KThumbnailServerProcess logon" ); process.Logon(status); // shutdown using P&S key - RProperty::Set(KTMPSNotification,KShutdown,1); + TN_DEBUG2( "MainL() KThumbnailServerProcess Set res = %d", res ); + res = RProperty::Set(KTMPSNotification,KShutdown,1); // blocks here until thread is terminated - User::WaitForRequest(status); + TN_DEBUG1( "MainL() KThumbnailServerProcess wait" ); + User::WaitForRequest(status); // reset key - RProperty::Set(KTMPSNotification,KShutdown,0); - + TN_DEBUG2( "MainL() KThumbnailServerProcess reset res = %d", res ); + res = RProperty::Set(KTMPSNotification, KShutdown, 0); + + TN_DEBUG1( "MainL() KThumbnailServerProcess close" ); process.Close(); } // delay just in case old daemon hasn't died yet + TN_DEBUG1( "MainL() after" ); User::After(2500000); // start new ThumbAGDaemon @@ -84,29 +102,38 @@ // Create the server process // KNullDesC param causes server's E32Main() to be run + TN_DEBUG2( "MainL() KTAGDaemonExe create res = %d", res ); res = server.Create( KTAGDaemonExe, KNullDesC ); // try again 3 times if fails while ( res != KErrNone) { + TN_DEBUG1( "MainL() KTAGDaemonExe retry" ); if (retryCount > 2) { + TN_DEBUG1( "MainL() KTAGDaemonExe retry > 2" ); return; } + TN_DEBUG1( "MainL() after" ); User::After(2500000); + TN_DEBUG2( "MainL() KTAGDaemonExe create res = %d", res ); res = server.Create( KTAGDaemonExe, KNullDesC ); - retryCount++; } // Process created successfully TRequestStatus status; + TN_DEBUG1( "MainL() Rendezvous" ); server.Rendezvous( status ); + TN_DEBUG1( "MainL() Resume" ); server.Resume(); // start it going + // Wait until the completion of the server creation + TN_DEBUG1( "MainL() wait" ); User::WaitForRequest( status ); + TN_DEBUG1( "MainL() wait done" ); // Server created successfully server.Close(); // we're no longer interested in the other process