graphicscomposition/openwfsupport/src/streammap.cpp
changeset 98 bf7481649c98
parent 0 5d03bc08d59c
child 121 d72fc2aace31
equal deleted inserted replaced
85:cdf2f6e5c390 98:bf7481649c98
    15 // 
    15 // 
    16 //
    16 //
    17 
    17 
    18 #include "streammap.h"
    18 #include "streammap.h"
    19 #include <graphics/updateserverprovider.h>
    19 #include <graphics/updateserverprovider.h>
       
    20 #include <graphics/surfacemanager.h>
    20 #include <e32property.h>
    21 #include <e32property.h>
    21 #include <e32std.h>
    22 #include <e32std.h>
    22 #include <e32cmn.h>
    23 #include <e32cmn.h>
    23 #include "openwfcpanic.h"
    24 #include "openwfcpanic.h"
    24 #include "surfacestream.h"
    25 #include "surfacestream.h"
   117 	return count;
   118 	return count;
   118 	}
   119 	}
   119 
   120 
   120 RSurfaceManager& COpenWfcStreamMap::SurfaceManager()
   121 RSurfaceManager& COpenWfcStreamMap::SurfaceManager()
   121 	{
   122 	{
   122 	return iSurfaceManager;
   123     WFCI_ASSERT_DEBUG(iSurfaceManager, EOwfPanicInvalidHasMap);
       
   124 	return *iSurfaceManager;
   123 	}
   125 	}
   124 
   126 
   125 TInt COpenWfcStreamMap::LockDestroy(CSurfaceStream* aStream)
   127 TInt COpenWfcStreamMap::LockDestroy(CSurfaceStream* aStream)
   126 	{
   128 	{
   127 	Guard g(iMutex);
   129 	Guard g(iMutex);
   155 	return ret;
   157 	return ret;
   156 	}
   158 	}
   157 
   159 
   158 COpenWfcStreamMap::COpenWfcStreamMap():
   160 COpenWfcStreamMap::COpenWfcStreamMap():
   159 iMap(THashFunction32<TSurfaceId>(COpenWfcStreamMap::HashFunction), TIdentityRelation<TSurfaceId>()),
   161 iMap(THashFunction32<TSurfaceId>(COpenWfcStreamMap::HashFunction), TIdentityRelation<TSurfaceId>()),
       
   162 iSurfaceManager(NULL),
   160 iRegisteredUpdaters()
   163 iRegisteredUpdaters()
   161 	{
   164 	{
   162 	}
   165 	}
   163 
   166 
   164 TInt COpenWfcStreamMap::DeleteSingleton(TAny* aData)
   167 TInt COpenWfcStreamMap::DeleteSingleton(TAny* aData)
   200                 }
   203                 }
   201             nextKey = iter.NextKey();		
   204             nextKey = iter.NextKey();		
   202             }
   205             }
   203         }
   206         }
   204 	iMap.Close();
   207 	iMap.Close();
   205 	iSurfaceManager.Close();
   208     if (iSurfaceManager)
       
   209         {
       
   210         iSurfaceManager->Close();
       
   211         delete iSurfaceManager;
       
   212         iSurfaceManager = NULL;
       
   213         }
   206 	iMutex.Signal();
   214 	iMutex.Signal();
   207 	iMutex.Close();
   215 	iMutex.Close();
   208 	
   216 	
   209         {
   217         {
   210         THashMapIter<TInt32, CExtensionContainer*> iter(iRegisteredUpdaters);
   218         THashMapIter<TInt32, CExtensionContainer*> iter(iRegisteredUpdaters);
   239 	User::LeaveIfError(iMutex.CreateLocal());
   247 	User::LeaveIfError(iMutex.CreateLocal());
   240 	iMap.Reserve(iInitialSize);
   248 	iMap.Reserve(iInitialSize);
   241 	TSurfaceId surface = TSurfaceId::CreateNullId();
   249 	TSurfaceId surface = TSurfaceId::CreateNullId();
   242 	User::LeaveIfError(iMap.Insert(surface, NULL));
   250 	User::LeaveIfError(iMap.Insert(surface, NULL));
   243 
   251 
   244 	User::LeaveIfError(iSurfaceManager.Open());
   252 	iSurfaceManager = new(ELeave) RSurfaceManager();
       
   253 	User::LeaveIfError(iSurfaceManager->Open());
   245 	RProcess process;
   254 	RProcess process;
   246 	TUidType uidType = process.Type();
   255 	TUidType uidType = process.Type();
   247 	const TInt32 KWservUid = 268450592;
   256 	const TInt32 KWservUid = 268450592;
   248 	const TUid& uid1 = uidType[2];
   257 	const TUid& uid1 = uidType[2];
   249 
   258