166 iCache = CTierNotificationCache::NewL(); |
166 iCache = CTierNotificationCache::NewL(); |
167 |
167 |
168 // set up a session with each collector |
168 // set up a session with each collector |
169 for (TInt sessionId=0 ; sessionId<aCollectors.Count() ; ++sessionId) |
169 for (TInt sessionId=0 ; sessionId<aCollectors.Count() ; ++sessionId) |
170 { |
170 { |
171 CDataCollectorSession* newCollector = CDataCollectorSession::NewL(aCollectors[sessionId], *this, sessionId ); |
171 MDataCollector* collector = aCollectors[sessionId]; |
172 CleanupStack::PushL(newCollector); |
172 aCollectors[sessionId] = NULL; |
173 iCollectorSessions.AppendL(newCollector); |
173 CleanupStack::PushL(collector); |
174 CleanupStack::Pop(newCollector); |
174 CDataCollectorSession* newCollectorSession = CDataCollectorSession::NewL(collector, *this, sessionId); |
175 |
175 CleanupStack::Pop(collector); |
176 // now owned by the CDataCollectorSession in iCollectorSessions so don't want it to be in the cleanup path twice! |
176 CleanupStack::PushL(newCollectorSession); |
177 aCollectors[sessionId] = 0; |
177 iCollectorSessions.AppendL(newCollectorSession); |
178 } |
178 CleanupStack::Pop(newCollectorSession); |
179 |
179 } |
180 |
180 |
181 // Must run session creation and start loops separately in case the initial data fetch is synchronous. |
181 // Must run session creation and start loops separately in case the initial data fetch is synchronous. |
182 // Reasoning: |
182 // Reasoning: |
183 // when a full set of data for each collector is received, notification is only allowed if all |
183 // when a full set of data for each collector is received, notification is only allowed if all |
184 // collectors know they've got their full set. |
184 // collectors know they've got their full set. |