summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llinventorymodel.cpp82
-rw-r--r--indra/newview/llinventorymodel.h42
-rw-r--r--indra/newview/llviewerinventory.cpp2
3 files changed, 74 insertions, 52 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 5d8a8805b5..0a8108899a 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -59,7 +59,8 @@
BOOL LLInventoryModel::sBackgroundFetchActive = FALSE;
BOOL LLInventoryModel::sAllFoldersFetched = FALSE;
-BOOL LLInventoryModel::sFullFetchStarted = FALSE;
+BOOL LLInventoryModel::sMyInventoryFetchStarted = FALSE;
+BOOL LLInventoryModel::sLibraryFetchStarted = FALSE;
S32 LLInventoryModel::sNumFetchRetries = 0;
F32 LLInventoryModel::sMinTimeBetweenFetches = 0.3f;
F32 LLInventoryModel::sMaxTimeBetweenFetches = 10.f;
@@ -1342,11 +1343,11 @@ bool LLInventoryModel::isBulkFetchProcessingComplete()
&& sBulkFetchCount<=0) ? TRUE : FALSE ) ;
}
-class fetchDescendentsResponder: public LLHTTPClient::Responder
+class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::Responder
{
public:
- fetchDescendentsResponder(const LLSD& request_sd) : mRequestSD(request_sd) {};
- //fetchDescendentsResponder() {};
+ LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd) : mRequestSD(request_sd) {};
+ //LLInventoryModelFetchDescendentsResponder() {};
void result(const LLSD& content);
void error(U32 status, const std::string& reason);
public:
@@ -1356,7 +1357,7 @@ class fetchDescendentsResponder: public LLHTTPClient::Responder
};
//If we get back a normal response, handle it here
-void fetchDescendentsResponder::result(const LLSD& content)
+void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
{
if (content.has("folders"))
{
@@ -1423,7 +1424,8 @@ void fetchDescendentsResponder::result(const LLSD& content)
LLSD category = *category_it;
tcategory->fromLLSD(category);
- if (LLInventoryModel::sFullFetchStarted)
+ if (LLInventoryModel::sMyInventoryFetchStarted ||
+ LLInventoryModel::sLibraryFetchStarted)
{
sFetchQueue.push_back(tcategory->getUUID());
}
@@ -1475,20 +1477,16 @@ void fetchDescendentsResponder::result(const LLSD& content)
if (LLInventoryModel::isBulkFetchProcessingComplete())
{
llinfos << "Inventory fetch completed" << llendl;
- if (LLInventoryModel::sFullFetchStarted)
- {
- LLInventoryModel::sAllFoldersFetched = TRUE;
- }
- LLInventoryModel::stopBackgroundFetch();
+ LLInventoryModel::setAllFoldersFetched();
}
gInventory.notifyObservers("fetchDescendents");
}
//If we get back an error (not found, etc...), handle it here
-void fetchDescendentsResponder::error(U32 status, const std::string& reason)
+void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::string& reason)
{
- llinfos << "fetchDescendentsResponder::error "
+ llinfos << "LLInventoryModelFetchDescendentsResponder::error "
<< status << ": " << reason << llendl;
LLInventoryModel::incrBulkFetch(-1);
@@ -1508,11 +1506,7 @@ void fetchDescendentsResponder::error(U32 status, const std::string& reason)
{
if (LLInventoryModel::isBulkFetchProcessingComplete())
{
- if (LLInventoryModel::sFullFetchStarted)
- {
- LLInventoryModel::sAllFoldersFetched = TRUE;
- }
- LLInventoryModel::stopBackgroundFetch();
+ LLInventoryModel::setAllFoldersFetched();
}
}
gInventory.notifyObservers("fetchDescendents");
@@ -1580,7 +1574,8 @@ void LLInventoryModel::bulkFetch(std::string url)
body["folders"].append(folder_sd);
folder_count++;
}
- if (sFullFetchStarted)
+ if (sMyInventoryFetchStarted ||
+ sLibraryFetchStarted)
{ //Already have this folder but append child folders to list.
// add all children to queue
parent_cat_map_t::iterator cat_it = gInventory.mParentChildCategoryTree.find(cat->getUUID());
@@ -1605,22 +1600,18 @@ void LLInventoryModel::bulkFetch(std::string url)
sBulkFetchCount++;
if (body["folders"].size())
{
- LLHTTPClient::post(url, body, new fetchDescendentsResponder(body),300.0);
+ LLHTTPClient::post(url, body, new LLInventoryModelFetchDescendentsResponder(body),300.0);
}
if (body_lib["folders"].size())
{
std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents");
- LLHTTPClient::post(url_lib, body_lib, new fetchDescendentsResponder(body_lib),300.0);
+ LLHTTPClient::post(url_lib, body_lib, new LLInventoryModelFetchDescendentsResponder(body_lib),300.0);
}
sFetchTimer.reset();
}
else if (isBulkFetchProcessingComplete())
{
- if (sFullFetchStarted)
- {
- sAllFoldersFetched = TRUE;
- }
- stopBackgroundFetch();
+ setAllFoldersFetched();
}
}
@@ -1636,7 +1627,6 @@ BOOL LLInventoryModel::backgroundFetchActive()
return sBackgroundFetchActive;
}
-//static
void LLInventoryModel::startBackgroundFetch(const LLUUID& cat_id)
{
if (!sAllFoldersFetched)
@@ -1644,9 +1634,16 @@ void LLInventoryModel::startBackgroundFetch(const LLUUID& cat_id)
sBackgroundFetchActive = TRUE;
if (cat_id.isNull())
{
- if (!sFullFetchStarted)
+ if (!sMyInventoryFetchStarted)
{
- sFullFetchStarted = TRUE;
+ sMyInventoryFetchStarted = TRUE;
+ sFetchQueue.push_back(gInventory.getLibraryRootFolderID());
+ sFetchQueue.push_back(gInventory.getRootFolderID());
+ gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL);
+ }
+ if (!sLibraryFetchStarted)
+ {
+ sLibraryFetchStarted = TRUE;
sFetchQueue.push_back(gInventory.getLibraryRootFolderID());
sFetchQueue.push_back(gInventory.getRootFolderID());
gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL);
@@ -1660,6 +1657,14 @@ void LLInventoryModel::startBackgroundFetch(const LLUUID& cat_id)
sFetchQueue.push_front(cat_id);
gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL);
}
+ if (cat_id == gInventory.getLibraryRootFolderID())
+ {
+ sLibraryFetchStarted = TRUE;
+ }
+ if (cat_id == gInventory.getRootFolderID())
+ {
+ sMyInventoryFetchStarted = TRUE;
+ }
}
}
}
@@ -1681,10 +1686,20 @@ void LLInventoryModel::stopBackgroundFetch()
gIdleCallbacks.deleteFunction(&LLInventoryModel::backgroundFetch, NULL);
sBulkFetchCount=0;
sMinTimeBetweenFetches=0.0f;
-// sFullFetchStarted=FALSE;
}
}
+// static
+void LLInventoryModel::setAllFoldersFetched()
+{
+ if (sMyInventoryFetchStarted &&
+ sLibraryFetchStarted)
+ {
+ sAllFoldersFetched = TRUE;
+ }
+ stopBackgroundFetch();
+}
+
//static
void LLInventoryModel::backgroundFetch(void*)
{
@@ -1703,11 +1718,8 @@ void LLInventoryModel::backgroundFetch(void*)
if (sFetchQueue.empty())
{
llinfos << "Inventory fetch completed" << llendl;
- if (sFullFetchStarted)
- {
- sAllFoldersFetched = TRUE;
- }
- stopBackgroundFetch();
+
+ setAllFoldersFetched();
return;
}
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index b744d821c7..27bbca493d 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -72,6 +72,8 @@ class LLInventoryCollectFunctor;
class LLInventoryModel
{
public:
+ friend class LLInventoryModelFetchDescendentsResponder;
+
enum EHasChildren
{
CHILDREN_NO,
@@ -282,9 +284,6 @@ public:
// Make sure we have the descendents in the structure. Returns true
// if a fetch was performed.
bool fetchDescendentsOf(const LLUUID& folder_id);
-
- // Add categories to a list to be fetched in bulk.
- static void bulkFetch(std::string url);
// call this method to request the inventory.
//void requestFromServer(const LLUUID& agent_id);
@@ -369,15 +368,7 @@ public:
// Utility Functions
void removeItem(const LLUUID& item_id);
- // start and stop background breadth-first fetching of inventory contents
- // this gets triggered when performing a filter-search
- static void startBackgroundFetch(const LLUUID& cat_id = LLUUID::null); // start fetch process
static void findLostItems();
- static BOOL backgroundFetchActive();
- static bool isEverythingFetched();
- static void backgroundFetch(void*); // background fetch idle function
- static void incrBulkFetch(S16 fetching) { sBulkFetchCount+=fetching; if (sBulkFetchCount<0) sBulkFetchCount=0; }
-
// Data about the agent's root folder and root library folder
// are stored here, rather than in LLAgent where it used to be, because
@@ -477,14 +468,11 @@ private:
LLUUID mLibraryRootFolderID;
LLUUID mLibraryOwnerID;
- // completing the fetch once per session should be sufficient
- static BOOL sBackgroundFetchActive;
static BOOL sTimelyFetchPending;
static S32 sNumFetchRetries;
static LLFrameTimer sFetchTimer;
static F32 sMinTimeBetweenFetches;
static F32 sMaxTimeBetweenFetches;
- static S16 sBulkFetchCount;
// Expected inventory cache version
const static S32 sCurrentInvCacheVersion;
@@ -510,11 +498,33 @@ private:
public:
// *NOTE: DEBUG functionality
void dumpInventory() const;
- static bool isBulkFetchProcessingComplete();
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Bulk / Background Fetch
+
+public:
+ // Start and stop background breadth-first fetching of inventory contents.
+ // This gets triggered when performing a filter-search
+ void startBackgroundFetch(const LLUUID& cat_id = LLUUID::null);
+ static BOOL backgroundFetchActive();
+ static bool isEverythingFetched();
+ static void backgroundFetch(void*); // background fetch idle function
+ static void incrBulkFetch(S16 fetching) { sBulkFetchCount+=fetching; if (sBulkFetchCount<0) sBulkFetchCount=0; }
static void stopBackgroundFetch(); // stop fetch process
+ static bool isBulkFetchProcessingComplete();
+
+ // Add categories to a list to be fetched in bulk.
+ static void bulkFetch(std::string url);
- static BOOL sFullFetchStarted;
+private:
+ static BOOL sMyInventoryFetchStarted;
+ static BOOL sLibraryFetchStarted;
static BOOL sAllFoldersFetched;
+ static void setAllFoldersFetched();
+
+ // completing the fetch once per session should be sufficient
+ static BOOL sBackgroundFetchActive;
+ static S16 sBulkFetchCount;
};
// a special inventory model for the agent
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 9856cb2b7f..5417929dbb 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -519,7 +519,7 @@ bool LLViewerInventoryCategory::fetchDescendents()
std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents");
if (!url.empty()) //Capability found. Build up LLSD and use it.
{
- LLInventoryModel::startBackgroundFetch(mUUID);
+ gInventory.startBackgroundFetch(mUUID);
}
else
{ //Deprecated, but if we don't have a capability, use the old system.