From b766466b3013e39831bcfcaef5d1089c07202afb Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 26 Feb 2018 09:27:14 -0800 Subject: Added settings inventory object with subtype --- indra/llmessage/llassetstorage.cpp | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'indra/llmessage/llassetstorage.cpp') diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 596d57c7b7..3d93f5aeb8 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -62,6 +62,24 @@ const LLUUID CATEGORIZE_LOST_AND_FOUND_ID(std::string("00000000-0000-0000-0000-0 const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds +namespace +{ + template + bool operator == (const std::function &a, const std::function &b) + { + typedef T(fnType)(U...); + + auto fnPtrA = a.target(); + auto fnPtrB = b.target(); + if (fnPtrA && fnPtrB) + return (*fnPtrA == *fnPtrB); + else if (!fnPtrA && !fnPtrB) + return true; + return false; + } + +} + ///---------------------------------------------------------------------------- /// LLAssetInfo ///---------------------------------------------------------------------------- @@ -160,7 +178,7 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv ) LLBaseDownloadRequest::LLBaseDownloadRequest(const LLUUID &uuid, const LLAssetType::EType type) : mUUID(uuid), mType(type), - mDownCallback(NULL), + mDownCallback(), mUserData(NULL), mHost(), mIsTemp(FALSE), @@ -191,7 +209,7 @@ LLBaseDownloadRequest* LLBaseDownloadRequest::getCopy() LLAssetRequest::LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType type) : LLBaseDownloadRequest(uuid, type), - mUpCallback( NULL ), + mUpCallback(), mInfoCallback( NULL ), mIsLocal(FALSE), mIsUserWaiting(FALSE), @@ -496,7 +514,11 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, BOOL exists = mVFS->getExists(uuid, type); LLVFile file(mVFS, uuid, type); U32 size = exists ? file.getSize() : 0; - + +// LAPRAS TESTING +// if (type == LLAssetType::AT_SETTINGS) +// size = 0; + if (size > 0) { // we've already got the file @@ -1326,9 +1348,13 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, iter != mPendingDownloads.end(); ) { LLAssetRequest* tmp = *iter++; + + //void(*const* cbptr)(LLVFS *, const LLUUID &, LLAssetType::EType, void *, S32, LLExtStat) + auto cbptr = tmp->mDownCallback.target(); + if (type == tmp->getType() && uuid == tmp->getUUID() && - legacyGetDataCallback == tmp->mDownCallback && + (cbptr && (*cbptr == legacyGetDataCallback)) && callback == ((LLLegacyAssetRequest *)tmp->mUserData)->mDownCallback && user_data == ((LLLegacyAssetRequest *)tmp->mUserData)->mUserData) { -- cgit v1.2.3 From 9f2f2a28740274fa23f1cbcee7dcdefaefb2c469 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 27 Feb 2018 09:38:06 -0800 Subject: Replace variadic template with more specific expansion. --- indra/llmessage/llassetstorage.cpp | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'indra/llmessage/llassetstorage.cpp') diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 3d93f5aeb8..2b12a062c3 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -64,20 +64,38 @@ const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds namespace { - template - bool operator == (const std::function &a, const std::function &b) + bool operator == (const LLAssetStorage::LLGetAssetCallback &lhs, const LLAssetStorage::LLGetAssetCallback &rhs) { - typedef T(fnType)(U...); - - auto fnPtrA = a.target(); - auto fnPtrB = b.target(); - if (fnPtrA && fnPtrB) - return (*fnPtrA == *fnPtrB); - else if (!fnPtrA && !fnPtrB) + auto fnPtrLhs = lhs.target(); + auto fnPtrRhs = rhs.target(); + if (fnPtrLhs && fnPtrRhs) + return (*fnPtrLhs == *fnPtrRhs); + else if (!fnPtrLhs && !fnPtrRhs) return true; return false; } +// Rider: This is the general case of the operator declared above. The code compares the callback +// passed into the LLAssetStorage functions to determine if there are duplicated requests for an +// asset. Unfortunately std::function does not provide a direct way to compare two variables so +// we define the operator here. +// XCode is not very happy with the variadic temples in use below so we will just define the specific +// case of comparing two LLGetAssetCallback objects since that is all we really use. +// +// template +// bool operator == (const std::function &a, const std::function &b) +// { +// typedef T(fnType)(U...); +// +// auto fnPtrA = a.target(); +// auto fnPtrB = b.target(); +// if (fnPtrA && fnPtrB) +// return (*fnPtrA == *fnPtrB); +// else if (!fnPtrA && !fnPtrB) +// return true; +// return false; +// } + } ///---------------------------------------------------------------------------- @@ -467,7 +485,7 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse // IW - uuid is passed by value to avoid side effects, please don't re-add & void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, - LLGetAssetCallback callback, + LLAssetStorage::LLGetAssetCallback callback, void *user_data, BOOL is_priority) { -- cgit v1.2.3 From 2401712d1073e85b4b9183d20c6e9274bc874f64 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 20 Feb 2019 15:20:30 -0800 Subject: SL-9660: Next pass cleanup. Removed and downgraded a number of logs. Removed refs to LAPAS. Better sync with legacy regions. --- indra/llmessage/llassetstorage.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/llmessage/llassetstorage.cpp') diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 2b12a062c3..18b2b124e1 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -533,10 +533,6 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLVFile file(mVFS, uuid, type); U32 size = exists ? file.getSize() : 0; -// LAPRAS TESTING -// if (type == LLAssetType::AT_SETTINGS) -// size = 0; - if (size > 0) { // we've already got the file -- cgit v1.2.3