graphicscomposition/openwfsupport/src/streammap.cpp
branchRCL_3
changeset 164 25ffed67c7ef
parent 163 bbf46f59e123
--- a/graphicscomposition/openwfsupport/src/streammap.cpp	Tue Aug 31 16:31:06 2010 +0300
+++ b/graphicscomposition/openwfsupport/src/streammap.cpp	Wed Sep 01 12:39:21 2010 +0100
@@ -17,7 +17,6 @@
 
 #include "streammap.h"
 #include <graphics/updateserverprovider.h>
-#include <graphics/surfacemanager.h>
 #include <e32property.h>
 #include <e32std.h>
 #include <e32cmn.h>
@@ -27,6 +26,20 @@
 
 static const TInt KOpenWfcInteropCleanupKey = 0x10286FC5;
 
+TEMPLATE_SPECIALIZATION class RHashTableBase::Defaults<TSurfaceId, RHashTableBase::EDefaultSpecifier_Normal>
+	{
+public:
+	inline static TGeneralHashFunction32 Hash();
+	inline static TGeneralIdentityRelation Id();
+	};
+
+inline TGeneralHashFunction32 RHashTableBase::Defaults<TSurfaceId, RHashTableBase::EDefaultSpecifier_Normal>::Hash()
+	{return (TGeneralHashFunction32)&DefaultHash::Integer;}
+
+inline TGeneralIdentityRelation RHashTableBase::Defaults<TSurfaceId, RHashTableBase::EDefaultSpecifier_Normal>::Id()
+	{return (TGeneralIdentityRelation)&DefaultIdentity::Integer;}
+
+
 COpenWfcStreamMap* COpenWfcStreamMap::pInstance = NULL;
 
 TUint32 COpenWfcStreamMap::HashFunction(const TSurfaceId& aHashKey)
@@ -52,6 +65,13 @@
 	return *pInstance;
 	}
 
+EXPORT_C TInt COpenWfcStreamMap::Reserve(TInt aExpand)
+	{
+	Guard g(iMutex);
+	TInt ret = iMap.Reserve(aExpand);
+	return ret;
+	}
+
 CSurfaceStream* COpenWfcStreamMap::Find(const TSurfaceId& aSurfaceId)
 	{
 	Guard g(iMutex);
@@ -97,10 +117,9 @@
 	return count;
 	}
 
-EXPORT_C RSurfaceManager& COpenWfcStreamMap::SurfaceManager()
+RSurfaceManager& COpenWfcStreamMap::SurfaceManager()
 	{
-    WFCI_ASSERT_DEBUG(iSurfaceManager, EOwfPanicInvalidHasMap);
-	return *iSurfaceManager;
+	return iSurfaceManager;
 	}
 
 TInt COpenWfcStreamMap::LockDestroy(CSurfaceStream* aStream)
@@ -138,7 +157,6 @@
 
 COpenWfcStreamMap::COpenWfcStreamMap():
 iMap(THashFunction32<TSurfaceId>(COpenWfcStreamMap::HashFunction), TIdentityRelation<TSurfaceId>()),
-iSurfaceManager(NULL),
 iRegisteredUpdaters()
 	{
 	}
@@ -175,7 +193,7 @@
         CSurfaceStream* const* ns = NULL;
         while (nextKey)
             {
-            ns = iter.CurrentValue();
+            ns = iter.NextValue();
             if (ns && *ns)
                 {
                 delete (*ns);
@@ -184,12 +202,7 @@
             }
         }
 	iMap.Close();
-    if (iSurfaceManager)
-        {
-        iSurfaceManager->Close();
-        delete iSurfaceManager;
-        iSurfaceManager = NULL;
-        }
+	iSurfaceManager.Close();
 	iMutex.Signal();
 	iMutex.Close();
 	
@@ -199,7 +212,7 @@
         CExtensionContainer* const* extensionContainer = NULL;
         while (nextKey)
             {
-            extensionContainer = iter.CurrentValue();
+            extensionContainer = iter.NextValue();
             if (extensionContainer && *extensionContainer)
                 {
                 delete (*extensionContainer);
@@ -210,6 +223,17 @@
 	iRegisteredUpdaters.Close();
 	}
 
+COpenWfcStreamMap::COpenWfcStreamMap(const COpenWfcStreamMap&)
+	{
+	Panic(EOwfPanicInvalidCallStreamMap);
+	}
+
+COpenWfcStreamMap& COpenWfcStreamMap::operator= (const COpenWfcStreamMap&)
+	{
+	Panic(EOwfPanicInvalidCallStreamMap);
+	return *this;
+	}
+
 void COpenWfcStreamMap::ConstructL()
 	{
 	User::LeaveIfError(iMutex.CreateLocal());
@@ -217,8 +241,7 @@
 	TSurfaceId surface = TSurfaceId::CreateNullId();
 	User::LeaveIfError(iMap.Insert(surface, NULL));
 
-	iSurfaceManager = new(ELeave) RSurfaceManager();
-	User::LeaveIfError(iSurfaceManager->Open());
+	User::LeaveIfError(iSurfaceManager.Open());
 	RProcess process;
 	TUidType uidType = process.Type();
 	const TInt32 KWservUid = 268450592;