diff options
Diffstat (limited to 'indra/newview/llinventorymodelbackgroundfetch.cpp')
-rw-r--r-- | indra/newview/llinventorymodelbackgroundfetch.cpp | 240 |
1 files changed, 120 insertions, 120 deletions
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index d9ace1542b..2cf1554957 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -114,7 +114,7 @@ class BGItemHttpHandler : public LLInventoryModel::FetchItemHttpHandler LOG_CLASS(BGItemHttpHandler); public: - BGItemHttpHandler(const LLSD & request_sd) + BGItemHttpHandler(const LLSD& request_sd) : LLInventoryModel::FetchItemHttpHandler(request_sd) { LLInventoryModelBackgroundFetch::instance().incrFetchCount(1); @@ -126,8 +126,8 @@ public: } protected: - BGItemHttpHandler(const BGItemHttpHandler &); // Not defined - void operator=(const BGItemHttpHandler &); // Not defined + BGItemHttpHandler(const BGItemHttpHandler&); // Not defined + void operator=(const BGItemHttpHandler&); // Not defined }; @@ -145,7 +145,7 @@ class BGFolderHttpHandler : public LLCore::HttpHandler LOG_CLASS(BGFolderHttpHandler); public: - BGFolderHttpHandler(const LLSD & request_sd, const uuid_vec_t & recursive_cats) + BGFolderHttpHandler(const LLSD& request_sd, const uuid_vec_t& recursive_cats) : LLCore::HttpHandler(), mRequestSD(request_sd), mRecursiveCatUUIDs(recursive_cats) @@ -159,18 +159,18 @@ public: } protected: - BGFolderHttpHandler(const BGFolderHttpHandler &); // Not defined - void operator=(const BGFolderHttpHandler &); // Not defined + BGFolderHttpHandler(const BGFolderHttpHandler&); // Not defined + void operator=(const BGFolderHttpHandler&); // Not defined public: - virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response); + virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse* response); - bool getIsRecursive(const LLUUID & cat_id) const; + bool getIsRecursive(const LLUUID& cat_id) const; private: - void processData(LLSD & body, LLCore::HttpResponse * response); - void processFailure(LLCore::HttpStatus status, LLCore::HttpResponse * response); - void processFailure(const char * const reason, LLCore::HttpResponse * response); + void processData(LLSD& body, LLCore::HttpResponse* response); + void processFailure(LLCore::HttpStatus status, LLCore::HttpResponse* response); + void processFailure(const char* const reason, LLCore::HttpResponse* response); private: LLSD mRequestSD; @@ -178,7 +178,7 @@ private: }; -const char * const LOG_INV("Inventory"); +const char* const LOG_INV("Inventory"); } // end of namespace anonymous @@ -202,7 +202,7 @@ LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch(): LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch() { - gIdleCallbacks.deleteFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + gIdleCallbacks.deleteFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); } bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete() const @@ -242,7 +242,7 @@ bool LLInventoryModelBackgroundFetch::inventoryFetchCompleted() const bool LLInventoryModelBackgroundFetch::inventoryFetchInProgress() const { - return inventoryFetchStarted() && ! inventoryFetchCompleted(); + return inventoryFetchStarted() && !inventoryFetchCompleted(); } bool LLInventoryModelBackgroundFetch::isEverythingFetched() const @@ -255,35 +255,35 @@ bool LLInventoryModelBackgroundFetch::folderFetchActive() const return mFolderFetchActive; } -void LLInventoryModelBackgroundFetch::addRequestAtFront(const LLUUID & id, bool recursive, bool is_category) +void LLInventoryModelBackgroundFetch::addRequestAtFront(const LLUUID& id, bool recursive, bool is_category) { EFetchType recursion_type = recursive ? FT_RECURSIVE : FT_DEFAULT; if (is_category) { - mFetchFolderQueue.push_front(FetchQueueInfo(id, recursion_type, is_category)); + mFetchFolderQueue.emplace_front(id, recursion_type, is_category); } else { - mFetchItemQueue.push_front(FetchQueueInfo(id, recursion_type, is_category)); + mFetchItemQueue.emplace_front(id, recursion_type, is_category); } } -void LLInventoryModelBackgroundFetch::addRequestAtBack(const LLUUID & id, bool recursive, bool is_category) +void LLInventoryModelBackgroundFetch::addRequestAtBack(const LLUUID& id, bool recursive, bool is_category) { EFetchType recursion_type = recursive ? FT_RECURSIVE : FT_DEFAULT; if (is_category) { - mFetchFolderQueue.push_back(FetchQueueInfo(id, recursion_type, is_category)); + mFetchFolderQueue.emplace_back(id, recursion_type, is_category); } else { - mFetchItemQueue.push_back(FetchQueueInfo(id, recursion_type, is_category)); + mFetchItemQueue.emplace_back(id, recursion_type, is_category); } } void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive) { - LLViewerInventoryCategory * cat(gInventory.getCategory(id)); + LLViewerInventoryCategory* cat(gInventory.getCategory(id)); if (cat || (id.isNull() && ! isEverythingFetched())) { @@ -295,7 +295,7 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive) EFetchType recursion_type = recursive ? FT_RECURSIVE : FT_DEFAULT; if (id.isNull()) { - if (! mRecursiveInventoryFetchStarted) + if (!mRecursiveInventoryFetchStarted) { mRecursiveInventoryFetchStarted |= recursive; if (recursive && AISAPI::isAvailable()) @@ -303,19 +303,19 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive) // Not only root folder can be massive, but // most system folders will be requested independently // so request root folder and content separately - mFetchFolderQueue.push_front(FetchQueueInfo(gInventory.getRootFolderID(), FT_FOLDER_AND_CONTENT)); + mFetchFolderQueue.emplace_front(gInventory.getRootFolderID(), FT_FOLDER_AND_CONTENT); } else { - mFetchFolderQueue.push_back(FetchQueueInfo(gInventory.getRootFolderID(), recursion_type)); + mFetchFolderQueue.emplace_back(gInventory.getRootFolderID(), recursion_type); } - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); } - if (! mRecursiveLibraryFetchStarted) + if (!mRecursiveLibraryFetchStarted) { mRecursiveLibraryFetchStarted |= recursive; - mFetchFolderQueue.push_back(FetchQueueInfo(gInventory.getLibraryRootFolderID(), recursion_type)); - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + mFetchFolderQueue.emplace_back(gInventory.getLibraryRootFolderID(), recursion_type); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); } } else if (recursive && cat && cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_LISTINGS) @@ -325,13 +325,13 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive) if (recursive && AISAPI::isAvailable()) { // Request marketplace folder and content separately - mFetchFolderQueue.push_front(FetchQueueInfo(id, FT_FOLDER_AND_CONTENT)); + mFetchFolderQueue.emplace_front(id, FT_FOLDER_AND_CONTENT); } else { - mFetchFolderQueue.push_front(FetchQueueInfo(id, recursion_type)); + mFetchFolderQueue.emplace_front(id, recursion_type); } - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); mRecursiveMarketplaceFetchStarted = true; } } @@ -343,15 +343,15 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive) { // On AIS make sure root goes to the top and follow up recursive // fetches, not individual requests - mFetchFolderQueue.push_back(FetchQueueInfo(id, recursion_type)); - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + mFetchFolderQueue.emplace_back(id, recursion_type); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); } } else if (mFetchFolderQueue.empty() || mFetchFolderQueue.front().mUUID != id) { - // Specific folder requests go to front of queue. - mFetchFolderQueue.push_front(FetchQueueInfo(id, recursion_type)); - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + // Specific folder requests go to front of queue. + mFetchFolderQueue.emplace_front(id, recursion_type); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); } if (id == gInventory.getLibraryRootFolderID()) @@ -364,9 +364,9 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive) } } } - else if (LLViewerInventoryItem * itemp = gInventory.getItem(id)) + else if (LLViewerInventoryItem* itemp = gInventory.getItem(id)) { - if (! itemp->mIsComplete) + if (!itemp->mIsComplete) { scheduleItemFetch(id); } @@ -385,18 +385,18 @@ void LLInventoryModelBackgroundFetch::scheduleFolderFetch(const LLUUID& cat_id, // check if already requested if (mForceFetchSet.find(cat_id) == mForceFetchSet.end()) { - mForceFetchSet.insert(cat_id); - mFetchItemQueue.push_front(FetchQueueInfo(cat_id, FT_FORCED)); + mForceFetchSet.emplace(cat_id); + mFetchFolderQueue.emplace_front(cat_id, FT_FORCED); } } else { // Specific folder requests go to front of queue. - // version presence acts as dupplicate prevention for normal fetches - mFetchItemQueue.push_front(FetchQueueInfo(cat_id, FT_DEFAULT)); + // version presence acts as duplicate prevention for normal fetches + mFetchFolderQueue.emplace_front(cat_id, FT_DEFAULT); } - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); } } @@ -410,17 +410,17 @@ void LLInventoryModelBackgroundFetch::scheduleItemFetch(const LLUUID& item_id, b // check if already requested if (mForceFetchSet.find(item_id) == mForceFetchSet.end()) { - mForceFetchSet.insert(item_id); - mFetchItemQueue.push_front(FetchQueueInfo(item_id, FT_FORCED, false)); + mForceFetchSet.emplace(item_id); + mFetchItemQueue.emplace_front(item_id, FT_FORCED, false); } } else { - // 'isFinished' being set acts as dupplicate prevention for normal fetches - mFetchItemQueue.push_front(FetchQueueInfo(item_id, FT_DEFAULT, false)); + // 'isFinished' being set acts as duplicate prevention for normal fetches + mFetchItemQueue.emplace_front(item_id, FT_DEFAULT, false); } - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); } } @@ -433,7 +433,7 @@ void LLInventoryModelBackgroundFetch::fetchFolderAndLinks(const LLUUID& cat_id, cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE); } incrFetchFolderCount(1); - mExpectedFolderIds.push_back(cat_id); + mExpectedFolderIds.emplace_back(cat_id); // Assume that we have no relevant cache. Fetch folder, and items folder's links point to. AISAPI::FetchCategoryLinks(cat_id, @@ -450,7 +450,7 @@ void LLInventoryModelBackgroundFetch::fetchFolderAndLinks(const LLUUID& cat_id, // start idle loop to track completion mBackgroundFetchActive = true; mFolderFetchActive = true; - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); } void LLInventoryModelBackgroundFetch::fetchCOF(nullary_func_t callback) @@ -463,7 +463,7 @@ void LLInventoryModelBackgroundFetch::fetchCOF(nullary_func_t callback) cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE); } incrFetchFolderCount(1); - mExpectedFolderIds.push_back(cat_id); + mExpectedFolderIds.emplace_back(cat_id); // For reliability assume that we have no relevant cache, so // fetch cof along with items cof's links point to. AISAPI::FetchCOF([callback](const LLUUID& id) @@ -492,15 +492,15 @@ void LLInventoryModelBackgroundFetch::fetchCOF(nullary_func_t callback) // start idle loop to track completion mBackgroundFetchActive = true; mFolderFetchActive = true; - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); } void LLInventoryModelBackgroundFetch::findLostItems() { mBackgroundFetchActive = true; mFolderFetchActive = true; - mFetchFolderQueue.push_back(FetchQueueInfo(LLUUID::null, FT_RECURSIVE)); - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + mFetchFolderQueue.emplace_back(LLUUID::null, FT_RECURSIVE); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); } void LLInventoryModelBackgroundFetch::setAllFoldersFetched() @@ -530,7 +530,7 @@ boost::signals2::connection LLInventoryModelBackgroundFetch::setFetchCompletionC return mFoldersFetchedSignal.connect(cb); } -void LLInventoryModelBackgroundFetch::backgroundFetchCB(void *) +void LLInventoryModelBackgroundFetch::backgroundFetchCB(void*) { LLInventoryModelBackgroundFetch::instance().backgroundFetch(); } @@ -583,7 +583,7 @@ void LLInventoryModelBackgroundFetch::onAISContentCalback( const LLUUID& response_id, EFetchType fetch_type) { - // Don't push_front on failure - there is a chance it was fired from inside bulkFetchViaAis + // Don't emplace_front on failure - there is a chance it was fired from inside bulkFetchViaAis incrFetchFolderCount(-1); uuid_vec_t::const_iterator folder_iter = content_ids.begin(); @@ -604,7 +604,7 @@ void LLInventoryModelBackgroundFetch::onAISContentCalback( if (response_id.isNull()) { // Failed to fetch, get it individually - mFetchFolderQueue.push_back(FetchQueueInfo(*folder_iter, FT_RECURSIVE)); + mFetchFolderQueue.emplace_back(*folder_iter, FT_RECURSIVE); } else { @@ -618,7 +618,7 @@ void LLInventoryModelBackgroundFetch::onAISContentCalback( it != categories->end(); ++it) { - mFetchFolderQueue.push_back(FetchQueueInfo((*it)->getUUID(), FT_RECURSIVE)); + mFetchFolderQueue.emplace_back((*it)->getUUID(), FT_RECURSIVE); } } } @@ -630,12 +630,12 @@ void LLInventoryModelBackgroundFetch::onAISContentCalback( { mBackgroundFetchActive = true; mFolderFetchActive = true; - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); } } -void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID &request_id, const LLUUID &response_id, EFetchType fetch_type) +void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID& request_id, const LLUUID& response_id, EFetchType fetch_type) { - // Don't push_front on failure - there is a chance it was fired from inside bulkFetchViaAis + // Don't emplace_front on failure - there is a chance it was fired from inside bulkFetchViaAis incrFetchFolderCount(-1); std::list<LLUUID>::const_iterator found = std::find(mExpectedFolderIds.begin(), mExpectedFolderIds.end(), request_id); if (found != mExpectedFolderIds.end()) @@ -651,7 +651,7 @@ void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID &request_i if (request_id.isNull()) { - // orhans, no other actions needed + // orphans, no other actions needed return; } @@ -664,12 +664,12 @@ void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID &request_i { // A full recursive request failed. // Try requesting folder and nested content separately - mFetchFolderQueue.push_back(FetchQueueInfo(request_id, FT_FOLDER_AND_CONTENT)); + mFetchFolderQueue.emplace_back(request_id, FT_FOLDER_AND_CONTENT); } else if (fetch_type == FT_FOLDER_AND_CONTENT) { LL_WARNS() << "Failed to download folder: " << request_id << " Requesting known content separately" << LL_ENDL; - mFetchFolderQueue.push_back(FetchQueueInfo(request_id, FT_CONTENT_RECURSIVE)); + mFetchFolderQueue.emplace_back(request_id, FT_CONTENT_RECURSIVE); // set folder's version to prevent viewer from trying to request folder indefinetely LLViewerInventoryCategory* cat(gInventory.getCategory(request_id)); @@ -687,15 +687,15 @@ void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID &request_i { // Got the folder and content, now verify content // Request content even for FT_RECURSIVE in case of changes, failures - // or if depth limit gets imlemented. + // or if depth limit gets implemented. // This shouldn't redownload folders if they already have version request_descendants = true; LL_DEBUGS(LOG_INV, "AIS3") << "Got folder " << request_id << ". Requesting content" << LL_ENDL; } else if (fetch_type == FT_FOLDER_AND_CONTENT) { - // readd folder for content request - mFetchFolderQueue.push_front(FetchQueueInfo(request_id, FT_CONTENT_RECURSIVE)); + // read folder for content request + mFetchFolderQueue.emplace_front(request_id, FT_CONTENT_RECURSIVE); } else { @@ -715,7 +715,7 @@ void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID &request_i it != categories->end(); ++it) { - mFetchFolderQueue.push_back(FetchQueueInfo((*it)->getUUID(), FT_RECURSIVE)); + mFetchFolderQueue.emplace_back((*it)->getUUID(), FT_RECURSIVE); } } } @@ -724,11 +724,11 @@ void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID &request_i { mBackgroundFetchActive = true; mFolderFetchActive = true; - gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr); } // done - LLViewerInventoryCategory * cat(gInventory.getCategory(request_id)); + LLViewerInventoryCategory* cat(gInventory.getCategory(request_id)); if (cat) { cat->setFetching(new_state); @@ -766,7 +766,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis() while (!mFetchFolderQueue.empty() && (U32)mFetchCount < max_concurrent_fetches && curent_time < end_time) { - const FetchQueueInfo & fetch_info(mFetchFolderQueue.front()); + const FetchQueueInfo& fetch_info(mFetchFolderQueue.front()); bulkFetchViaAis(fetch_info); mFetchFolderQueue.pop_front(); curent_time = LLTimer::getTotalSeconds(); @@ -774,7 +774,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis() // Ideally we shouldn't fetch items if recursive fetch isn't done, // but there is a chance some request will start timeouting and recursive - // fetch will get stuck on a signle folder, don't block item fetch in such case + // fetch will get stuck on a single folder, don't block item fetch in such case while (!mFetchItemQueue.empty() && (U32)mFetchCount < max_concurrent_fetches && curent_time < end_time) { const FetchQueueInfo& fetch_info(mFetchItemQueue.front()); @@ -832,7 +832,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis() const LLUUID& marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); if (marketplacelistings_id.notNull()) { - mFetchFolderQueue.push_front(FetchQueueInfo(marketplacelistings_id, FT_FOLDER_AND_CONTENT)); + mFetchFolderQueue.emplace_front(marketplacelistings_id, FT_FOLDER_AND_CONTENT); } else { @@ -852,11 +852,11 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc { if (fetch_info.mIsCategory) { - const LLUUID & cat_id(fetch_info.mUUID); + const LLUUID& cat_id(fetch_info.mUUID); if (cat_id.isNull()) { incrFetchFolderCount(1); - mExpectedFolderIds.push_back(cat_id); + mExpectedFolderIds.emplace_back(cat_id); // Lost and found // Should it actually be recursive? AISAPI::FetchOrphans([](const LLUUID& response_id) @@ -868,7 +868,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc } else { - LLViewerInventoryCategory * cat(gInventory.getCategory(cat_id)); + LLViewerInventoryCategory* cat(gInventory.getCategory(cat_id)); if (cat) { if (fetch_info.mFetchType == FT_CONTENT_RECURSIVE) @@ -903,8 +903,8 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc continue; } - children.push_back(child_cat->getUUID()); - mExpectedFolderIds.push_back(child_cat->getUUID()); + children.emplace_back(child_cat->getUUID()); + mExpectedFolderIds.emplace_back(child_cat->getUUID()); child_cat->setFetching(target_state); if (children.size() >= batch_limit) @@ -938,7 +938,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc if (content_done) { // This will have a bit of overlap with onAISContentCalback, - // but something else might have dowloaded folders, so verify + // but something else might have downloaded folders, so verify // every child that is complete has it's children done as well for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); it != categories->end(); @@ -947,14 +947,14 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc LLViewerInventoryCategory* child_cat = (*it); if (LLViewerInventoryCategory::VERSION_UNKNOWN != child_cat->getVersion()) { - mFetchFolderQueue.push_back(FetchQueueInfo(child_cat->getUUID(), FT_RECURSIVE)); + mFetchFolderQueue.emplace_back(child_cat->getUUID(), FT_RECURSIVE); } } } else { // send it back to get the rest - mFetchFolderQueue.push_back(FetchQueueInfo(cat_id, FT_CONTENT_RECURSIVE)); + mFetchFolderQueue.emplace_back(cat_id, FT_CONTENT_RECURSIVE); } } else if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion() @@ -971,7 +971,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc // increment before call in case of immediate callback incrFetchFolderCount(1); cat->setFetching(target_state); - mExpectedFolderIds.push_back(cat_id); + mExpectedFolderIds.emplace_back(cat_id); EFetchType type = fetch_info.mFetchType; LLUUID cat_cb_id = cat_id; @@ -995,15 +995,15 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc if (fetch_info.mFetchType == FT_RECURSIVE || fetch_info.mFetchType == FT_FOLDER_AND_CONTENT) { - LLInventoryModel::cat_array_t * categories(NULL); - LLInventoryModel::item_array_t * items(NULL); + LLInventoryModel::cat_array_t* categories(NULL); + LLInventoryModel::item_array_t* items(NULL); gInventory.getDirectDescendentsOf(cat_id, categories, items); for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin(); it != categories->end(); ++it) { - // not push_front to not cause an infinite loop - mFetchFolderQueue.push_back(FetchQueueInfo((*it)->getUUID(), FT_RECURSIVE)); + // not emplace_front to not cause an infinite loop + mFetchFolderQueue.emplace_back((*it)->getUUID(), FT_RECURSIVE); } } } @@ -1012,7 +1012,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc } else { - LLViewerInventoryItem * itemp(gInventory.getItem(fetch_info.mUUID)); + LLViewerInventoryItem* itemp(gInventory.getItem(fetch_info.mUUID)); if (itemp) { @@ -1050,7 +1050,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch() //Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped. //If there are items in mFetchQueue, we want to check the time since the last bulkFetch was //sent. If it exceeds our retry time, go ahead and fire off another batch. - LLViewerRegion * region(gAgent.getRegion()); + LLViewerRegion* region(gAgent.getRegion()); if (! region || gDisconnected || LLApp::isExiting()) { return; @@ -1070,7 +1070,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch() // Just processed a bunch of items. // Note: do we really need notifyObservers() here? // OnIdle it will be called anyway due to Add flag for processed item. - // It seems like in some cases we are updaiting on fail (no flag), + // It seems like in some cases we are updating on fail (no flag), // but is there anything to update? gInventory.notifyObservers(); } @@ -1088,7 +1088,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch() // *TODO: Think I'd like to get a shared pointer to this and share it // among all the folder requests. uuid_vec_t recursive_cats; - uuid_vec_t all_cats; // dupplicate avoidance + uuid_vec_t all_cats; // duplicate avoidance LLSD folder_request_body; LLSD folder_request_body_lib; @@ -1098,10 +1098,10 @@ void LLInventoryModelBackgroundFetch::bulkFetch() while (! mFetchFolderQueue.empty() && (item_count + folder_count) < max_batch_size) { - const FetchQueueInfo & fetch_info(mFetchFolderQueue.front()); + const FetchQueueInfo& fetch_info(mFetchFolderQueue.front()); if (fetch_info.mIsCategory) { - const LLUUID & cat_id(fetch_info.mUUID); + const LLUUID& cat_id(fetch_info.mUUID); if (cat_id.isNull()) //DEV-17797 Lost and found { LLSD folder_sd; @@ -1115,7 +1115,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch() } else { - const LLViewerInventoryCategory * cat(gInventory.getCategory(cat_id)); + const LLViewerInventoryCategory* cat(gInventory.getCategory(cat_id)); if (cat) { if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion()) @@ -1145,14 +1145,14 @@ void LLInventoryModelBackgroundFetch::bulkFetch() // May already have this folder, but append child folders to list. if (fetch_info.mFetchType >= FT_CONTENT_RECURSIVE) { - LLInventoryModel::cat_array_t * categories(NULL); - LLInventoryModel::item_array_t * items(NULL); + LLInventoryModel::cat_array_t* categories(NULL); + LLInventoryModel::item_array_t* items(NULL); gInventory.getDirectDescendentsOf(cat_id, categories, items); for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin(); it != categories->end(); ++it) { - mFetchFolderQueue.push_back(FetchQueueInfo((*it)->getUUID(), fetch_info.mFetchType)); + mFetchFolderQueue.emplace_back((*it)->getUUID(), fetch_info.mFetchType); } } } @@ -1160,9 +1160,9 @@ void LLInventoryModelBackgroundFetch::bulkFetch() } if (fetch_info.mFetchType >= FT_CONTENT_RECURSIVE) { - recursive_cats.push_back(cat_id); + recursive_cats.emplace_back(cat_id); } - all_cats.push_back(cat_id); + all_cats.emplace_back(cat_id); } mFetchFolderQueue.pop_front(); @@ -1172,9 +1172,9 @@ void LLInventoryModelBackgroundFetch::bulkFetch() while (!mFetchItemQueue.empty() && (item_count + folder_count) < max_batch_size) { - const FetchQueueInfo & fetch_info(mFetchItemQueue.front()); + const FetchQueueInfo& fetch_info(mFetchItemQueue.front()); - LLViewerInventoryItem * itemp(gInventory.getItem(fetch_info.mUUID)); + LLViewerInventoryItem* itemp(gInventory.getItem(fetch_info.mUUID)); if (itemp) { @@ -1262,13 +1262,13 @@ void LLInventoryModelBackgroundFetch::bulkFetch() } } -bool LLInventoryModelBackgroundFetch::fetchQueueContainsNoDescendentsOf(const LLUUID & cat_id) const +bool LLInventoryModelBackgroundFetch::fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) const { for (fetch_queue_t::const_iterator it = mFetchFolderQueue.begin(); it != mFetchFolderQueue.end(); ++it) { - const LLUUID & fetch_id = (*it).mUUID; + const LLUUID& fetch_id = (*it).mUUID; if (gInventory.isObjectDescendentOf(fetch_id, cat_id)) return false; } @@ -1276,7 +1276,7 @@ bool LLInventoryModelBackgroundFetch::fetchQueueContainsNoDescendentsOf(const LL it != mFetchItemQueue.end(); ++it) { - const LLUUID & fetch_id = (*it).mUUID; + const LLUUID& fetch_id = (*it).mUUID; if (gInventory.isObjectDescendentOf(fetch_id, cat_id)) return false; } @@ -1291,7 +1291,7 @@ namespace /// Class <anonymous>::BGFolderHttpHandler ///---------------------------------------------------------------------------- -void BGFolderHttpHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response) +void BGFolderHttpHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse* response) { do // Single-pass do-while used for common exit handling { @@ -1304,7 +1304,7 @@ void BGFolderHttpHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRes } // Response body should be present. - LLCore::BufferArray * body(response->getBody()); + LLCore::BufferArray* body(response->getBody()); // body = NULL; // Dev tool to force error handling if (! body || ! body->size()) { @@ -1353,9 +1353,9 @@ void BGFolderHttpHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRes } -void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * response) +void BGFolderHttpHandler::processData(LLSD& content, LLCore::HttpResponse* response) { - LLInventoryModelBackgroundFetch * fetcher(LLInventoryModelBackgroundFetch::getInstance()); + LLInventoryModelBackgroundFetch* fetcher(LLInventoryModelBackgroundFetch::getInstance()); // API V2 and earlier should probably be testing for "error" map // in response as an application-level error. @@ -1373,7 +1373,7 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res //LLUUID agent_id = folder_sd["agent_id"]; - //if(agent_id != gAgent.getID()) //This should never happen. + //if (agent_id != gAgent.getID()) //This should never happen. //{ // LL_WARNS(LOG_INV) << "Got a UpdateInventoryItem for the wrong agent." // << LL_ENDL; @@ -1405,7 +1405,7 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res LLInventoryModel::update_list_t update; LLInventoryModel::LLCategoryUpdate new_folder(lost_uuid, 1); - update.push_back(new_folder); + update.emplace_back(new_folder); gInventory.accountForUpdate(update); titem->setParent(lost_uuid); @@ -1415,7 +1415,7 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res } } - LLViewerInventoryCategory * pcat(gInventory.getCategory(parent_id)); + LLViewerInventoryCategory* pcat(gInventory.getCategory(parent_id)); if (! pcat) { continue; @@ -1453,7 +1453,7 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res } // Set version and descendentcount according to message. - LLViewerInventoryCategory * cat(gInventory.getCategory(parent_id)); + LLViewerInventoryCategory* cat(gInventory.getCategory(parent_id)); if (cat) { cat->setVersion(version); @@ -1486,9 +1486,9 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res } -void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::HttpResponse * response) +void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::HttpResponse* response) { - const std::string & ct(response->getContentType()); + const std::string& ct(response->getContentType()); LL_WARNS(LOG_INV) << "Inventory folder fetch failure\n" << "[Status: " << status.toTerseString() << "]\n" << "[Reason: " << status.toString() << "]\n" @@ -1498,7 +1498,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http // Could use a 404 test here to try to detect revoked caps... - if(status == LLCore::HttpStatus(HTTP_FORBIDDEN)) + if (status == LLCore::HttpStatus(HTTP_FORBIDDEN)) { // Too large, split into two if possible if (gDisconnected || LLApp::isExiting()) @@ -1528,7 +1528,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http LLUUID folder_id = iter->get("folder_id").asUUID(); if (std::find(mRecursiveCatUUIDs.begin(), mRecursiveCatUUIDs.end(), folder_id) != mRecursiveCatUUIDs.end()) { - recursive_cats.push_back(folder_id); + recursive_cats.emplace_back(folder_id); } if (folders.size() == (size / 2)) { @@ -1559,9 +1559,9 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http // request which tested on HTTP_INTERNAL_ERROR status. This // retry logic was unbounded and lacked discrimination as to the // cause of the retry. The new http library should be doing - // adquately on retries but I want to keep the structure of a + // adequately on retries but I want to keep the structure of a // retry for reference. - LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance(); + LLInventoryModelBackgroundFetch* fetcher = LLInventoryModelBackgroundFetch::getInstance(); if (false) { // timed out or curl failure @@ -1585,7 +1585,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http } -void BGFolderHttpHandler::processFailure(const char * const reason, LLCore::HttpResponse * response) +void BGFolderHttpHandler::processFailure(const char* const reason, LLCore::HttpResponse* response) { LL_WARNS(LOG_INV) << "Inventory folder fetch failure\n" << "[Status: internal error]\n" @@ -1599,7 +1599,7 @@ void BGFolderHttpHandler::processFailure(const char * const reason, LLCore::Http // the same but be aware that this may be a source of problems. // Philosophy is that inventory folders are so essential to // operation that this is a reasonable action. - LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance(); + LLInventoryModelBackgroundFetch* fetcher = LLInventoryModelBackgroundFetch::getInstance(); if (true) { for (LLSD::array_const_iterator folder_it = mRequestSD["folders"].beginArray(); @@ -1622,7 +1622,7 @@ void BGFolderHttpHandler::processFailure(const char * const reason, LLCore::Http } -bool BGFolderHttpHandler::getIsRecursive(const LLUUID & cat_id) const +bool BGFolderHttpHandler::getIsRecursive(const LLUUID& cat_id) const { return std::find(mRecursiveCatUUIDs.begin(), mRecursiveCatUUIDs.end(), cat_id) != mRecursiveCatUUIDs.end(); } |