harvester/server/src/harvesterao.cpp
branchRCL_3
changeset 8 50de4d668bb6
parent 7 3cebc1a84278
child 9 82c0024438c8
--- a/harvester/server/src/harvesterao.cpp	Mon Mar 15 12:42:24 2010 +0200
+++ b/harvester/server/src/harvesterao.cpp	Wed Mar 31 22:19:07 2010 +0300
@@ -233,11 +233,14 @@
 
 	User::LeaveIfError( iFs.Connect() );
 
+	// Pump up priority for getting the MDE session up as fast as possible for other
+	// initialization to continue
+    RProcess process;
+    process.SetPriority( EPriorityForeground );
+    process.Close();
+	
     // Setting up MdE Session
 	iMdESession = CMdESession::NewL( *this );
- 	
-    // Setting up context Engine (initialization is ready when ContextInitializationStatus -callback is called)
-    iCtxEngine = CContextEngine::GetInstanceL( this ); // Create the context engine
 
     iBackupSubscriber = CBackupSubscriber::NewL( *this );
 	
@@ -1259,6 +1262,12 @@
 void CHarvesterAO::HandleSessionOpened( CMdESession& aSession, TInt aError )
     {
     WRITELOG( "HarvesterThread::HandleSessionOpened()" );
+    
+    // Revert back to default Harvester process priority when MDE Session is up and running
+    RProcess process;
+    process.SetPriority( EPriorityBackground );
+    process.Close();
+    
     if ( KErrNone == aError )
         {
         TBool isTNMDaemonEnabled( EFalse );
@@ -1279,6 +1288,13 @@
             WRITELOG( "CHarvesterAO::HandleSessionOpened() - error creating mde harvester session" );
         	}
 
+        // Setting up context Engine (initialization is ready when ContextInitializationStatus -callback is called)
+        TRAP( errorTrap, iCtxEngine = CContextEngine::GetInstanceL( this ) ); // Create the context engine 
+        if ( errorTrap != KErrNone )
+                {
+                WRITELOG( "CHarvesterAO::HandleSessionOpened() - Context Engine creation failed" );
+                }
+        
 #ifdef _DEBUG        
         TRAP( errorTrap, iMdeObjectHandler = CMdeObjectHandler::NewL( *iMdESession ) );
         if ( errorTrap != KErrNone )
@@ -1314,11 +1330,6 @@
         TRAP_IGNORE( StartComposersL() );        
 #endif
 
-        if ( iContextEngineInitialized )
-            {
-            iCtxEngine->SetMdeSession( iMdESession );
-            }
-
             // Starting monitor plugins
         StartMonitoring();