homescreenpluginsrv/hspsmanager/src/hspsthemeserver.cpp
branchRCL_3
changeset 18 bd874ee5e5e2
parent 9 d0529222e3f0
child 19 502e5d91ad42
--- a/homescreenpluginsrv/hspsmanager/src/hspsthemeserver.cpp	Fri Feb 19 23:07:29 2010 +0200
+++ b/homescreenpluginsrv/hspsmanager/src/hspsthemeserver.cpp	Fri Mar 12 15:43:54 2010 +0200
@@ -19,6 +19,7 @@
 #define __INCLUDE_CAPABILITY_NAMES__
 
 // INCLUDE FILES
+#include <mw/memorymanager.h>
 #include <centralrepository.h>
 #include <f32file.h>
 #include <bautils.h>
@@ -179,6 +180,8 @@
 //
 TInt E32Main()
     {
+    RAllocator* iAllocator = MemoryManager::SwitchToFastAllocator();
+    
     __UHEAP_MARK;
     CTrapCleanup* cleanup=CTrapCleanup::New();
     TInt r=KErrNoMemory;
@@ -188,6 +191,9 @@
         delete cleanup;
         }
     __UHEAP_MARKEND;
+    
+    MemoryManager::CloseFastAllocator(iAllocator);
+    
     return r;
     }
     
@@ -398,6 +404,8 @@
     delete iLogBus;
     iLogBus = NULL;
 #endif    
+    
+    iSessions.Reset();
     }
 
 #ifdef _hsps_SERVER_SHUTDOWN_ENABLED_
@@ -489,9 +497,14 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void ChspsThemeServer::AddSession()
+void ChspsThemeServer::AddSession( ChspsThemeServerSession* aSession )
     {
-    iSessionCount++;
+    if( aSession == NULL )
+        {
+        return;
+        }
+    
+    iSessions.Append( aSession );    
 
 #ifdef _hsps_SERVER_SHUTDOWN_ENABLED_    
     if( iShutdown->IsActive() )
@@ -513,12 +526,16 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void ChspsThemeServer::DropSession()
+void ChspsThemeServer::DropSession( ChspsThemeServerSession* aSession )
     {
-    iSessionCount--;
+    const TInt index = iSessions.Find( aSession );
+    if( index != KErrNotFound )
+        {
+        iSessions.Remove( index );
+        }
     
 #ifdef _hsps_SERVER_SHUTDOWN_ENABLED_    
-    if( iSessionCount == 0 )
+    if( iSessions.Count() == 0 )
         {
         iShutdown->Cancel();
         iShutdown->Start();
@@ -577,7 +594,20 @@
 #ifdef HSPS_LOG_ACTIVE
     iLogBus->LogText( _L( "--------------------------------------------------------" ) );
 #endif        
-            
+
+    if( aRepositoryInfo.iEventType & EhspsODTUpdated ||
+        aRepositoryInfo.iEventType & EhspsODTModified ||
+        aRepositoryInfo.iEventType & EhspsPluginReplaced )
+        {
+        for( TInt i = 0; i < iSessions.Count(); i++ )
+            {
+            if( iSessions[i]->AppUid() == aRepositoryInfo.iAppUid )
+                {
+                iSessions[i]->SetResourceFileCopyRequired( ETrue );
+                }
+            }        
+        }    
+    
     // If header cache should be updated from files in the Plug-in Repository
     if (mask & EhspsCacheUpdate)
         {
@@ -3371,6 +3401,16 @@
             {
             // Invalid configuration
             state.Set( KConfStateError );
+            // Delete related resource files
+            const TInt count = aOdt.ResourceCount();
+            for( TInt j( 0 ); j < count; j++ )
+                {
+                ChspsResource& resource = aOdt.ResourceL( j );
+                if( resource.ConfigurationUid() == uids[ i ] )
+                    {
+                    aOdt.DeleteResourceL( j );
+                    }
+                }
             }
         else if ( state.CompareF( KConfStateError ) != 0 )
             {