harvester/server/src/harvesterao.cpp
branchRCL_3
changeset 8 50de4d668bb6
parent 7 3cebc1a84278
child 9 82c0024438c8
equal deleted inserted replaced
7:3cebc1a84278 8:50de4d668bb6
   231     
   231     
   232     CActiveScheduler::Add( this );
   232     CActiveScheduler::Add( this );
   233 
   233 
   234 	User::LeaveIfError( iFs.Connect() );
   234 	User::LeaveIfError( iFs.Connect() );
   235 
   235 
       
   236 	// Pump up priority for getting the MDE session up as fast as possible for other
       
   237 	// initialization to continue
       
   238     RProcess process;
       
   239     process.SetPriority( EPriorityForeground );
       
   240     process.Close();
       
   241 	
   236     // Setting up MdE Session
   242     // Setting up MdE Session
   237 	iMdESession = CMdESession::NewL( *this );
   243 	iMdESession = CMdESession::NewL( *this );
   238  	
       
   239     // Setting up context Engine (initialization is ready when ContextInitializationStatus -callback is called)
       
   240     iCtxEngine = CContextEngine::GetInstanceL( this ); // Create the context engine
       
   241 
   244 
   242     iBackupSubscriber = CBackupSubscriber::NewL( *this );
   245     iBackupSubscriber = CBackupSubscriber::NewL( *this );
   243 	
   246 	
   244 	iUnmountHandlerAO = CUnmountHandlerAO::NewL( *this );
   247 	iUnmountHandlerAO = CUnmountHandlerAO::NewL( *this );
   245 	iUnmountHandlerAO->WaitForUnmountL();
   248 	iUnmountHandlerAO->WaitForUnmountL();
  1257 // ---------------------------------------------------------------------------
  1260 // ---------------------------------------------------------------------------
  1258 //
  1261 //
  1259 void CHarvesterAO::HandleSessionOpened( CMdESession& aSession, TInt aError )
  1262 void CHarvesterAO::HandleSessionOpened( CMdESession& aSession, TInt aError )
  1260     {
  1263     {
  1261     WRITELOG( "HarvesterThread::HandleSessionOpened()" );
  1264     WRITELOG( "HarvesterThread::HandleSessionOpened()" );
       
  1265     
       
  1266     // Revert back to default Harvester process priority when MDE Session is up and running
       
  1267     RProcess process;
       
  1268     process.SetPriority( EPriorityBackground );
       
  1269     process.Close();
       
  1270     
  1262     if ( KErrNone == aError )
  1271     if ( KErrNone == aError )
  1263         {
  1272         {
  1264         TBool isTNMDaemonEnabled( EFalse );
  1273         TBool isTNMDaemonEnabled( EFalse );
  1265         TRAP_IGNORE( CHarvesterCenRepUtil::IsThumbnailDaemonEnabledL( isTNMDaemonEnabled ) );
  1274         TRAP_IGNORE( CHarvesterCenRepUtil::IsThumbnailDaemonEnabledL( isTNMDaemonEnabled ) );
  1266 
  1275 
  1277         else
  1286         else
  1278         	{
  1287         	{
  1279             WRITELOG( "CHarvesterAO::HandleSessionOpened() - error creating mde harvester session" );
  1288             WRITELOG( "CHarvesterAO::HandleSessionOpened() - error creating mde harvester session" );
  1280         	}
  1289         	}
  1281 
  1290 
       
  1291         // Setting up context Engine (initialization is ready when ContextInitializationStatus -callback is called)
       
  1292         TRAP( errorTrap, iCtxEngine = CContextEngine::GetInstanceL( this ) ); // Create the context engine 
       
  1293         if ( errorTrap != KErrNone )
       
  1294                 {
       
  1295                 WRITELOG( "CHarvesterAO::HandleSessionOpened() - Context Engine creation failed" );
       
  1296                 }
       
  1297         
  1282 #ifdef _DEBUG        
  1298 #ifdef _DEBUG        
  1283         TRAP( errorTrap, iMdeObjectHandler = CMdeObjectHandler::NewL( *iMdESession ) );
  1299         TRAP( errorTrap, iMdeObjectHandler = CMdeObjectHandler::NewL( *iMdESession ) );
  1284         if ( errorTrap != KErrNone )
  1300         if ( errorTrap != KErrNone )
  1285                 {
  1301                 {
  1286                 WRITELOG( "CHarvesterAO::HandleSessionOpened() - ObjectHandler creation failed" );
  1302                 WRITELOG( "CHarvesterAO::HandleSessionOpened() - ObjectHandler creation failed" );
  1311         TRAP_IGNORE( iMdeObjectHandler = CMdeObjectHandler::NewL( *iMdESession ) );
  1327         TRAP_IGNORE( iMdeObjectHandler = CMdeObjectHandler::NewL( *iMdESession ) );
  1312         TRAP_IGNORE( PreallocateNamespaceL( aSession.GetDefaultNamespaceDefL() ) );
  1328         TRAP_IGNORE( PreallocateNamespaceL( aSession.GetDefaultNamespaceDefL() ) );
  1313         TRAP_IGNORE( LoadMonitorPluginsL() );
  1329         TRAP_IGNORE( LoadMonitorPluginsL() );
  1314         TRAP_IGNORE( StartComposersL() );        
  1330         TRAP_IGNORE( StartComposersL() );        
  1315 #endif
  1331 #endif
  1316 
       
  1317         if ( iContextEngineInitialized )
       
  1318             {
       
  1319             iCtxEngine->SetMdeSession( iMdESession );
       
  1320             }
       
  1321 
  1332 
  1322             // Starting monitor plugins
  1333             // Starting monitor plugins
  1323         StartMonitoring();
  1334         StartMonitoring();
  1324 
  1335 
  1325         TRAP( errorTrap, iDiskFullNotifier = CMdSHarvesterDiskspaceObserverAO::NewL( *this, KDiskFullThreshold, KMdsSqlDbDefaultName ) );
  1336         TRAP( errorTrap, iDiskFullNotifier = CMdSHarvesterDiskspaceObserverAO::NewL( *this, KDiskFullThreshold, KMdsSqlDbDefaultName ) );