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> |
|
21 #include <e32property.h> |
20 #include <e32property.h> |
22 #include <e32std.h> |
21 #include <e32std.h> |
23 #include <e32cmn.h> |
22 #include <e32cmn.h> |
24 #include "openwfcpanic.h" |
23 #include "openwfcpanic.h" |
25 #include "surfacestream.h" |
24 #include "surfacestream.h" |
26 #include "contentupdateproxy.h" |
25 #include "contentupdateproxy.h" |
27 |
26 |
28 static const TInt KOpenWfcInteropCleanupKey = 0x10286FC5; |
27 static const TInt KOpenWfcInteropCleanupKey = 0x10286FC5; |
29 |
28 |
|
29 TEMPLATE_SPECIALIZATION class RHashTableBase::Defaults<TSurfaceId, RHashTableBase::EDefaultSpecifier_Normal> |
|
30 { |
|
31 public: |
|
32 inline static TGeneralHashFunction32 Hash(); |
|
33 inline static TGeneralIdentityRelation Id(); |
|
34 }; |
|
35 |
|
36 inline TGeneralHashFunction32 RHashTableBase::Defaults<TSurfaceId, RHashTableBase::EDefaultSpecifier_Normal>::Hash() |
|
37 {return (TGeneralHashFunction32)&DefaultHash::Integer;} |
|
38 |
|
39 inline TGeneralIdentityRelation RHashTableBase::Defaults<TSurfaceId, RHashTableBase::EDefaultSpecifier_Normal>::Id() |
|
40 {return (TGeneralIdentityRelation)&DefaultIdentity::Integer;} |
|
41 |
|
42 |
30 COpenWfcStreamMap* COpenWfcStreamMap::pInstance = NULL; |
43 COpenWfcStreamMap* COpenWfcStreamMap::pInstance = NULL; |
31 |
44 |
32 TUint32 COpenWfcStreamMap::HashFunction(const TSurfaceId& aHashKey) |
45 TUint32 COpenWfcStreamMap::HashFunction(const TSurfaceId& aHashKey) |
33 { |
46 { |
34 TPckgC<TSurfaceId> pckg(aHashKey); |
47 TPckgC<TSurfaceId> pckg(aHashKey); |
136 return ret; |
155 return ret; |
137 } |
156 } |
138 |
157 |
139 COpenWfcStreamMap::COpenWfcStreamMap(): |
158 COpenWfcStreamMap::COpenWfcStreamMap(): |
140 iMap(THashFunction32<TSurfaceId>(COpenWfcStreamMap::HashFunction), TIdentityRelation<TSurfaceId>()), |
159 iMap(THashFunction32<TSurfaceId>(COpenWfcStreamMap::HashFunction), TIdentityRelation<TSurfaceId>()), |
141 iSurfaceManager(NULL), |
|
142 iRegisteredUpdaters() |
160 iRegisteredUpdaters() |
143 { |
161 { |
144 } |
162 } |
145 |
163 |
146 TInt COpenWfcStreamMap::DeleteSingleton(TAny* aData) |
164 TInt COpenWfcStreamMap::DeleteSingleton(TAny* aData) |
173 THashMapIter<TSurfaceId, CSurfaceStream*> iter(iMap); |
191 THashMapIter<TSurfaceId, CSurfaceStream*> iter(iMap); |
174 const TSurfaceId* nextKey = iter.NextKey(); |
192 const TSurfaceId* nextKey = iter.NextKey(); |
175 CSurfaceStream* const* ns = NULL; |
193 CSurfaceStream* const* ns = NULL; |
176 while (nextKey) |
194 while (nextKey) |
177 { |
195 { |
178 ns = iter.CurrentValue(); |
196 ns = iter.NextValue(); |
179 if (ns && *ns) |
197 if (ns && *ns) |
180 { |
198 { |
181 delete (*ns); |
199 delete (*ns); |
182 } |
200 } |
183 nextKey = iter.NextKey(); |
201 nextKey = iter.NextKey(); |
184 } |
202 } |
185 } |
203 } |
186 iMap.Close(); |
204 iMap.Close(); |
187 if (iSurfaceManager) |
205 iSurfaceManager.Close(); |
188 { |
|
189 iSurfaceManager->Close(); |
|
190 delete iSurfaceManager; |
|
191 iSurfaceManager = NULL; |
|
192 } |
|
193 iMutex.Signal(); |
206 iMutex.Signal(); |
194 iMutex.Close(); |
207 iMutex.Close(); |
195 |
208 |
196 { |
209 { |
197 THashMapIter<TInt32, CExtensionContainer*> iter(iRegisteredUpdaters); |
210 THashMapIter<TInt32, CExtensionContainer*> iter(iRegisteredUpdaters); |
198 const TInt32* nextKey = iter.NextKey(); |
211 const TInt32* nextKey = iter.NextKey(); |
199 CExtensionContainer* const* extensionContainer = NULL; |
212 CExtensionContainer* const* extensionContainer = NULL; |
200 while (nextKey) |
213 while (nextKey) |
201 { |
214 { |
202 extensionContainer = iter.CurrentValue(); |
215 extensionContainer = iter.NextValue(); |
203 if (extensionContainer && *extensionContainer) |
216 if (extensionContainer && *extensionContainer) |
204 { |
217 { |
205 delete (*extensionContainer); |
218 delete (*extensionContainer); |
206 } |
219 } |
207 nextKey = iter.NextKey(); |
220 nextKey = iter.NextKey(); |
208 } |
221 } |
209 } |
222 } |
210 iRegisteredUpdaters.Close(); |
223 iRegisteredUpdaters.Close(); |
211 } |
224 } |
212 |
225 |
|
226 COpenWfcStreamMap::COpenWfcStreamMap(const COpenWfcStreamMap&) |
|
227 { |
|
228 Panic(EOwfPanicInvalidCallStreamMap); |
|
229 } |
|
230 |
|
231 COpenWfcStreamMap& COpenWfcStreamMap::operator= (const COpenWfcStreamMap&) |
|
232 { |
|
233 Panic(EOwfPanicInvalidCallStreamMap); |
|
234 return *this; |
|
235 } |
|
236 |
213 void COpenWfcStreamMap::ConstructL() |
237 void COpenWfcStreamMap::ConstructL() |
214 { |
238 { |
215 User::LeaveIfError(iMutex.CreateLocal()); |
239 User::LeaveIfError(iMutex.CreateLocal()); |
216 iMap.Reserve(iInitialSize); |
240 iMap.Reserve(iInitialSize); |
217 TSurfaceId surface = TSurfaceId::CreateNullId(); |
241 TSurfaceId surface = TSurfaceId::CreateNullId(); |
218 User::LeaveIfError(iMap.Insert(surface, NULL)); |
242 User::LeaveIfError(iMap.Insert(surface, NULL)); |
219 |
243 |
220 iSurfaceManager = new(ELeave) RSurfaceManager(); |
244 User::LeaveIfError(iSurfaceManager.Open()); |
221 User::LeaveIfError(iSurfaceManager->Open()); |
|
222 RProcess process; |
245 RProcess process; |
223 TUidType uidType = process.Type(); |
246 TUidType uidType = process.Type(); |
224 const TInt32 KWservUid = 268450592; |
247 const TInt32 KWservUid = 268450592; |
225 const TUid& uid1 = uidType[2]; |
248 const TUid& uid1 = uidType[2]; |
226 |
249 |