changed DirDetails::children to be a vector, removed costly caching of DirDetailVector

This commit is contained in:
mr-alice 2016-08-19 18:49:42 +02:00
parent 78b8744183
commit f8ed1d3fb7
10 changed files with 124 additions and 116 deletions

View file

@ -545,6 +545,8 @@ bool DirectoryStorage::extractData(const EntryIndex& indx,DirDetails& d)
const InternalFileHierarchyStorage::DirEntry *dir_entry = mFileHierarchy->getDirEntry(indx) ;
d.ref = (void*)(intptr_t)indx ;
if (dir_entry != NULL) /* has children --- fill */
{
#ifdef DEBUG_DIRECTORY_STORAGE

View file

@ -108,11 +108,12 @@ int p3FileDatabase::tick()
if(last_print_time + 20 < now)
{
RS_STACK_MUTEX(mFLSMtx) ;
mLocalSharedDirs->print();
last_print_time = now ;
#warning this should be removed, but it's necessary atm for updating the GUI
RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_FRIENDS, 0);
//#warning this should be removed, but it's necessary atm for updating the GUI
// RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_FRIENDS, 0);
}
if(mUpdateFlags)
@ -402,12 +403,13 @@ int p3FileDatabase::RequestDirDetails(void *ref, DirDetails& d, FileSearchFlags
convertEntryIndexToPointer((intptr_t)d.ref,fi,d.ref) ;
for(std::list<DirStub>::iterator it(d.children.begin());it!=d.children.end();++it)
convertEntryIndexToPointer((intptr_t)it->ref,fi,it->ref);
for(uint32_t i=0;i<d.children.size();++i)
convertEntryIndexToPointer((intptr_t)d.children[i].ref,fi,d.children[i].ref);
#define Make sure this is right.
if(e == 0)
{
d.prow = fi-1 ;
d.prow = 0;//fi-1 ;
d.parent = NULL ;
}
else

View file

@ -242,7 +242,7 @@ public:
FileStorageFlags flags;
uint32_t min_age ; // minimum age of files in this subtree
std::list<DirStub> children;
std::vector<DirStub> children;
std::list<std::string> parent_groups; // parent groups for the shared directory
};

View file

@ -60,7 +60,7 @@ std::ostream &operator<<(std::ostream &out, const DirDetails& d)
std::cerr << " Min age : " << d.min_age << std::endl;
std::cerr << " Flags : " << d.flags << std::endl;
std::cerr << " Parent groups : " ; for(std::list<std::string>::const_iterator it(d.parent_groups.begin());it!=d.parent_groups.end();++it) std::cerr << (*it) << " "; std::cerr << std::endl;
std::cerr << " Children : " ; for(std::list<DirStub>::const_iterator it(d.children.begin());it!=d.children.end();++it) std::cerr << (intptr_t)(*it).ref << " "; std::cerr << std::endl;
std::cerr << " Children : " ; for(uint32_t i=0;i<d.children.size();++i) std::cerr << (intptr_t)d.children[i].ref << " "; std::cerr << std::endl;
std::cerr << "===================" << std::endl;
return out;
}