diff options
author | Loren Shih <seraph@lindenlab.com> | 2010-06-08 13:53:58 -0400 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2010-06-08 13:53:58 -0400 |
commit | 457df89cef083260c7589eb3d6eefb478d12b0a1 (patch) | |
tree | 6d3599880e9cd38d7ee03f462cebf6b2a51ff984 /indra | |
parent | 2f3019d670e8310f00fe4284a7fc09ee59c0f9bf (diff) |
EXT-7468 Remove all 2.1 COF debugging code
Going through and cleaning up any todos that have "Seraph" attached to it. In this case, did some header file cleanup of llinventorymodelbackgroundfetch and moved some functions protected/const/etc.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llinventorymodelbackgroundfetch.cpp | 87 | ||||
-rw-r--r-- | indra/newview/llinventorymodelbackgroundfetch.h | 86 |
2 files changed, 78 insertions, 95 deletions
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index b4f0947b2c..ce44e37017 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -33,15 +33,14 @@ #include "llviewerprecompiledheaders.h" #include "llinventorymodelbackgroundfetch.h" -// Seraph clean this up #include "llagent.h" +#include "llappviewer.h" +#include "llcallbacklist.h" #include "llinventorypanel.h" #include "llviewercontrol.h" #include "llviewermessage.h" -#include "llviewerwindow.h" -#include "llappviewer.h" #include "llviewerregion.h" -#include "llcallbacklist.h" +#include "llviewerwindow.h" const F32 MAX_TIME_FOR_SINGLE_FETCH = 10.f; const S32 MAX_FETCH_RETRIES = 10; @@ -63,47 +62,47 @@ LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch() { } -bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete() +bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete() const { return mFetchQueue.empty() && mBulkFetchCount<=0; } -bool LLInventoryModelBackgroundFetch::libraryFetchStarted() +bool LLInventoryModelBackgroundFetch::libraryFetchStarted() const { return mRecursiveLibraryFetchStarted; } -bool LLInventoryModelBackgroundFetch::libraryFetchCompleted() +bool LLInventoryModelBackgroundFetch::libraryFetchCompleted() const { return libraryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getLibraryRootFolderID()); } -bool LLInventoryModelBackgroundFetch::libraryFetchInProgress() +bool LLInventoryModelBackgroundFetch::libraryFetchInProgress() const { return libraryFetchStarted() && !libraryFetchCompleted(); } -bool LLInventoryModelBackgroundFetch::inventoryFetchStarted() +bool LLInventoryModelBackgroundFetch::inventoryFetchStarted() const { return mRecursiveInventoryFetchStarted; } -bool LLInventoryModelBackgroundFetch::inventoryFetchCompleted() +bool LLInventoryModelBackgroundFetch::inventoryFetchCompleted() const { return inventoryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getRootFolderID()); } -bool LLInventoryModelBackgroundFetch::inventoryFetchInProgress() +bool LLInventoryModelBackgroundFetch::inventoryFetchInProgress() const { return inventoryFetchStarted() && !inventoryFetchCompleted(); } -bool LLInventoryModelBackgroundFetch::isEverythingFetched() +bool LLInventoryModelBackgroundFetch::isEverythingFetched() const { return mAllFoldersFetched; } -BOOL LLInventoryModelBackgroundFetch::backgroundFetchActive() +BOOL LLInventoryModelBackgroundFetch::backgroundFetchActive() const { return mBackgroundFetchActive; } @@ -132,7 +131,7 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id, BOOL recursive } else { - // specific folder requests go to front of queue + // Specific folder requests go to front of queue. if (mFetchQueue.empty() || mFetchQueue.front().mCatUUID != cat_id) { mFetchQueue.push_front(FetchQueueInfo(cat_id, recursive)); @@ -187,7 +186,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() { if (mBackgroundFetchActive && gAgent.getRegion()) { - //If we'll be using the capability, we'll be sending batches and the background thing isn't as important. + // If we'll be using the capability, we'll be sending batches and the background thing isn't as important. std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents"); if (!url.empty()) { @@ -195,8 +194,12 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() return; } - //DEPRECATED OLD CODE FOLLOWS. - // no more categories to fetch, stop fetch process +#if 1 + //-------------------------------------------------------------------------------- + // DEPRECATED OLD CODE + // + + // No more categories to fetch, stop fetch process. if (mFetchQueue.empty()) { llinfos << "Inventory fetch completed" << llendl; @@ -209,11 +212,11 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() F32 slow_fetch_time = lerp(mMinTimeBetweenFetches, mMaxTimeBetweenFetches, 0.5f); if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() > slow_fetch_time) { - // double timeouts on failure + // Double timeouts on failure. mMinTimeBetweenFetches = llmin(mMinTimeBetweenFetches * 2.f, 10.f); mMaxTimeBetweenFetches = llmin(mMaxTimeBetweenFetches * 2.f, 120.f); llinfos << "Inventory fetch times grown to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl; - // fetch is no longer considered "timely" although we will wait for full time-out + // fetch is no longer considered "timely" although we will wait for full time-out. mTimelyFetchPending = FALSE; } @@ -226,14 +229,14 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() if(gDisconnected) { - // just bail if we are disconnected. + // Just bail if we are disconnected. break; } const FetchQueueInfo info = mFetchQueue.front(); LLViewerInventoryCategory* cat = gInventory.getCategory(info.mCatUUID); - // category has been deleted, remove from queue. + // Category has been deleted, remove from queue. if (!cat) { mFetchQueue.pop_front(); @@ -243,8 +246,8 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches && LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion()) { - // category exists but has no children yet, fetch the descendants - // for now, just request every time and rely on retry timer to throttle + // Category exists but has no children yet, fetch the descendants + // for now, just request every time and rely on retry timer to throttle. if (cat->fetch()) { mFetchTimer.reset(); @@ -258,13 +261,13 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() break; } } - // do I have all my children? + // Do I have all my children? else if (gInventory.isCategoryComplete(info.mCatUUID)) { - // finished with this category, remove from queue + // Finished with this category, remove from queue. mFetchQueue.pop_front(); - // add all children to queue + // Add all children to queue. LLInventoryModel::cat_array_t* categories; LLInventoryModel::item_array_t* items; gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items); @@ -275,10 +278,10 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(),info.mRecursive)); } - // we received a response in less than the fast time + // We received a response in less than the fast time. if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() < fast_fetch_time) { - // shrink timeouts based on success + // Shrink timeouts based on success. mMinTimeBetweenFetches = llmax(mMinTimeBetweenFetches * 0.8f, 0.3f); mMaxTimeBetweenFetches = llmax(mMaxTimeBetweenFetches * 0.8f, 10.f); //llinfos << "Inventory fetch times shrunk to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl; @@ -289,8 +292,8 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() } else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches) { - // received first packet, but our num descendants does not match db's num descendants - // so try again later + // Received first packet, but our num descendants does not match db's num descendants + // so try again later. mFetchQueue.pop_front(); if (mNumFetchRetries++ < MAX_FETCH_RETRIES) @@ -303,9 +306,14 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() break; } - // not enough time has elapsed to do a new fetch + // Not enough time has elapsed to do a new fetch break; } + + // + // DEPRECATED OLD CODE + //-------------------------------------------------------------------------------- +#endif } } @@ -333,10 +341,10 @@ protected: BOOL getIsRecursive(const LLUUID& cat_id) const; private: LLSD mRequestSD; - uuid_vec_t mRecursiveCatUUIDs; // Hack for storing away which cat fetches are recursive. + uuid_vec_t mRecursiveCatUUIDs; // hack for storing away which cat fetches are recursive }; -//If we get back a normal response, handle it here +// If we get back a normal response, handle it here. void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content) { LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance(); @@ -428,7 +436,7 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content) gInventory.updateItem(titem); } - // set version and descendentcount according to message. + // Set version and descendentcount according to message. LLViewerInventoryCategory* cat = gInventory.getCategory(parent_id); if(cat) { @@ -448,7 +456,7 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content) { LLSD folder_sd = *folder_it; - //These folders failed on the dataserver. We probably don't want to retry them. + // These folders failed on the dataserver. We probably don't want to retry them. llinfos << "Folder " << folder_sd["folder_id"].asString() << "Error: " << folder_sd["error"].asString() << llendl; } @@ -465,7 +473,7 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content) gInventory.notifyObservers("fetchDescendents"); } -//If we get back an error (not found, etc...), handle it here +// If we get back an error (not found, etc...), handle it here. void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::string& reason) { LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance(); @@ -475,7 +483,7 @@ void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::str fetcher->incrBulkFetch(-1); - if (status==499) // Timed out. + if (status==499) // timed out { for(LLSD::array_const_iterator folder_it = mRequestSD["folders"].beginArray(); folder_it != mRequestSD["folders"].endArray(); @@ -502,7 +510,8 @@ BOOL LLInventoryModelFetchDescendentsResponder::getIsRecursive(const LLUUID& cat return (std::find(mRecursiveCatUUIDs.begin(),mRecursiveCatUUIDs.end(), cat_id) != mRecursiveCatUUIDs.end()); } -//static Bundle up a bunch of requests to send all at once. +// Bundle up a bunch of requests to send all at once. +// static void LLInventoryModelBackgroundFetch::bulkFetch(std::string url) { //Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped. @@ -521,7 +530,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url) (mBulkFetchCount > max_concurrent_fetches) || (mFetchTimer.getElapsedTimeF32() < mMinTimeBetweenFetches)) { - return; // just bail if we are disconnected. + return; // just bail if we are disconnected } U32 folder_count=0; diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h index c1e37eda8f..04f96586d7 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.h +++ b/indra/newview/llinventorymodelbackgroundfetch.h @@ -33,39 +33,15 @@ #ifndef LL_LLINVENTORYMODELBACKGROUNDFETCH_H #define LL_LLINVENTORYMODELBACKGROUNDFETCH_H -// Seraph clean this up -#include "llassettype.h" -#include "llfoldertype.h" -#include "lldarray.h" -#include "llframetimer.h" -#include "llhttpclient.h" +#include "llsingleton.h" #include "lluuid.h" -#include "llpermissionsflags.h" -#include "llstring.h" -#include <map> -#include <set> -#include <string> -#include <vector> - -// Seraph clean this up -class LLInventoryObserver; -class LLInventoryObject; -class LLInventoryItem; -class LLInventoryCategory; -class LLViewerInventoryItem; -class LLViewerInventoryCategory; -class LLViewerInventoryItem; -class LLViewerInventoryCategory; -class LLMessageSystem; -class LLInventoryCollectFunctor; - //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryModelBackgroundFetch // -// This class handles background fetch. +// This class handles background fetches, which are fetches of +// inventory folder. Fetches can be recursive or not. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackgroundFetch> { friend class LLInventoryModelFetchDescendentsResponder; @@ -75,48 +51,37 @@ public: ~LLInventoryModelBackgroundFetch(); // Start and stop background breadth-first fetching of inventory contents. - // This gets triggered when performing a filter-search + // This gets triggered when performing a filter-search. void start(const LLUUID& cat_id = LLUUID::null, BOOL recursive = TRUE); - BOOL backgroundFetchActive(); - bool isEverythingFetched(); - void incrBulkFetch(S16 fetching); - void stopBackgroundFetch(); // stop fetch process - bool isBulkFetchProcessingComplete(); - // Add categories to a list to be fetched in bulk. - void bulkFetch(std::string url); + BOOL backgroundFetchActive() const; + bool isEverythingFetched() const; // completing the fetch once per session should be sufficient - bool libraryFetchStarted(); - bool libraryFetchCompleted(); - bool libraryFetchInProgress(); + bool libraryFetchStarted() const; + bool libraryFetchCompleted() const; + bool libraryFetchInProgress() const; - bool inventoryFetchStarted(); - bool inventoryFetchCompleted(); - bool inventoryFetchInProgress(); - void findLostItems(); + bool inventoryFetchStarted() const; + bool inventoryFetchCompleted() const; + bool inventoryFetchInProgress() const; - void setAllFoldersFetched(); + void findLostItems(); +protected: + void incrBulkFetch(S16 fetching); + bool isBulkFetchProcessingComplete() const; + void bulkFetch(std::string url); - static void backgroundFetchCB(void*); // background fetch idle function void backgroundFetch(); - - struct FetchQueueInfo - { - FetchQueueInfo(const LLUUID& id, BOOL recursive) : - mCatUUID(id), mRecursive(recursive) - { - } - LLUUID mCatUUID; - BOOL mRecursive; - }; -protected: + static void backgroundFetchCB(void*); // background fetch idle function + void stopBackgroundFetch(); // stop fetch process + + void setAllFoldersFetched(); bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) const; private: BOOL mRecursiveInventoryFetchStarted; BOOL mRecursiveLibraryFetchStarted; BOOL mAllFoldersFetched; - // completing the fetch once per session should be sufficient BOOL mBackgroundFetchActive; S16 mBulkFetchCount; BOOL mTimelyFetchPending; @@ -126,6 +91,15 @@ private: F32 mMinTimeBetweenFetches; F32 mMaxTimeBetweenFetches; + struct FetchQueueInfo + { + FetchQueueInfo(const LLUUID& id, BOOL recursive) : + mCatUUID(id), mRecursive(recursive) + { + } + LLUUID mCatUUID; + BOOL mRecursive; + }; typedef std::deque<FetchQueueInfo> fetch_queue_t; fetch_queue_t mFetchQueue; }; |