diff options
author | Rider Linden <rider@lindenlab.com> | 2015-07-15 14:35:53 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2015-07-15 14:35:53 -0700 |
commit | 1a6a6c786dcb4164c51734e51a4c86c722835e56 (patch) | |
tree | f1ef3f757eb9f7faa0478fba6b2adc0b8e5fe2ff | |
parent | 03c202a47545cac1d7643f5e5c9973f4a476f83d (diff) |
LSL Script upload from inventory.
-rwxr-xr-x | indra/newview/llassetuploadresponders.cpp | 3 | ||||
-rwxr-xr-x | indra/newview/llassetuploadresponders.h | 2 | ||||
-rwxr-xr-x | indra/newview/llfloaterbvhpreview.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llfloaternamedesc.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llpreviewgesture.cpp | 11 | ||||
-rwxr-xr-x | indra/newview/llpreviewnotecard.cpp | 11 | ||||
-rwxr-xr-x | indra/newview/llpreviewscript.cpp | 79 | ||||
-rwxr-xr-x | indra/newview/llpreviewscript.h | 2 | ||||
-rw-r--r-- | indra/newview/llsnapshotlivepreview.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewerassetupload.cpp | 74 | ||||
-rw-r--r-- | indra/newview/llviewerassetupload.h | 27 | ||||
-rwxr-xr-x | indra/newview/llviewermenufile.cpp | 11 | ||||
-rwxr-xr-x | indra/newview/llviewermenufile.h | 2 |
13 files changed, 165 insertions, 63 deletions
diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index fe01288e23..14020af166 100755 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -476,6 +476,7 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) } #endif +#if 0 LLUpdateAgentInventoryResponder::LLUpdateAgentInventoryResponder( const LLSD& post_data, const LLUUID& vfile_id, @@ -582,7 +583,7 @@ void LLUpdateAgentInventoryResponder::uploadComplete(const LLSD& content) break; } } - +#endif LLUpdateTaskInventoryResponder::LLUpdateTaskInventoryResponder(const LLSD& post_data, const LLUUID& vfile_id, diff --git a/indra/newview/llassetuploadresponders.h b/indra/newview/llassetuploadresponders.h index 6828678f09..71995873fa 100755 --- a/indra/newview/llassetuploadresponders.h +++ b/indra/newview/llassetuploadresponders.h @@ -119,6 +119,7 @@ private: }; #endif +#if 0 class LLUpdateAgentInventoryResponder : public LLAssetUploadResponder { public: @@ -130,6 +131,7 @@ public: LLAssetType::EType asset_type); virtual void uploadComplete(const LLSD& content); }; +#endif class LLUpdateTaskInventoryResponder : public LLAssetUploadResponder { diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 39b5a40efc..e5df417ca9 100755 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -994,7 +994,7 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) std::string desc = floaterp->getChild<LLUICtrl>("description_form")->getValue().asString(); S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); - NewResourceUploadInfo::ptr_t assetUpdloadInfo(new NewResourceUploadInfo( + LLResourceUploadInfo::ptr_t assetUpdloadInfo(new LLResourceUploadInfo( floaterp->mTransactionID, LLAssetType::AT_ANIMATION, name, desc, 0, LLFolderType::FT_NONE, LLInventoryType::IT_ANIMATION, diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 6912adfcff..46dbf85dfa 100755 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -164,7 +164,7 @@ void LLFloaterNameDesc::onBtnOK( ) void *nruserdata = NULL; std::string display_name = LLStringUtil::null; - NewResourceUploadInfo::ptr_t uploadInfo(new NewFileResourceUploadInfo( + LLResourceUploadInfo::ptr_t uploadInfo(new NewFileResourceUploadInfo( mFilenameAndPath, getChild<LLUICtrl>("name_form")->getValue().asString(), getChild<LLUICtrl>("description_form")->getValue().asString(), 0, diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 05e4eaf9cf..c1d1b9b03c 100755 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -53,7 +53,6 @@ #include "llviewerregion.h" #include "llviewerstats.h" #include "llviewerassetupload.h" -#include "llcoproceduremanager.h" std::string NONE_LABEL; std::string SHIFT_LABEL; @@ -1097,7 +1096,7 @@ void LLPreviewGesture::saveIfNeeded() if (!agent_url.empty() && !task_url.empty()) { std::string url; - NewResourceUploadInfo::ptr_t uploadInfo; + LLResourceUploadInfo::ptr_t uploadInfo; if (mObjectUUID.isNull() && !agent_url.empty()) { @@ -1108,13 +1107,13 @@ void LLPreviewGesture::saveIfNeeded() refresh(); item->setComplete(true); - uploadInfo = NewResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mItemUUID, LLAssetType::AT_GESTURE, buffer, + uploadInfo = LLResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mItemUUID, LLAssetType::AT_GESTURE, buffer, boost::bind(&finishInventoryUpload, _1, _2))); url = agent_url; } else if (!mObjectUUID.isNull() && !task_url.empty()) { - uploadInfo = NewResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mObjectUUID, mItemUUID, LLAssetType::AT_GESTURE, buffer, NULL)); + uploadInfo = LLResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mObjectUUID, mItemUUID, LLAssetType::AT_GESTURE, buffer, NULL)); url = task_url; } @@ -1122,9 +1121,7 @@ void LLPreviewGesture::saveIfNeeded() { delayedUpload = true; - LLCoprocedureManager::CoProcedure_t proc = boost::bind(&LLViewerAssetUpload::AssetInventoryUploadCoproc, _1, _2, url, uploadInfo); - - LLCoprocedureManager::getInstance()->enqueueCoprocedure("LLViewerAssetUpload::AssetInventoryUploadCoproc", proc); + LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); } } diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index cbd940fb99..be44fbd300 100755 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -56,7 +56,6 @@ #include "llappviewer.h" // app_abort_quit() #include "lllineeditor.h" #include "lluictrlfactory.h" -#include "llcoproceduremanager.h" #include "llviewerassetupload.h" ///---------------------------------------------------------------------------- @@ -471,17 +470,17 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) if (!agent_url.empty() && !task_url.empty()) { std::string url; - NewResourceUploadInfo::ptr_t uploadInfo; + LLResourceUploadInfo::ptr_t uploadInfo; if (mObjectUUID.isNull() && !agent_url.empty()) { - uploadInfo = NewResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mItemUUID, LLAssetType::AT_NOTECARD, buffer, + uploadInfo = LLResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mItemUUID, LLAssetType::AT_NOTECARD, buffer, boost::bind(&finishInventoryUpload, _1, _2, _3))); url = agent_url; } else if (!mObjectUUID.isNull() && !task_url.empty()) { - uploadInfo = NewResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mObjectUUID, mItemUUID, LLAssetType::AT_NOTECARD, buffer, + uploadInfo = LLResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mObjectUUID, mItemUUID, LLAssetType::AT_NOTECARD, buffer, boost::bind(&finishInventoryUpload, _1, _3, LLUUID::null))); url = task_url; } @@ -491,9 +490,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) mAssetStatus = PREVIEW_ASSET_LOADING; setEnabled(false); - LLCoprocedureManager::CoProcedure_t proc = boost::bind(&LLViewerAssetUpload::AssetInventoryUploadCoproc, _1, _2, url, uploadInfo); - - LLCoprocedureManager::getInstance()->enqueueCoprocedure("LLViewerAssetUpload::AssetInventoryUploadCoproc", proc); + LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); } } diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 1bbb22416d..fc565ffa20 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -89,6 +89,7 @@ #include "llexperiencecache.h" #include "llfloaterexperienceprofile.h" #include "llexperienceassociationresponder.h" +#include "llviewerassetupload.h" const std::string HELLO_LSL = "default\n" @@ -1641,20 +1642,79 @@ void LLPreviewLSL::onSave(void* userdata, BOOL close_after_save) self->saveIfNeeded(); } +void finishedLSLUpload(LLUUID itemId, LLSD response) +{ + // Find our window and close it if requested. + LLPreviewLSL* preview = LLFloaterReg::findTypedInstance<LLPreviewLSL>("preview_script", LLSD(itemId)); + if (preview) + { + // Bytecode save completed + if (response["compiled"]) + { + preview->callbackLSLCompileSucceeded(); + } + else + { + preview->callbackLSLCompileFailed(response["errors"]); + } + } +} + // Save needs to compile the text in the buffer. If the compile // succeeds, then save both assets out to the database. If the compile // fails, go ahead and save the text anyway. void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/) { + if (!mScriptEd->hasChanged()) + { + return; + } + + mPendingUploads = 0; + mScriptEd->mErrorList->deleteAllItems(); + mScriptEd->mEditor->makePristine(); + +#if 1 + if (sync) + { + mScriptEd->sync(); + } + + const LLInventoryItem *inv_item = getItem(); + // save it out to asset server + std::string url = gAgent.getRegion()->getCapability("UpdateScriptAgent"); + if(inv_item) + { + getWindow()->incBusyCount(); + mPendingUploads++; + if (!url.empty()) + { + std::string buffer(mScriptEd->mEditor->getText()); + LLBufferedAssetUploadInfo::invnUploadFinish_f proc = boost::bind(&finishedLSLUpload, _1, _4); + + LLResourceUploadInfo::ptr_t uploadInfo(new LLScriptAssetUpload(mItemUUID, buffer, proc)); + + LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); + + } + else if (gAssetStorage) + { + // save off asset into file + LLTransactionID tid; + tid.generate(); + LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); + std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, asset_id.asString()); + std::string filename = filepath + ".lsl"; + + mScriptEd->writeToFile(filename); + + uploadAssetLegacy(filename, mItemUUID, tid); + } + } + + +#else // LL_INFOS() << "LLPreviewLSL::saveIfNeeded()" << LL_ENDL; - if(!mScriptEd->hasChanged()) - { - return; - } - - mPendingUploads = 0; - mScriptEd->mErrorList->deleteAllItems(); - mScriptEd->mEditor->makePristine(); // save off asset into file LLTransactionID tid; @@ -1686,8 +1746,10 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/) uploadAssetLegacy(filename, mItemUUID, tid); } } +#endif } +#if 0 void LLPreviewLSL::uploadAssetViaCaps(const std::string& url, const std::string& filename, const LLUUID& item_id) @@ -1698,6 +1760,7 @@ void LLPreviewLSL::uploadAssetViaCaps(const std::string& url, body["target"] = "lsl2"; LLHTTPClient::post(url, body, new LLUpdateAgentInventoryResponder(body, filename, LLAssetType::AT_LSL_TEXT)); } +#endif void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, const LLUUID& item_id, diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 5f65be7383..954d040bda 100755 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -203,9 +203,11 @@ protected: virtual void loadAsset(); /*virtual*/ void saveIfNeeded(bool sync = true); +#if 0 void uploadAssetViaCaps(const std::string& url, const std::string& filename, const LLUUID& item_id); +#endif // 0 void uploadAssetLegacy(const std::string& filename, const LLUUID& item_id, const LLTransactionID& tid); diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index bbb5db4a0a..16f70a1c95 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -1009,7 +1009,7 @@ void LLSnapshotLivePreview::saveTexture() std::string name = "Snapshot: " + pos_string; std::string desc = "Taken by " + who_took_it + " at " + pos_string; - NewResourceUploadInfo::ptr_t assetUploadInfo(new NewResourceUploadInfo( + LLResourceUploadInfo::ptr_t assetUploadInfo(new LLResourceUploadInfo( tid, LLAssetType::AT_TEXTURE, name, desc, 0, LLFolderType::FT_SNAPSHOT_CATEGORY, LLInventoryType::IT_SNAPSHOT, PERM_ALL, LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index 910e1dc6c5..426e89b9d5 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -49,10 +49,11 @@ #include "llgesturemgr.h" #include "llpreviewnotecard.h" #include "llpreviewgesture.h" +#include "llcoproceduremanager.h" void dialog_refresh_all(); -NewResourceUploadInfo::NewResourceUploadInfo(LLTransactionID transactId, +LLResourceUploadInfo::LLResourceUploadInfo(LLTransactionID transactId, LLAssetType::EType assetType, std::string name, std::string description, S32 compressionInfo, LLFolderType::EType destinationType, LLInventoryType::EType inventoryType, U32 nextOWnerPerms, @@ -74,7 +75,7 @@ NewResourceUploadInfo::NewResourceUploadInfo(LLTransactionID transactId, { } -NewResourceUploadInfo::NewResourceUploadInfo(std::string name, +LLResourceUploadInfo::LLResourceUploadInfo(std::string name, std::string description, S32 compressionInfo, LLFolderType::EType destinationType, LLInventoryType::EType inventoryType, U32 nextOWnerPerms, U32 groupPerms, U32 everyonePerms, S32 expectedCost): @@ -97,7 +98,7 @@ NewResourceUploadInfo::NewResourceUploadInfo(std::string name, } -LLSD NewResourceUploadInfo::prepareUpload() +LLSD LLResourceUploadInfo::prepareUpload() { if (mAssetId.isNull()) generateNewAssetId(); @@ -108,17 +109,17 @@ LLSD NewResourceUploadInfo::prepareUpload() return LLSD().with("success", LLSD::Boolean(true)); } -std::string NewResourceUploadInfo::getAssetTypeString() const +std::string LLResourceUploadInfo::getAssetTypeString() const { return LLAssetType::lookup(mAssetType); } -std::string NewResourceUploadInfo::getInventoryTypeString() const +std::string LLResourceUploadInfo::getInventoryTypeString() const { return LLInventoryType::lookup(mInventoryType); } -LLSD NewResourceUploadInfo::generatePostBody() +LLSD LLResourceUploadInfo::generatePostBody() { LLSD body; @@ -135,7 +136,7 @@ LLSD NewResourceUploadInfo::generatePostBody() } -void NewResourceUploadInfo::logPreparedUpload() +void LLResourceUploadInfo::logPreparedUpload() { LL_INFOS() << "*** Uploading: " << std::endl << "Type: " << LLAssetType::lookup(mAssetType) << std::endl << @@ -147,7 +148,7 @@ void NewResourceUploadInfo::logPreparedUpload() "Asset Type: " << LLAssetType::lookup(mAssetType) << LL_ENDL; } -LLUUID NewResourceUploadInfo::finishUpload(LLSD &result) +LLUUID LLResourceUploadInfo::finishUpload(LLSD &result) { if (getFolderId().isNull()) { @@ -225,7 +226,7 @@ LLUUID NewResourceUploadInfo::finishUpload(LLSD &result) } -LLAssetID NewResourceUploadInfo::generateNewAssetId() +LLAssetID LLResourceUploadInfo::generateNewAssetId() { if (gDisconnected) { @@ -239,7 +240,7 @@ LLAssetID NewResourceUploadInfo::generateNewAssetId() return mAssetId; } -void NewResourceUploadInfo::incrementUploadStats() const +void LLResourceUploadInfo::incrementUploadStats() const { if (LLAssetType::AT_SOUND == mAssetType) { @@ -255,7 +256,7 @@ void NewResourceUploadInfo::incrementUploadStats() const } } -void NewResourceUploadInfo::assignDefaults() +void LLResourceUploadInfo::assignDefaults() { if (LLInventoryType::IT_NONE == mInventoryType) { @@ -279,7 +280,7 @@ void NewResourceUploadInfo::assignDefaults() } -std::string NewResourceUploadInfo::getDisplayName() const +std::string LLResourceUploadInfo::getDisplayName() const { return (mName.empty()) ? mAssetId.asString() : mName; }; @@ -296,7 +297,7 @@ NewFileResourceUploadInfo::NewFileResourceUploadInfo( U32 groupPerms, U32 everyonePerms, S32 expectedCost) : - NewResourceUploadInfo(name, description, compressionInfo, + LLResourceUploadInfo(name, description, compressionInfo, destinationType, inventoryType, nextOWnerPerms, groupPerms, everyonePerms, expectedCost), mFileName(fileName) @@ -314,7 +315,7 @@ LLSD NewFileResourceUploadInfo::prepareUpload() if (result.has("error")) return result; - return NewResourceUploadInfo::prepareUpload(); + return LLResourceUploadInfo::prepareUpload(); } LLSD NewFileResourceUploadInfo::exportTempFile() @@ -443,7 +444,7 @@ LLSD NewFileResourceUploadInfo::exportTempFile() //========================================================================= LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType::EType assetType, std::string buffer, invnUploadFinish_f finish) : - NewResourceUploadInfo(std::string(), std::string(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, + LLResourceUploadInfo(std::string(), std::string(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, 0, 0, 0, 0), mTaskUpload(false), mTaskId(LLUUID::null), @@ -458,7 +459,7 @@ LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType: } LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID taskId, LLUUID itemId, LLAssetType::EType assetType, std::string buffer, taskUploadFinish_f finish) : - NewResourceUploadInfo(std::string(), std::string(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, + LLResourceUploadInfo(std::string(), std::string(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, 0, 0, 0, 0), mTaskUpload(true), mTaskId(taskId), @@ -552,9 +553,46 @@ LLUUID LLBufferedAssetUploadInfo::finishUpload(LLSD &result) } //========================================================================= + +LLScriptAssetUpload::LLScriptAssetUpload(LLUUID itemId, std::string buffer, invnUploadFinish_f finish): + LLBufferedAssetUploadInfo(itemId, LLAssetType::AT_LSL_TEXT, buffer, finish) +{ +} + +// LLScriptAssetUpload::LLScriptAssetUpload(LLUUID taskId, LLUUID itemId, LLAssetType::EType assetType, std::string buffer, taskUploadFinish_f finish): +// LLBufferedAssetUploadInfo() +// { +// } + +LLSD LLScriptAssetUpload::generatePostBody() +{ + LLSD body; + + if (getTaskId().isNull()) + { + body["item_id"] = getItemId(); + body["target"] = "lsl2"; + } + + return body; +} + +//========================================================================= +/*static*/ +LLUUID LLViewerAssetUpload::EnqueueInventoryUpload(const std::string &url, const LLResourceUploadInfo::ptr_t &uploadInfo) +{ + std::string procName("LLViewerAssetUpload::AssetInventoryUploadCoproc("); + + LLUUID queueId = LLCoprocedureManager::getInstance()->enqueueCoprocedure(procName + LLAssetType::lookup(uploadInfo->getAssetType()) + ")", + boost::bind(&LLViewerAssetUpload::AssetInventoryUploadCoproc, _1, _2, url, uploadInfo)); + + return queueId; +} + +//========================================================================= /*static*/ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, - const LLUUID &id, std::string url, NewResourceUploadInfo::ptr_t uploadInfo) + const LLUUID &id, std::string url, LLResourceUploadInfo::ptr_t uploadInfo) { LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); @@ -667,7 +705,7 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti //========================================================================= /*static*/ -void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &result, NewResourceUploadInfo::ptr_t &uploadInfo) +void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &result, LLResourceUploadInfo::ptr_t &uploadInfo) { std::string reason; std::string label("CannotUploadReason"); diff --git a/indra/newview/llviewerassetupload.h b/indra/newview/llviewerassetupload.h index b80166a874..fa8247cb64 100644 --- a/indra/newview/llviewerassetupload.h +++ b/indra/newview/llviewerassetupload.h @@ -35,12 +35,13 @@ #include "llcoros.h" #include "llcorehttputil.h" -class NewResourceUploadInfo +//========================================================================= +class LLResourceUploadInfo { public: - typedef boost::shared_ptr<NewResourceUploadInfo> ptr_t; + typedef boost::shared_ptr<LLResourceUploadInfo> ptr_t; - NewResourceUploadInfo( + LLResourceUploadInfo( LLTransactionID transactId, LLAssetType::EType assetType, std::string name, @@ -53,7 +54,7 @@ public: U32 everyonePerms, S32 expectedCost); - virtual ~NewResourceUploadInfo() + virtual ~LLResourceUploadInfo() { } virtual LLSD prepareUpload(); @@ -84,7 +85,7 @@ public: LLAssetID getAssetId() const { return mAssetId; } protected: - NewResourceUploadInfo( + LLResourceUploadInfo( std::string name, std::string description, S32 compressionInfo, @@ -121,7 +122,8 @@ private: LLAssetID mAssetId; }; -class NewFileResourceUploadInfo : public NewResourceUploadInfo +//------------------------------------------------------------------------- +class NewFileResourceUploadInfo : public LLResourceUploadInfo { public: NewFileResourceUploadInfo( @@ -149,8 +151,8 @@ private: }; - -class LLBufferedAssetUploadInfo : public NewResourceUploadInfo +//------------------------------------------------------------------------- +class LLBufferedAssetUploadInfo : public LLResourceUploadInfo { public: typedef boost::function<void(LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD response)> invnUploadFinish_f; @@ -180,24 +182,27 @@ private: bool mStoredToVFS; }; +//------------------------------------------------------------------------- class LLScriptAssetUpload : public LLBufferedAssetUploadInfo { public: - LLScriptAssetUpload(LLUUID itemId, LLAssetType::EType assetType, std::string buffer, invnUploadFinish_f finish); + LLScriptAssetUpload(LLUUID itemId, std::string buffer, invnUploadFinish_f finish); LLScriptAssetUpload(LLUUID taskId, LLUUID itemId, LLAssetType::EType assetType, std::string buffer, taskUploadFinish_f finish); virtual LLSD generatePostBody(); }; +//========================================================================= class LLViewerAssetUpload { public: + static LLUUID EnqueueInventoryUpload(const std::string &url, const LLResourceUploadInfo::ptr_t &uploadInfo); - static void AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, const LLUUID &id, std::string url, NewResourceUploadInfo::ptr_t uploadInfo); + static void AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, const LLUUID &id, std::string url, LLResourceUploadInfo::ptr_t uploadInfo); private: - static void HandleUploadError(LLCore::HttpStatus status, LLSD &result, NewResourceUploadInfo::ptr_t &uploadInfo); + static void HandleUploadError(LLCore::HttpStatus status, LLSD &result, LLResourceUploadInfo::ptr_t &uploadInfo); }; #endif // !VIEWER_ASSET_UPLOAD_H diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 9c4045fa1e..163ae4f4ec 100755 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -62,7 +62,6 @@ #include "lluploaddialog.h" #include "lltrans.h" #include "llfloaterbuycurrency.h" -#include "llcoproceduremanager.h" #include "llviewerassetupload.h" // linden libraries @@ -437,7 +436,7 @@ class LLFileUploadBulk : public view_listener_t LLStringUtil::stripNonprintable(asset_name); LLStringUtil::trim(asset_name); - NewResourceUploadInfo::ptr_t uploadInfo(new NewFileResourceUploadInfo( + LLResourceUploadInfo::ptr_t uploadInfo(new NewFileResourceUploadInfo( filename, asset_name, asset_name, 0, @@ -636,7 +635,7 @@ LLUUID upload_new_resource( void *userdata) { - NewResourceUploadInfo::ptr_t uploadInfo(new NewFileResourceUploadInfo( + LLResourceUploadInfo::ptr_t uploadInfo(new NewFileResourceUploadInfo( src_filename, name, desc, compression_info, destination_folder_type, inv_type, @@ -775,7 +774,7 @@ void upload_done_callback( } void upload_new_resource( - NewResourceUploadInfo::ptr_t &uploadInfo, + LLResourceUploadInfo::ptr_t &uploadInfo, LLAssetStorage::LLStoreAssetCallback callback, void *userdata) { @@ -792,9 +791,7 @@ void upload_new_resource( if ( !url.empty() ) { - LLCoprocedureManager::CoProcedure_t proc = boost::bind(&LLViewerAssetUpload::AssetInventoryUploadCoproc, _1, _2, url, uploadInfo); - - LLCoprocedureManager::getInstance()->enqueueCoprocedure("LLViewerAssetUpload::AssetInventoryUploadCoproc", proc); + LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); } else { diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h index 616eaed373..0f8fa56b52 100755 --- a/indra/newview/llviewermenufile.h +++ b/indra/newview/llviewermenufile.h @@ -58,7 +58,7 @@ LLUUID upload_new_resource( void *userdata); void upload_new_resource( - NewResourceUploadInfo::ptr_t &uploadInfo, + LLResourceUploadInfo::ptr_t &uploadInfo, LLAssetStorage::LLStoreAssetCallback callback = NULL, void *userdata = NULL); |