aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden
diff options
context:
space:
mode:
authorJacek Antonelli2010-02-09 21:17:15 -0600
committerJacek Antonelli2010-02-16 18:50:22 -0600
commitf3830dbfa662847d2ed74e5f55c974ffefc92a84 (patch)
treed29ad57092a63065ce44b571a3b2cc3b4a445343 /linden
parentPorted some minor rendering engine changes from Snowglobe. (diff)
downloadmeta-impy-f3830dbfa662847d2ed74e5f55c974ffefc92a84.zip
meta-impy-f3830dbfa662847d2ed74e5f55c974ffefc92a84.tar.gz
meta-impy-f3830dbfa662847d2ed74e5f55c974ffefc92a84.tar.bz2
meta-impy-f3830dbfa662847d2ed74e5f55c974ffefc92a84.tar.xz
Ported some asset storage changes from Snowglobe.
Diffstat (limited to 'linden')
-rw-r--r--linden/indra/llmessage/llassetstorage.cpp42
-rw-r--r--linden/indra/llmessage/llassetstorage.h11
2 files changed, 31 insertions, 22 deletions
diff --git a/linden/indra/llmessage/llassetstorage.cpp b/linden/indra/llmessage/llassetstorage.cpp
index 0fe24eb..16a96b7 100644
--- a/linden/indra/llmessage/llassetstorage.cpp
+++ b/linden/indra/llmessage/llassetstorage.cpp
@@ -64,6 +64,9 @@ const LLUUID CATEGORIZE_LOST_AND_FOUND_ID(std::string("00000000-0000-0000-0000-0
64 64
65const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds 65const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds
66 66
67LLTempAssetStorage::~LLTempAssetStorage()
68{
69}
67 70
68///---------------------------------------------------------------------------- 71///----------------------------------------------------------------------------
69/// LLAssetInfo 72/// LLAssetInfo
@@ -523,19 +526,16 @@ void LLAssetStorage::downloadCompleteCallback(
523 S32 result, 526 S32 result,
524 const LLUUID& file_id, 527 const LLUUID& file_id,
525 LLAssetType::EType file_type, 528 LLAssetType::EType file_type,
526 void* callback_parm_req, LLExtStat ext_status) 529 void* user_data, LLExtStat ext_status)
527{ 530{
528 lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id 531 lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id
529 << "," << LLAssetType::lookup(file_type) << llendl; 532 << "," << LLAssetType::lookup(file_type) << llendl;
530 533 LLAssetRequest* req = (LLAssetRequest*)user_data;
531 // be careful! req may be a ptr to memory already freed (a timeout does this)
532 LLAssetRequest* req = (LLAssetRequest*)callback_parm_req;
533 if(!req) 534 if(!req)
534 { 535 {
535 llwarns << "LLAssetStorage::downloadCompleteCallback called without" 536 llwarns << "LLAssetStorage::downloadCompleteCallback called without"
536 "a valid request." << llendl; 537 "a valid request." << llendl;
537 // we can live with a null pointer, we're not allowed to deref the ptr anyway (see above) 538 return;
538 // return;
539 } 539 }
540 if (!gAssetStorage) 540 if (!gAssetStorage)
541 { 541 {
@@ -559,7 +559,7 @@ void LLAssetStorage::downloadCompleteCallback(
559 if (LL_ERR_NOERR == result) 559 if (LL_ERR_NOERR == result)
560 { 560 {
561 // we might have gotten a zero-size file 561 // we might have gotten a zero-size file
562 LLVFile vfile(gAssetStorage->mVFS, file_id, file_type); 562 LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType());
563 if (vfile.getSize() <= 0) 563 if (vfile.getSize() <= 0)
564 { 564 {
565 llwarns << "downloadCompleteCallback has non-existent or zero-size asset " << req->getUUID() << llendl; 565 llwarns << "downloadCompleteCallback has non-existent or zero-size asset " << req->getUUID() << llendl;
@@ -578,7 +578,7 @@ void LLAssetStorage::downloadCompleteCallback(
578 { 578 {
579 request_list_t::iterator curiter = iter++; 579 request_list_t::iterator curiter = iter++;
580 LLAssetRequest* tmp = *curiter; 580 LLAssetRequest* tmp = *curiter;
581 if ((tmp->getUUID() == file_id) && (tmp->getType() == file_type)) 581 if ((tmp->getUUID() == file_id) && (tmp->getType()== file_type))
582 { 582 {
583 requests.push_front(tmp); 583 requests.push_front(tmp);
584 iter = gAssetStorage->mPendingDownloads.erase(curiter); 584 iter = gAssetStorage->mPendingDownloads.erase(curiter);
@@ -591,7 +591,7 @@ void LLAssetStorage::downloadCompleteCallback(
591 LLAssetRequest* tmp = *curiter; 591 LLAssetRequest* tmp = *curiter;
592 if (tmp->mDownCallback) 592 if (tmp->mDownCallback)
593 { 593 {
594 tmp->mDownCallback(gAssetStorage->mVFS, tmp->getUUID(), tmp->getType(), tmp->mUserData, result, ext_status); 594 tmp->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), tmp->mUserData, result, ext_status);
595 } 595 }
596 delete tmp; 596 delete tmp;
597 } 597 }
@@ -687,10 +687,10 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
687 S32 result, 687 S32 result,
688 const LLUUID& file_id, 688 const LLUUID& file_id,
689 LLAssetType::EType file_type, 689 LLAssetType::EType file_type,
690 void* callback_parm_req, 690 void* user_data,
691 LLExtStat ext_status) 691 LLExtStat ext_status)
692{ 692{
693 LLEstateAssetRequest *req = (LLEstateAssetRequest*)callback_parm_req; 693 LLEstateAssetRequest *req = (LLEstateAssetRequest*)user_data;
694 if(!req) 694 if(!req)
695 { 695 {
696 llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called" 696 llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
@@ -704,10 +704,12 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
704 return; 704 return;
705 } 705 }
706 706
707 req->setUUID(file_id);
708 req->setType(file_type);
707 if (LL_ERR_NOERR == result) 709 if (LL_ERR_NOERR == result)
708 { 710 {
709 // we might have gotten a zero-size file 711 // we might have gotten a zero-size file
710 LLVFile vfile(gAssetStorage->mVFS, file_id, file_type); 712 LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getAType());
711 if (vfile.getSize() <= 0) 713 if (vfile.getSize() <= 0)
712 { 714 {
713 llwarns << "downloadCompleteCallback has non-existent or zero-size asset!" << llendl; 715 llwarns << "downloadCompleteCallback has non-existent or zero-size asset!" << llendl;
@@ -717,9 +719,7 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
717 } 719 }
718 } 720 }
719 721
720 req->mDownCallback(gAssetStorage->mVFS, file_id, file_type, req->mUserData, result, ext_status); 722 req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getAType(), req->mUserData, result, ext_status);
721
722 delete req;
723} 723}
724 724
725void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id, 725void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id,
@@ -824,10 +824,10 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
824 S32 result, 824 S32 result,
825 const LLUUID& file_id, 825 const LLUUID& file_id,
826 LLAssetType::EType file_type, 826 LLAssetType::EType file_type,
827 void* callback_parm_req, 827 void* user_data,
828 LLExtStat ext_status) 828 LLExtStat ext_status)
829{ 829{
830 LLInvItemRequest *req = (LLInvItemRequest*)callback_parm_req; 830 LLInvItemRequest *req = (LLInvItemRequest*)user_data;
831 if(!req) 831 if(!req)
832 { 832 {
833 llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called" 833 llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
@@ -840,10 +840,12 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
840 return; 840 return;
841 } 841 }
842 842
843 req->setUUID(file_id);
844 req->setType(file_type);
843 if (LL_ERR_NOERR == result) 845 if (LL_ERR_NOERR == result)
844 { 846 {
845 // we might have gotten a zero-size file 847 // we might have gotten a zero-size file
846 LLVFile vfile(gAssetStorage->mVFS, file_id, file_type); 848 LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType());
847 if (vfile.getSize() <= 0) 849 if (vfile.getSize() <= 0)
848 { 850 {
849 llwarns << "downloadCompleteCallback has non-existent or zero-size asset!" << llendl; 851 llwarns << "downloadCompleteCallback has non-existent or zero-size asset!" << llendl;
@@ -853,9 +855,7 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
853 } 855 }
854 } 856 }
855 857
856 req->mDownCallback(gAssetStorage->mVFS, file_id, file_type, req->mUserData, result, ext_status); 858 req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), req->mUserData, result, ext_status);
857
858 delete req;
859} 859}
860 860
861///////////////////////////////////////////////////////////////////////////////////////////////////////////////// 861/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/linden/indra/llmessage/llassetstorage.h b/linden/indra/llmessage/llassetstorage.h
index f01ee6a..c094ef4 100644
--- a/linden/indra/llmessage/llassetstorage.h
+++ b/linden/indra/llmessage/llassetstorage.h
@@ -204,7 +204,16 @@ typedef std::map<LLUUID,U64,lluuid_less> toxic_asset_map_t;
204typedef void (*LLGetAssetCallback)(LLVFS *vfs, const LLUUID &asset_id, 204typedef void (*LLGetAssetCallback)(LLVFS *vfs, const LLUUID &asset_id,
205 LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status); 205 LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status);
206 206
207class LLAssetStorage 207class LLTempAssetStorage
208{
209public:
210 virtual ~LLTempAssetStorage() =0;
211 virtual void addTempAssetData(const LLUUID& asset_id,
212 const LLUUID& agent_id,
213 const std::string& host_name) = 0;
214};
215
216class LLAssetStorage : public LLTempAssetStorage
208{ 217{
209public: 218public:
210 // VFS member is public because static child methods need it :( 219 // VFS member is public because static child methods need it :(