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