graphicscomposition/openwfsupport/src/streammap.cpp
changeset 152 9f1c3fea0f87
parent 98 bf7481649c98
equal deleted inserted replaced
111:29ddb8a72f0e 152:9f1c3fea0f87
    25 #include "surfacestream.h"
    25 #include "surfacestream.h"
    26 #include "contentupdateproxy.h"
    26 #include "contentupdateproxy.h"
    27 
    27 
    28 static const TInt KOpenWfcInteropCleanupKey = 0x10286FC5;
    28 static const TInt KOpenWfcInteropCleanupKey = 0x10286FC5;
    29 
    29 
    30 TEMPLATE_SPECIALIZATION class RHashTableBase::Defaults<TSurfaceId, RHashTableBase::EDefaultSpecifier_Normal>
       
    31 	{
       
    32 public:
       
    33 	inline static TGeneralHashFunction32 Hash();
       
    34 	inline static TGeneralIdentityRelation Id();
       
    35 	};
       
    36 
       
    37 inline TGeneralHashFunction32 RHashTableBase::Defaults<TSurfaceId, RHashTableBase::EDefaultSpecifier_Normal>::Hash()
       
    38 	{return (TGeneralHashFunction32)&DefaultHash::Integer;}
       
    39 
       
    40 inline TGeneralIdentityRelation RHashTableBase::Defaults<TSurfaceId, RHashTableBase::EDefaultSpecifier_Normal>::Id()
       
    41 	{return (TGeneralIdentityRelation)&DefaultIdentity::Integer;}
       
    42 
       
    43 
       
    44 COpenWfcStreamMap* COpenWfcStreamMap::pInstance = NULL;
    30 COpenWfcStreamMap* COpenWfcStreamMap::pInstance = NULL;
    45 
    31 
    46 TUint32 COpenWfcStreamMap::HashFunction(const TSurfaceId& aHashKey)
    32 TUint32 COpenWfcStreamMap::HashFunction(const TSurfaceId& aHashKey)
    47 	{
    33 	{
    48 	TPckgC<TSurfaceId> pckg(aHashKey);
    34 	TPckgC<TSurfaceId> pckg(aHashKey);
    64 		pInstance=newInstance;
    50 		pInstance=newInstance;
    65 		}
    51 		}
    66 	return *pInstance;
    52 	return *pInstance;
    67 	}
    53 	}
    68 
    54 
    69 EXPORT_C TInt COpenWfcStreamMap::Reserve(TInt aExpand)
       
    70 	{
       
    71 	Guard g(iMutex);
       
    72 	TInt ret = iMap.Reserve(aExpand);
       
    73 	return ret;
       
    74 	}
       
    75 
       
    76 CSurfaceStream* COpenWfcStreamMap::Find(const TSurfaceId& aSurfaceId)
    55 CSurfaceStream* COpenWfcStreamMap::Find(const TSurfaceId& aSurfaceId)
    77 	{
    56 	{
    78 	Guard g(iMutex);
    57 	Guard g(iMutex);
    79 	CSurfaceStream** ns = iMap.Find(aSurfaceId);
    58 	CSurfaceStream** ns = iMap.Find(aSurfaceId);
    80 	// used if statement to ease debug help
    59 	// used if statement to ease debug help
   116 	Guard g(iMutex);
    95 	Guard g(iMutex);
   117 	TInt count = iMap.Count();
    96 	TInt count = iMap.Count();
   118 	return count;
    97 	return count;
   119 	}
    98 	}
   120 
    99 
   121 RSurfaceManager& COpenWfcStreamMap::SurfaceManager()
   100 EXPORT_C RSurfaceManager& COpenWfcStreamMap::SurfaceManager()
   122 	{
   101 	{
   123     WFCI_ASSERT_DEBUG(iSurfaceManager, EOwfPanicInvalidHasMap);
   102     WFCI_ASSERT_DEBUG(iSurfaceManager, EOwfPanicInvalidHasMap);
   124 	return *iSurfaceManager;
   103 	return *iSurfaceManager;
   125 	}
   104 	}
   126 
   105 
   194         THashMapIter<TSurfaceId, CSurfaceStream*> iter(iMap);
   173         THashMapIter<TSurfaceId, CSurfaceStream*> iter(iMap);
   195         const TSurfaceId* nextKey = iter.NextKey();
   174         const TSurfaceId* nextKey = iter.NextKey();
   196         CSurfaceStream* const* ns = NULL;
   175         CSurfaceStream* const* ns = NULL;
   197         while (nextKey)
   176         while (nextKey)
   198             {
   177             {
   199             ns = iter.NextValue();
   178             ns = iter.CurrentValue();
   200             if (ns && *ns)
   179             if (ns && *ns)
   201                 {
   180                 {
   202                 delete (*ns);
   181                 delete (*ns);
   203                 }
   182                 }
   204             nextKey = iter.NextKey();		
   183             nextKey = iter.NextKey();		
   218         THashMapIter<TInt32, CExtensionContainer*> iter(iRegisteredUpdaters);
   197         THashMapIter<TInt32, CExtensionContainer*> iter(iRegisteredUpdaters);
   219         const TInt32* nextKey = iter.NextKey();
   198         const TInt32* nextKey = iter.NextKey();
   220         CExtensionContainer* const* extensionContainer = NULL;
   199         CExtensionContainer* const* extensionContainer = NULL;
   221         while (nextKey)
   200         while (nextKey)
   222             {
   201             {
   223             extensionContainer = iter.NextValue();
   202             extensionContainer = iter.CurrentValue();
   224             if (extensionContainer && *extensionContainer)
   203             if (extensionContainer && *extensionContainer)
   225                 {
   204                 {
   226                 delete (*extensionContainer);
   205                 delete (*extensionContainer);
   227                 }
   206                 }
   228             nextKey = iter.NextKey();       
   207             nextKey = iter.NextKey();       
   229             }
   208             }
   230         }
   209         }
   231 	iRegisteredUpdaters.Close();
   210 	iRegisteredUpdaters.Close();
   232 	}
       
   233 
       
   234 COpenWfcStreamMap::COpenWfcStreamMap(const COpenWfcStreamMap&)
       
   235 	{
       
   236 	Panic(EOwfPanicInvalidCallStreamMap);
       
   237 	}
       
   238 
       
   239 COpenWfcStreamMap& COpenWfcStreamMap::operator= (const COpenWfcStreamMap&)
       
   240 	{
       
   241 	Panic(EOwfPanicInvalidCallStreamMap);
       
   242 	return *this;
       
   243 	}
   211 	}
   244 
   212 
   245 void COpenWfcStreamMap::ConstructL()
   213 void COpenWfcStreamMap::ConstructL()
   246 	{
   214 	{
   247 	User::LeaveIfError(iMutex.CreateLocal());
   215 	User::LeaveIfError(iMutex.CreateLocal());