summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2015-07-22 14:56:49 -0700
committerRider Linden <rider@lindenlab.com>2015-07-22 14:56:49 -0700
commit62e83193c55e505d83a9be33cbc30353b6b887d2 (patch)
tree2e04542514a091f1a452dd3e8469a733ac0cc7cd /indra
parent22bd85441b488dd9576bbdeffe9936650f010d78 (diff)
MAINT-5357: Added yield between prepare and post in upload.
Removed some commented out code I had missed earlier Moved costing to virtual function in uploadinfo.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llsnapshotlivepreview.cpp18
-rw-r--r--indra/newview/llviewerassetupload.cpp73
-rw-r--r--indra/newview/llviewerassetupload.h1
3 files changed, 43 insertions, 49 deletions
diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp
index 16f70a1c95..8fb3340db0 100644
--- a/indra/newview/llsnapshotlivepreview.cpp
+++ b/indra/newview/llsnapshotlivepreview.cpp
@@ -1005,7 +1005,6 @@ void LLSnapshotLivePreview::saveTexture()
std::string who_took_it;
LLAgentUI::buildFullname(who_took_it);
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
-#if 1
std::string name = "Snapshot: " + pos_string;
std::string desc = "Taken by " + who_took_it + " at " + pos_string;
@@ -1017,23 +1016,6 @@ void LLSnapshotLivePreview::saveTexture()
upload_new_resource(assetUploadInfo);
-#else
- LLAssetStorage::LLStoreAssetCallback callback = NULL;
- void *userdata = NULL;
-
- upload_new_resource(tid, // tid
- LLAssetType::AT_TEXTURE,
- "Snapshot : " + pos_string,
- "Taken by " + who_took_it + " at " + pos_string,
- 0,
- LLFolderType::FT_SNAPSHOT_CATEGORY,
- LLInventoryType::IT_SNAPSHOT,
- PERM_ALL, // Note: Snapshots to inventory is a special case of content upload
- LLFloaterPerms::getGroupPerms("Uploads"), // that is more permissive than other uploads
- LLFloaterPerms::getEveryonePerms("Uploads"),
- "Snapshot : " + pos_string,
- callback, expected_upload_cost, userdata);
-#endif
gViewerWindow->playSnapshotAnimAndSound();
}
else
diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp
index b00f99cf5c..83d3449b96 100644
--- a/indra/newview/llviewerassetupload.cpp
+++ b/indra/newview/llviewerassetupload.cpp
@@ -148,6 +148,22 @@ void LLResourceUploadInfo::logPreparedUpload()
"Asset Type: " << LLAssetType::lookup(mAssetType) << LL_ENDL;
}
+S32 LLResourceUploadInfo::getEconomyUploadCost()
+{
+ // Update L$ and ownership credit information
+ // since it probably changed on the server
+ if (getAssetType() == LLAssetType::AT_TEXTURE ||
+ getAssetType() == LLAssetType::AT_SOUND ||
+ getAssetType() == LLAssetType::AT_ANIMATION ||
+ getAssetType() == LLAssetType::AT_MESH)
+ {
+ return LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
+ }
+
+ return 0;
+}
+
+
LLUUID LLResourceUploadInfo::finishUpload(LLSD &result)
{
if (getFolderId().isNull())
@@ -660,7 +676,7 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti
return;
}
- //self.yield();
+ llcoro::yield();
if (uploadInfo->showUploadDialog())
{
@@ -686,43 +702,38 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti
std::string uploader = result["uploader"].asString();
- result = httpAdapter->postFileAndYield(httpRequest, uploader, uploadInfo->getAssetId(), uploadInfo->getAssetType());
- httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
- status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
-
- if (!status)
+ bool success = false;
+ if (!uploader.empty() && uploadInfo->getAssetId().notNull())
{
- HandleUploadError(status, result, uploadInfo);
- if (uploadInfo->showUploadDialog())
- LLUploadDialog::modalUploadFinished();
- return;
- }
+ result = httpAdapter->postFileAndYield(httpRequest, uploader, uploadInfo->getAssetId(), uploadInfo->getAssetType());
+ httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
- S32 uploadPrice = 0;
+ if (!status)
+ {
+ HandleUploadError(status, result, uploadInfo);
+ if (uploadInfo->showUploadDialog())
+ LLUploadDialog::modalUploadFinished();
+ return;
+ }
- // Update L$ and ownership credit information
- // since it probably changed on the server
- if (uploadInfo->getAssetType() == LLAssetType::AT_TEXTURE ||
- uploadInfo->getAssetType() == LLAssetType::AT_SOUND ||
- uploadInfo->getAssetType() == LLAssetType::AT_ANIMATION ||
- uploadInfo->getAssetType() == LLAssetType::AT_MESH)
- {
- uploadPrice = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
- }
+ S32 uploadPrice = uploadInfo->getEconomyUploadCost();
- bool success = false;
+ if (uploadPrice > 0)
+ {
+ // this upload costed us L$, update our balance
+ // and display something saying that it cost L$
+ LLStatusBar::sendMoneyBalanceRequest();
- if (uploadPrice > 0)
+ LLSD args;
+ args["AMOUNT"] = llformat("%d", uploadPrice);
+ LLNotificationsUtil::add("UploadPayment", args);
+ }
+ }
+ else
{
- // this upload costed us L$, update our balance
- // and display something saying that it cost L$
- LLStatusBar::sendMoneyBalanceRequest();
-
- LLSD args;
- args["AMOUNT"] = llformat("%d", uploadPrice);
- LLNotificationsUtil::add("UploadPayment", args);
+ LL_WARNS() << "No upload url provided. Nothing uploaded, responding with previous result." << LL_ENDL;
}
-
LLUUID serverInventoryItem = uploadInfo->finishUpload(result);
if (uploadInfo->showInventoryPanel())
diff --git a/indra/newview/llviewerassetupload.h b/indra/newview/llviewerassetupload.h
index 6e036fe526..d41ba7f61b 100644
--- a/indra/newview/llviewerassetupload.h
+++ b/indra/newview/llviewerassetupload.h
@@ -61,6 +61,7 @@ public:
virtual LLSD prepareUpload();
virtual LLSD generatePostBody();
virtual void logPreparedUpload();
+ virtual S32 getEconomyUploadCost();
virtual LLUUID finishUpload(LLSD &result);
LLTransactionID getTransactionId() const { return mTransactionId; }