ElunaEventProcessor::~ElunaEventProcessor() { RemoveEvents(); // In multithread get the object's map's lua state Eluna* E = obj ? sEluna : sEluna; EventMgr::WriteGuard lock(E->eventMgr->GetLock()); E->eventMgr->processors.erase(this); }
//changed by thilon on 2007.12.07, for刷新问题 void CLogListCtrl::ShowSelectedPeerLogs(CUpDownClient* pClient) { if (!pClient) { return; } RemoveEvents(); SetRedraw(FALSE); for(POSITION pos = pClient->GetEventList()->GetTailPosition(); pos != NULL;) { AddLog((pClient->GetEventList())->GetPrev(pos)); } SetRedraw(TRUE); SetScrollBar(); }
//changed by thilon on 2007.12.07, for刷新问题 void CLogListCtrl::ShowSelectedFileLogs(CPartFile* pPartFile) { if (!pPartFile) { return; } RemoveEvents(); SetRedraw(FALSE); for(POSITION pos = pPartFile->GetEventList()->GetTailPosition(); pos != NULL;) { AddLog((pPartFile->GetEventList())->GetPrev(pos)); } SetRedraw(TRUE); SetScrollBar(); }
int SweepTree::Remove(SweepTreeList &list, SweepEventQueue &queue, bool rebalance) { RemoveEvents(queue); AVLTree *tempR = static_cast<AVLTree *>(list.racine); int err = AVLTree::Remove(tempR, rebalance); list.racine = static_cast<SweepTree *>(tempR); MakeDelete(); if (list.nbTree <= 1) { list.nbTree = 0; list.racine = NULL; } else { if (list.racine == list.trees + (list.nbTree - 1)) list.racine = this; list.trees[--list.nbTree].Relocate(this); } return err; }
// ----------------------------------------------------------------------------- // CPosLmEventHandler::AddToEventQueueL // // (other items were commented in a header). // ----------------------------------------------------------------------------- // void CPosLmEventHandler::AddToEventQueueL( TPosLmEvent aEvent) { if (aEvent.iEventType == EPosLmEventMediaRemoved) { // Media is removed. All other events are removed. They are unnecessary. iEventQueue.Reset(); } else if (aEvent.iEventType == EPosLmEventNewDefaultDatabaseLocation) { // Remove all other equal events, if found. TInt queuePosition; RemoveEvents(ENewDefaultDbs, queuePosition); } else if (!MergeEventsIfPossibleL(aEvent)) { // Incoming event should not be added to queue. return; } User::LeaveIfError(iEventQueue.Append(aEvent)); }
// ----------------------------------------------------------------------------- // CPosLmEventHandler::MergeEventsIfPossibleL // // (other items were commented in a header). // ----------------------------------------------------------------------------- // TBool CPosLmEventHandler::MergeEventsIfPossibleL( TPosLmEvent aEvent) { TPosLmEventType incoming = aEvent.iEventType; TBool addEvent = ETrue; TInt noOfSpecificLms = 0; TInt noOfSpecificCats = 0; for (TInt i = 0; i < iEventQueue.Count(); i++) { TPosLmEventType eventInQueue = iEventQueue[i].iEventType; // EPosLmEventMediaRemoved and EPosLmEventNewDefaultDatabaseLocation // should not be removed from the queue, no matter what. // See also AddToEventQueue. if (eventInQueue != EPosLmEventMediaRemoved && eventInQueue != EPosLmEventNewDefaultDatabaseLocation) { if (incoming == EPosLmEventUnknownChanges) { // Unknown changes. All old events are removed. iEventQueue.Remove(i--); } else if (incoming == EPosLmEventCategoryUnknownChanges) { // Unknown category changes. HandleUnknownEvent(eventInQueue, IsSpecificCategory(eventInQueue) || eventInQueue == EPosLmEventCategoryUnknownChanges, addEvent, i); } else if (incoming == EPosLmEventLandmarkUnknownChanges) { // Unknown landmark changes. HandleUnknownEvent(eventInQueue, IsSpecificLandmark(eventInQueue) || eventInQueue == EPosLmEventLandmarkUnknownChanges, addEvent, i); } else if (IsSpecificCategory(incoming)) { // Specific category HandleSpecificEvent(eventInQueue, EPosLmEventCategoryUnknownChanges, addEvent, noOfSpecificCats, noOfSpecificLms); } else { // Specific landmark HandleSpecificEvent(eventInQueue, EPosLmEventLandmarkUnknownChanges, addEvent, noOfSpecificCats, noOfSpecificLms); } } } // If adding a specific landmark or category and queue is full, // either specific landmarks or categories are merged into a // corresponding EPosLmEventLandmarkUnknownChanges or // EPosLmEventCategoryUnknownChanges. if ((noOfSpecificLms > 0 || noOfSpecificCats > 0) && iEventQueue.Count() == KEventQueueMaxSize) { TPosLmEvent event; event.iLandmarkItemId = KPosLmNullItemId; TInt queuePositionOfFirstSpecific; if (noOfSpecificCats > noOfSpecificLms) { RemoveEvents(ESpecificCategories, queuePositionOfFirstSpecific); event.iEventType = EPosLmEventCategoryUnknownChanges; addEvent = IsSpecificLandmark(incoming); } else { RemoveEvents(ESpecificLandmarks, queuePositionOfFirstSpecific); event.iEventType = EPosLmEventLandmarkUnknownChanges; addEvent = IsSpecificCategory(incoming); } // This should not happen, because when calling RemoveEvents above, // there will always be either categories or landmarks in the queue // (see if-statement above). __ASSERT_DEBUG(queuePositionOfFirstSpecific != KErrNotFound, PanicServer(KErrGeneral)); User::LeaveIfError(iEventQueue.Insert(event, queuePositionOfFirstSpecific)); } return addEvent; }
EventMgr::~EventMgr() { RemoveEvents(); delete globalProcessor; }