summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-03-19 16:11:21 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-03-19 16:11:21 +0200
commit72131418aa943b93f61508993d7006b02ebd9c35 (patch)
tree8cbef2ec0b8798bd217fbae436ffb73fda0be950 /indra/newview
parent7dad882c2f43b53c1618a4b140bd0b35be6fa106 (diff)
SL-18629 Rebuild brocken link on fetch compeltion.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventorymodel.cpp47
-rw-r--r--indra/newview/llinventorymodel.h6
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.cpp10
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.h5
4 files changed, 64 insertions, 4 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index c54a59d12f..b82f0c3ede 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -41,6 +41,7 @@
#include "llinventorypanel.h"
#include "llinventorybridge.h"
#include "llinventoryfunctions.h"
+#include "llinventorymodelbackgroundfetch.h"
#include "llinventoryobserver.h"
#include "llinventorypanel.h"
#include "llfloaterpreviewtrash.h"
@@ -439,6 +440,7 @@ LLInventoryModel::LLInventoryModel()
mIsNotifyObservers(FALSE),
mModifyMask(LLInventoryObserver::ALL),
mChangedItemIDs(),
+ mBulckFecthCallbackSlot(),
mObservers(),
mHttpRequestFG(NULL),
mHttpRequestBG(NULL),
@@ -470,6 +472,11 @@ void LLInventoryModel::cleanupInventory()
mObservers.erase(iter);
delete observer;
}
+
+ if (mBulckFecthCallbackSlot.connected())
+ {
+ mBulckFecthCallbackSlot.disconnect();
+ }
mObservers.clear();
// Run down HTTP transport
@@ -1750,6 +1757,15 @@ void LLInventoryModel::changeCategoryParent(LLViewerInventoryCategory* cat,
notifyObservers();
}
+void LLInventoryModel::rebuildBrockenLinks()
+{
+ for (LLUUID link_id : mPossiblyBrockenLinks)
+ {
+ addChangedMask(LLInventoryObserver::REBUILD, link_id);
+ }
+ mPossiblyBrockenLinks.clear();
+}
+
// Does not appear to be used currently.
void LLInventoryModel::onItemUpdated(const LLUUID& item_id, const LLSD& updates, bool update_parent_version)
{
@@ -2368,9 +2384,34 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item)
// The item will show up as a broken link.
if (item->getIsBrokenLink())
{
- LL_INFOS(LOG_INV) << "Adding broken link [ name: " << item->getName()
- << " itemID: " << item->getUUID()
- << " assetID: " << item->getAssetUUID() << " ) parent: " << item->getParentUUID() << LL_ENDL;
+ if (!LLInventoryModelBackgroundFetch::getInstance()->isEverythingFetched())
+ {
+ // isEverythingFetched is actually 'initial' fetch only.
+ // Schedule this link for a recheck once inventory gets loaded
+ mPossiblyBrockenLinks.insert(item->getUUID());
+ if (!mBulckFecthCallbackSlot.connected())
+ {
+ // Links might take a while to update this way, and there
+ // might be a lot of them. A better option might be to check
+ // links periodically with final check on fetch completion.
+ mBulckFecthCallbackSlot =
+ LLInventoryModelBackgroundFetch::getInstance()->setAllFoldersFetchedCallback(
+ []()
+ {
+ gInventory.rebuildBrockenLinks();
+ });
+ }
+ LL_DEBUGS(LOG_INV) << "Scheduling a link to be rebuilt later [ name: " << item->getName()
+ << " itemID: " << item->getUUID()
+ << " assetID: " << item->getAssetUUID() << " ) parent: " << item->getParentUUID() << LL_ENDL;
+
+ }
+ else
+ {
+ LL_INFOS(LOG_INV) << "Adding broken link [ name: " << item->getName()
+ << " itemID: " << item->getUUID()
+ << " assetID: " << item->getAssetUUID() << " ) parent: " << item->getParentUUID() << LL_ENDL;
+ }
}
if (item->getIsLinkType())
{
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index d1ee7b6144..02278ed957 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -407,6 +407,10 @@ public:
const LLUUID& new_parent_id,
BOOL restamp);
+ // Marks links from a "possibly" broken list for a rebuild
+ // clears the list
+ void rebuildBrockenLinks();
+
//--------------------------------------------------------------------
// Delete
//--------------------------------------------------------------------
@@ -574,6 +578,8 @@ private:
U32 mModifyMaskBacklog;
changed_items_t mChangedItemIDsBacklog;
changed_items_t mAddedItemIDsBacklog;
+ changed_items_t mPossiblyBrockenLinks;
+ boost::signals2::connection mBulckFecthCallbackSlot;
//--------------------------------------------------------------------
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index 6cae035fcf..ea721b3a40 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -347,12 +347,20 @@ void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
mAllFoldersFetched = true;
//LL_INFOS(LOG_INV) << "All folders fetched, validating" << LL_ENDL;
//gInventory.validate();
+
+ // For now only informs about initial fetch being done
+ mAllFoldersFetchedSignal();
}
mFolderFetchActive = false;
mBackgroundFetchActive = false;
LL_INFOS(LOG_INV) << "Inventory background fetch completed" << LL_ENDL;
}
+boost::signals2::connection LLInventoryModelBackgroundFetch::setAllFoldersFetchedCallback(folders_fetched_callback_t cb)
+{
+ return mAllFoldersFetchedSignal.connect(cb);
+}
+
void LLInventoryModelBackgroundFetch::backgroundFetchCB(void *)
{
LLInventoryModelBackgroundFetch::instance().backgroundFetch();
@@ -481,7 +489,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc
const LLViewerInventoryCategory * cat(gInventory.getCategory(cat_id));
if (cat)
{
- if (!gInventory.isCategoryComplete(cat_id))
+ if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
{
if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID())
{
diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h
index 14557ea92d..038b634180 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.h
+++ b/indra/newview/llinventorymodelbackgroundfetch.h
@@ -68,6 +68,9 @@ public:
bool isBulkFetchProcessingComplete() const;
void setAllFoldersFetched();
+ typedef boost::function<void()> folders_fetched_callback_t;
+ boost::signals2::connection setAllFoldersFetchedCallback(folders_fetched_callback_t cb);
+
void addRequestAtFront(const LLUUID & id, bool recursive, bool is_category);
void addRequestAtBack(const LLUUID & id, bool recursive, bool is_category);
@@ -106,6 +109,8 @@ private:
bool mRecursiveInventoryFetchStarted;
bool mRecursiveLibraryFetchStarted;
bool mAllFoldersFetched;
+ typedef boost::signals2::signal<void()> folders_fetched_signal_t;
+ folders_fetched_signal_t mAllFoldersFetchedSignal;
bool mBackgroundFetchActive;
bool mFolderFetchActive;