summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorymodelbackgroundfetch.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2023-12-18 06:33:57 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2023-12-18 06:33:57 +0200
commitaed6313d7c755ae1b980074fc27dfd98267fca24 (patch)
treebce1767cdba0a920eac80bc2c78c71bbc9899e15 /indra/newview/llinventorymodelbackgroundfetch.cpp
parenta069a21d318abd4eded46556c3252fec08eea84c (diff)
parenta592292242e29d0379ee72572a434359e1e892d1 (diff)
Merge branch 'main' into DRTVWR-594-maint-Y
Diffstat (limited to 'indra/newview/llinventorymodelbackgroundfetch.cpp')
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index 49b2cb74af..722447b5d7 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -377,6 +377,7 @@ void LLInventoryModelBackgroundFetch::scheduleFolderFetch(const LLUUID& cat_id,
if (mFetchFolderQueue.empty() || mFetchFolderQueue.front().mUUID != cat_id)
{
mBackgroundFetchActive = true;
+ mFolderFetchActive = true;
if (forced)
{
@@ -422,6 +423,61 @@ void LLInventoryModelBackgroundFetch::scheduleItemFetch(const LLUUID& item_id, b
}
}
+void LLInventoryModelBackgroundFetch::fetchFolderAndLinks(const LLUUID& cat_id, nullary_func_t callback)
+{
+ LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+ if (cat)
+ {
+ // Mark folder (update timer) so that background fetch won't request it
+ cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE);
+ }
+ incrFetchFolderCount(1);
+ mExpectedFolderIds.push_back(cat_id);
+
+ // Assume that we have no relevant cache. Fetch folder, and items folder's links point to.
+ AISAPI::FetchCategoryLinks(cat_id,
+ [callback, cat_id](const LLUUID& id)
+ {
+ callback();
+ if (id.isNull())
+ {
+ LL_WARNS() << "Failed to fetch category links " << cat_id << LL_ENDL;
+ }
+ LLInventoryModelBackgroundFetch::getInstance()->onAISFolderCalback(cat_id, id, FT_DEFAULT);
+ });
+
+ // start idle loop to track completion
+ mBackgroundFetchActive = true;
+ mFolderFetchActive = true;
+ gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+}
+
+void LLInventoryModelBackgroundFetch::fetchCOF(nullary_func_t callback)
+{
+ LLUUID cat_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+ LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+ if (cat)
+ {
+ // Mark cof (update timer) so that background fetch won't request it
+ cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE);
+ }
+ incrFetchFolderCount(1);
+ mExpectedFolderIds.push_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)
+ {
+ callback();
+ LLUUID cat_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+ LLInventoryModelBackgroundFetch::getInstance()->onAISFolderCalback(cat_id, id, FT_DEFAULT);
+ });
+
+ // start idle loop to track completion
+ mBackgroundFetchActive = true;
+ mFolderFetchActive = true;
+ gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+}
+
void LLInventoryModelBackgroundFetch::findLostItems()
{
mBackgroundFetchActive = true;