int CrFbDisplayBase::fbSynchAddAllEntries()
{
    VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
    const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;

    CrVrScrCompositorConstIterInit(CrFbGetCompositor(mpFb), &Iter);
    int rc = VINF_SUCCESS;

    CrFbVisitCreatedEntries(mpFb, entriesCreateCb, this);

    while ((pEntry = CrVrScrCompositorConstIterNext(&Iter)) != NULL)
    {
        HCR_FRAMEBUFFER_ENTRY hEntry = CrFbEntryFromCompositorEntry(pEntry);

        rc = EntryAdded(mpFb, hEntry);
        if (!RT_SUCCESS(rc))
        {
            WARN(("err"));
            EntryDestroyed(mpFb, hEntry);
            break;
        }
    }

    return rc;
}
Beispiel #2
0
// Synchronized table and LRU list
//
bool SBcacheManager::InsertEntry(SBcacheEntry& entry)
{
  SBcacheEntryTable::value_type tableEntry (entry.GetKey(), entry);
  if ( ! _entryTable.insert (tableEntry).second )
    return false;
  _entryLRUList.push_back(entry);
  EntryAdded();
  return true;
}
TBool CDiscussion::AddEntryOrCommentLD(CAtomEntryData* aEntry, const TDesC8& aEntryReference) {
	if(aEntry->GetContent().Length() > 0) {		
		ReadDiscussionToMemoryL();
		
		TInt aInsertIndex = iEntries.Count();
		
		// Set indexer
		aEntry->SetIndexerId(iDiscussionIndexer++);
		
		if(aEntry->GetId().Length() == 0 && aEntryReference.Length() == 0) {
			// Append entry
			iEntries.Append(CThreadedEntry::NewL(aEntry, this));
			CleanupStack::Pop(aEntry);
			
			EntryAdded(aEntry);
		
			return true;
		}
		else {
			for(TInt i = (iEntries.Count() - 1); i >= 0; i--) {
				// Compare references
				if(aEntryReference.Length() > 0) {
					// Find entry reference
					if(aEntryReference.Compare(iEntries[i]->GetEntry()->GetId()) == 0) {
						// Reference entry found
						return iEntries[i]->AddCommentLD(aEntry);
					}
				}
				else {
					if(aEntry->GetId().Compare(iEntries[i]->GetEntry()->GetId()) == 0) {			
						// Repeated entry
						CleanupStack::PopAndDestroy(); // aEntry
						
						return false;
					}
					
					if(iEntries[i]->GetEntry()->GetPublishTime() > aEntry->GetPublishTime()) {
						// Update insertion point
						aInsertIndex = i;
					}
					else {
						break;
					}
				}
			}			
		}
		
		if(aEntryReference.Length() > 0) {
			// Entry reference not found
			CleanupStack::PopAndDestroy(); // aEntry
			
			return false;		
		}
				
		// Append entry
		iEntries.Insert(CThreadedEntry::NewL(aEntry, this), aInsertIndex);
		CleanupStack::Pop(aEntry);
		
		EntryAdded(aEntry);
		
		return true;
	}
	else {
		// No entry content
		CleanupStack::PopAndDestroy(); // aEntry
		
		return false;		
	}
}