Sync LLAssetUploadResponders with upstream
Move LLSendTexLayerResponder into llviewertexlayer.cpp to reduce diff noise
This commit is contained in:
@@ -905,7 +905,6 @@ AIHTTPTimeoutPolicy const* AIHTTPTimeoutPolicy::getTimeoutPolicyByName(std::stri
|
||||
#define P2(n, b) AIHTTPTimeoutPolicy n##_timeout(#n, b)
|
||||
|
||||
// Policy name Policy
|
||||
P(assetUploadResponder);
|
||||
P(assetReportHandler);
|
||||
P(avatarPickerResponder);
|
||||
P(authHandler);
|
||||
@@ -952,7 +951,6 @@ P2(meshPhysicsShapeResponder, connect_30s);
|
||||
P2(meshSkinInfoResponder, connect_30s);
|
||||
P(mimeDiscoveryResponder);
|
||||
P(moderationResponder);
|
||||
P(newAgentInventoryVariablePriceResponder);
|
||||
P(objectCostResponder);
|
||||
P(physicsFlagsResponder);
|
||||
P(productInfoRequestResponder);
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "llagent.h"
|
||||
#include "llcompilequeue.h"
|
||||
#include "llfloaterbuycurrency.h"
|
||||
#include "statemachine/aifilepicker.h"
|
||||
#include "llinventorydefines.h"
|
||||
#include "llinventoryobserver.h"
|
||||
#include "llinventorypanel.h"
|
||||
@@ -66,8 +67,6 @@
|
||||
#include "llsdutil.h"
|
||||
#include "llvfs.h"
|
||||
|
||||
#include "statemachine/aifilepicker.h"
|
||||
|
||||
// When uploading multiple files, don't display any of them when uploading more than this number.
|
||||
static const S32 FILE_COUNT_DISPLAY_THRESHOLD = 5;
|
||||
|
||||
@@ -190,9 +189,10 @@ void on_new_single_inventory_upload_complete(
|
||||
LLAssetUploadResponder::LLAssetUploadResponder(const LLSD &post_data,
|
||||
const LLUUID& vfile_id,
|
||||
LLAssetType::EType asset_type)
|
||||
: mPostData(post_data),
|
||||
mVFileID(vfile_id),
|
||||
mAssetType(asset_type)
|
||||
:
|
||||
mPostData(post_data),
|
||||
mVFileID(vfile_id),
|
||||
mAssetType(asset_type)
|
||||
{
|
||||
if (!gVFS->getExists(vfile_id, asset_type))
|
||||
{
|
||||
@@ -207,9 +207,10 @@ LLAssetUploadResponder::LLAssetUploadResponder(
|
||||
const LLSD &post_data,
|
||||
const std::string& file_name,
|
||||
LLAssetType::EType asset_type)
|
||||
: mPostData(post_data),
|
||||
mFileName(file_name),
|
||||
mAssetType(asset_type)
|
||||
:
|
||||
mPostData(post_data),
|
||||
mFileName(file_name),
|
||||
mAssetType(asset_type)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -223,7 +224,7 @@ LLAssetUploadResponder::~LLAssetUploadResponder()
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLAssetUploadResponder::httpFailure(void)
|
||||
void LLAssetUploadResponder::httpFailure()
|
||||
{
|
||||
llinfos << "LLAssetUploadResponder::error " << mStatus
|
||||
<< " reason: " << mReason << llendl;
|
||||
@@ -248,15 +249,21 @@ void LLAssetUploadResponder::httpFailure(void)
|
||||
}
|
||||
|
||||
//virtual
|
||||
void LLAssetUploadResponder::httpSuccess(void)
|
||||
void LLAssetUploadResponder::httpSuccess()
|
||||
{
|
||||
const LLSD& content = getContent();
|
||||
if (!content.isMap())
|
||||
{
|
||||
failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content);
|
||||
return;
|
||||
}
|
||||
lldebugs << "LLAssetUploadResponder::result from capabilities" << llendl;
|
||||
|
||||
std::string state = mContent["state"];
|
||||
const std::string& state = content["state"].asString();
|
||||
|
||||
if (state == "upload")
|
||||
{
|
||||
uploadUpload(mContent);
|
||||
uploadUpload(content);
|
||||
}
|
||||
else if (state == "complete")
|
||||
{
|
||||
@@ -264,20 +271,20 @@ void LLAssetUploadResponder::httpSuccess(void)
|
||||
if (mFileName.empty())
|
||||
{
|
||||
// rename the file in the VFS to the actual asset id
|
||||
// llinfos << "Changing uploaded asset UUID to " << mContent["new_asset"].asUUID() << llendl;
|
||||
gVFS->renameFile(mVFileID, mAssetType, mContent["new_asset"].asUUID(), mAssetType);
|
||||
// LL_INFOS() << "Changing uploaded asset UUID to " << content["new_asset"].asUUID() << LL_ENDL;
|
||||
gVFS->renameFile(mVFileID, mAssetType, content["new_asset"].asUUID(), mAssetType);
|
||||
}
|
||||
uploadComplete(mContent);
|
||||
uploadComplete(content);
|
||||
}
|
||||
else
|
||||
{
|
||||
uploadFailure(mContent);
|
||||
uploadFailure(content);
|
||||
}
|
||||
}
|
||||
|
||||
void LLAssetUploadResponder::uploadUpload(const LLSD& content)
|
||||
{
|
||||
std::string uploader = content["uploader"];
|
||||
const std::string& uploader = content["uploader"].asString();
|
||||
if (mFileName.empty())
|
||||
{
|
||||
LLHTTPClient::postFile(uploader, mVFileID, mAssetType, this);
|
||||
@@ -293,7 +300,7 @@ void LLAssetUploadResponder::uploadFailure(const LLSD& content)
|
||||
// remove the "Uploading..." message
|
||||
LLUploadDialog::modalUploadFinished();
|
||||
|
||||
std::string reason = content["state"];
|
||||
const std::string& reason = content["state"].asString();
|
||||
// deal with L$ errors
|
||||
if (reason == "insufficient funds")
|
||||
{
|
||||
@@ -316,10 +323,8 @@ void LLAssetUploadResponder::uploadComplete(const LLSD& content)
|
||||
LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(
|
||||
const LLSD& post_data,
|
||||
const LLUUID& vfile_id,
|
||||
LLAssetType::EType asset_type,
|
||||
void (*callback)(bool, void*),
|
||||
void* user_data)
|
||||
: LLAssetUploadResponder(post_data, vfile_id, asset_type), mCallBack(callback), mUserData(user_data)
|
||||
LLAssetType::EType asset_type)
|
||||
: LLAssetUploadResponder(post_data, vfile_id, asset_type)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -327,17 +332,13 @@ LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(
|
||||
const LLSD& post_data,
|
||||
const std::string& file_name,
|
||||
LLAssetType::EType asset_type)
|
||||
: LLAssetUploadResponder(post_data, file_name, asset_type), mCallBack(NULL), mUserData(NULL)
|
||||
: LLAssetUploadResponder(post_data, file_name, asset_type)
|
||||
{
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLNewAgentInventoryResponder::httpFailure(void)
|
||||
void LLNewAgentInventoryResponder::httpFailure()
|
||||
{
|
||||
if (mCallBack)
|
||||
{
|
||||
(*mCallBack)(false, mUserData);
|
||||
}
|
||||
LLAssetUploadResponder::httpFailure();
|
||||
//LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, LLUUID(), FALSE);
|
||||
}
|
||||
@@ -346,10 +347,6 @@ void LLNewAgentInventoryResponder::httpFailure(void)
|
||||
//virtual
|
||||
void LLNewAgentInventoryResponder::uploadFailure(const LLSD& content)
|
||||
{
|
||||
if (mCallBack)
|
||||
{
|
||||
(*mCallBack)(false, mUserData);
|
||||
}
|
||||
LLAssetUploadResponder::uploadFailure(content);
|
||||
|
||||
//LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, content["new_asset"], FALSE);
|
||||
@@ -360,14 +357,9 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
|
||||
{
|
||||
lldebugs << "LLNewAgentInventoryResponder::result from capabilities" << llendl;
|
||||
|
||||
if (mCallBack)
|
||||
{
|
||||
(*mCallBack)(true, mUserData);
|
||||
}
|
||||
|
||||
//std::ostringstream llsdxml;
|
||||
//LLSDSerialize::toXML(content, llsdxml);
|
||||
//llinfos << "upload complete content:\n " << llsdxml.str() << llendl;
|
||||
//LL_INFOS() << "upload complete content:\n " << llsdxml.str() << LL_ENDL;
|
||||
|
||||
LLAssetType::EType asset_type = LLAssetType::lookup(mPostData["asset_type"].asString());
|
||||
LLInventoryType::EType inventory_type = LLInventoryType::lookup(mPostData["inventory_type"].asString());
|
||||
@@ -456,57 +448,6 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
|
||||
*/
|
||||
}
|
||||
|
||||
LLSendTexLayerResponder::LLSendTexLayerResponder(const LLSD& post_data,
|
||||
const LLUUID& vfile_id,
|
||||
LLAssetType::EType asset_type,
|
||||
LLBakedUploadData * baked_upload_data) :
|
||||
LLAssetUploadResponder(post_data, vfile_id, asset_type),
|
||||
mBakedUploadData(baked_upload_data)
|
||||
{
|
||||
}
|
||||
|
||||
LLSendTexLayerResponder::~LLSendTexLayerResponder()
|
||||
{
|
||||
// mBakedUploadData is normally deleted by calls to LLViewerTexLayerSetBuffer::onTextureUploadComplete() below
|
||||
if (mBakedUploadData)
|
||||
{ // ...but delete it in the case where uploadComplete() is never called
|
||||
delete mBakedUploadData;
|
||||
mBakedUploadData = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Baked texture upload completed
|
||||
void LLSendTexLayerResponder::uploadComplete(const LLSD& content)
|
||||
{
|
||||
LLUUID item_id = mPostData["item_id"];
|
||||
|
||||
std::string result = content["state"];
|
||||
LLUUID new_id = content["new_asset"];
|
||||
|
||||
llinfos << "result: " << result << " new_id: " << new_id << llendl;
|
||||
if (result == "complete"
|
||||
&& mBakedUploadData != NULL)
|
||||
{ // Invoke
|
||||
LLViewerTexLayerSetBuffer::onTextureUploadComplete(new_id, (void*) mBakedUploadData, 0, LL_EXSTAT_NONE);
|
||||
mBakedUploadData = NULL; // deleted in onTextureUploadComplete()
|
||||
}
|
||||
else
|
||||
{ // Invoke the original callback with an error result
|
||||
LLViewerTexLayerSetBuffer::onTextureUploadComplete(new_id, (void*) mBakedUploadData, -1, LL_EXSTAT_NONE);
|
||||
mBakedUploadData = NULL; // deleted in onTextureUploadComplete()
|
||||
}
|
||||
}
|
||||
|
||||
void LLSendTexLayerResponder::httpFailure(void)
|
||||
{
|
||||
llinfos << "status: " << mStatus << " reason: " << mReason << llendl;
|
||||
|
||||
// Invoke the original callback with an error result
|
||||
LLViewerTexLayerSetBuffer::onTextureUploadComplete(LLUUID(), (void*) mBakedUploadData, -1, LL_EXSTAT_NONE);
|
||||
mBakedUploadData = NULL; // deleted in onTextureUploadComplete()
|
||||
}
|
||||
|
||||
LLUpdateAgentInventoryResponder::LLUpdateAgentInventoryResponder(
|
||||
const LLSD& post_data,
|
||||
const LLUUID& vfile_id,
|
||||
@@ -533,7 +474,7 @@ void LLUpdateAgentInventoryResponder::uploadComplete(const LLSD& content)
|
||||
if(!item)
|
||||
{
|
||||
llwarns << "Inventory item for " << mVFileID
|
||||
<< " is no longer in agent inventory." << llendl;
|
||||
<< " is no longer in agent inventory." << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -544,7 +485,7 @@ void LLUpdateAgentInventoryResponder::uploadComplete(const LLSD& content)
|
||||
gInventory.notifyObservers();
|
||||
|
||||
llinfos << "Inventory item " << item->getName() << " saved into "
|
||||
<< content["new_asset"].asString() << llendl;
|
||||
<< content["new_asset"].asString() << LL_ENDL;
|
||||
|
||||
LLInventoryType::EType inventory_type = new_item->getInventoryType();
|
||||
switch(inventory_type)
|
||||
@@ -605,6 +546,7 @@ void LLUpdateAgentInventoryResponder::uploadComplete(const LLSD& content)
|
||||
{
|
||||
previewp->onUpdateSucceeded();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case LLInventoryType::IT_WEARABLE:
|
||||
@@ -650,8 +592,7 @@ void LLUpdateTaskInventoryResponder::uploadComplete(const LLSD& content)
|
||||
case LLAssetType::AT_NOTECARD:
|
||||
{
|
||||
// Update the UI with the new asset.
|
||||
LLPreviewNotecard* nc;
|
||||
nc = (LLPreviewNotecard*)LLPreview::find(item_id);
|
||||
LLPreviewNotecard* nc = (LLPreviewNotecard*)LLPreview::find(item_id);
|
||||
if (nc)
|
||||
{
|
||||
// *HACK: we have to delete the asset in the VFS so
|
||||
@@ -674,8 +615,7 @@ void LLUpdateTaskInventoryResponder::uploadComplete(const LLSD& content)
|
||||
{
|
||||
if (mQueueId.notNull())
|
||||
{
|
||||
LLFloaterCompileQueue* queue =
|
||||
(LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId);
|
||||
LLFloaterCompileQueue* queue = (LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId);
|
||||
if (NULL != queue)
|
||||
{
|
||||
queue->removeItemByItemID(item_id);
|
||||
@@ -724,7 +664,7 @@ public:
|
||||
{
|
||||
llwarns
|
||||
<< "LLAssetUploadResponder called with nonexistant "
|
||||
<< "vfile_id " << vfile_id << llendl;
|
||||
<< "vfile_id " << vfile_id << LL_ENDL;
|
||||
mVFileID.setNull();
|
||||
mAssetType = LLAssetType::AT_NONE;
|
||||
}
|
||||
@@ -1020,17 +960,15 @@ LLNewAgentInventoryVariablePriceResponder::~LLNewAgentInventoryVariablePriceResp
|
||||
delete mImpl;
|
||||
}
|
||||
|
||||
void LLNewAgentInventoryVariablePriceResponder::httpFailure(void)
|
||||
void LLNewAgentInventoryVariablePriceResponder::httpFailure()
|
||||
{
|
||||
lldebugs
|
||||
<< "LLNewAgentInventoryVariablePrice::error " << mStatus
|
||||
<< " reason: " << mReason << llendl;
|
||||
const LLSD& content = getContent();
|
||||
LL_WARNS("Upload") << dumpResponse() << LL_ENDL;
|
||||
|
||||
if ( mContent.has("error") )
|
||||
{
|
||||
static const std::string _ERROR = "error";
|
||||
|
||||
mImpl->onTransportError(mContent[_ERROR]);
|
||||
if ( content.has(_ERROR) )
|
||||
{
|
||||
mImpl->onTransportError(content[_ERROR]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1038,8 +976,14 @@ void LLNewAgentInventoryVariablePriceResponder::httpFailure(void)
|
||||
}
|
||||
}
|
||||
|
||||
void LLNewAgentInventoryVariablePriceResponder::httpSuccess(void)
|
||||
void LLNewAgentInventoryVariablePriceResponder::httpSuccess()
|
||||
{
|
||||
const LLSD& content = getContent();
|
||||
if (!content.isMap())
|
||||
{
|
||||
failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content);
|
||||
return;
|
||||
}
|
||||
// Parse out application level errors and the appropriate
|
||||
// responses for them
|
||||
static const std::string _ERROR = "error";
|
||||
@@ -1053,13 +997,14 @@ void LLNewAgentInventoryVariablePriceResponder::httpSuccess(void)
|
||||
static const std::string _RSVP = "rsvp";
|
||||
|
||||
// Check for application level errors
|
||||
if (mContent.has(_ERROR))
|
||||
if ( content.has(_ERROR) )
|
||||
{
|
||||
onApplicationLevelError(mContent[_ERROR]);
|
||||
LL_WARNS("Upload") << dumpResponse() << LL_ENDL;
|
||||
onApplicationLevelError(content[_ERROR]);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string state = mContent[_STATE];
|
||||
std::string state = content[_STATE];
|
||||
LLAssetType::EType asset_type = mImpl->getAssetType();
|
||||
|
||||
if (_COMPLETE == state)
|
||||
@@ -1068,11 +1013,11 @@ void LLNewAgentInventoryVariablePriceResponder::httpSuccess(void)
|
||||
if (mImpl->getFilename().empty())
|
||||
{
|
||||
// rename the file in the VFS to the actual asset id
|
||||
// llinfos << "Changing uploaded asset UUID to " << mContent["new_asset"].asUUID() << llendl;
|
||||
// LL_INFOS() << "Changing uploaded asset UUID to " << content["new_asset"].asUUID() << LL_ENDL;
|
||||
gVFS->renameFile(
|
||||
mImpl->getVFileID(),
|
||||
asset_type,
|
||||
mContent["new_asset"].asUUID(),
|
||||
content["new_asset"].asUUID(),
|
||||
asset_type);
|
||||
}
|
||||
|
||||
@@ -1083,8 +1028,8 @@ void LLNewAgentInventoryVariablePriceResponder::httpSuccess(void)
|
||||
mImpl->getFolderID(),
|
||||
mImpl->getItemName(),
|
||||
mImpl->getItemDescription(),
|
||||
mContent,
|
||||
mContent[_UPLOAD_PRICE].asInteger());
|
||||
content,
|
||||
content[_UPLOAD_PRICE].asInteger());
|
||||
|
||||
// TODO* Add bulk (serial) uploading or add
|
||||
// a super class of this that does so
|
||||
@@ -1092,12 +1037,13 @@ void LLNewAgentInventoryVariablePriceResponder::httpSuccess(void)
|
||||
else if ( _CONFIRM_UPLOAD == state )
|
||||
{
|
||||
showConfirmationDialog(
|
||||
mContent[_UPLOAD_PRICE].asInteger(),
|
||||
mContent[_RESOURCE_COST].asInteger(),
|
||||
mContent[_RSVP].asString());
|
||||
content[_UPLOAD_PRICE].asInteger(),
|
||||
content[_RESOURCE_COST].asInteger(),
|
||||
content[_RSVP].asString());
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS("Upload") << dumpResponse() << LL_ENDL;
|
||||
onApplicationLevelError("");
|
||||
}
|
||||
}
|
||||
@@ -1170,3 +1116,4 @@ void LLNewAgentInventoryVariablePriceResponder::showConfirmationDialog(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,10 +36,6 @@
|
||||
#include "llhttpclient.h"
|
||||
#include "llinventory.h"
|
||||
|
||||
class AIHTTPTimeoutPolicy;
|
||||
extern AIHTTPTimeoutPolicy assetUploadResponder_timeout;
|
||||
extern AIHTTPTimeoutPolicy newAgentInventoryVariablePriceResponder_timeout;
|
||||
|
||||
void on_new_single_inventory_upload_complete(LLAssetType::EType asset_type,
|
||||
LLInventoryType::EType inventory_type,
|
||||
const std::string inventory_type_string,
|
||||
@@ -53,6 +49,8 @@ void on_new_single_inventory_upload_complete(LLAssetType::EType asset_type,
|
||||
// via capabilities
|
||||
class LLAssetUploadResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
protected:
|
||||
LOG_CLASS(LLAssetUploadResponder);
|
||||
public:
|
||||
LLAssetUploadResponder(const LLSD& post_data,
|
||||
const LLUUID& vfile_id,
|
||||
@@ -61,10 +59,12 @@ public:
|
||||
const std::string& file_name,
|
||||
LLAssetType::EType asset_type);
|
||||
~LLAssetUploadResponder();
|
||||
/*virtual*/ void httpFailure(void);
|
||||
/*virtual*/ void httpSuccess(void);
|
||||
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return assetUploadResponder_timeout; }
|
||||
|
||||
protected:
|
||||
virtual void httpFailure();
|
||||
virtual void httpSuccess();
|
||||
|
||||
public:
|
||||
virtual void uploadUpload(const LLSD& content);
|
||||
virtual void uploadComplete(const LLSD& content);
|
||||
virtual void uploadFailure(const LLSD& content);
|
||||
@@ -76,25 +76,24 @@ protected:
|
||||
std::string mFileName;
|
||||
};
|
||||
|
||||
// TODO*: Remove this once deprecated
|
||||
class LLNewAgentInventoryResponder : public LLAssetUploadResponder
|
||||
{
|
||||
void (*mCallBack)(bool, void*);
|
||||
void* mUserData;
|
||||
LOG_CLASS(LLNewAgentInventoryResponder);
|
||||
public:
|
||||
LLNewAgentInventoryResponder(
|
||||
const LLSD& post_data,
|
||||
const LLUUID& vfile_id,
|
||||
LLAssetType::EType asset_type,
|
||||
void (*callback)(bool, void*) = NULL,
|
||||
void* user_data = NULL);
|
||||
LLAssetType::EType asset_type);
|
||||
LLNewAgentInventoryResponder(
|
||||
const LLSD& post_data,
|
||||
const std::string& file_name,
|
||||
LLAssetType::EType asset_type);
|
||||
/*virtual*/ void httpFailure(void);
|
||||
virtual void uploadComplete(const LLSD& content);
|
||||
virtual void uploadFailure(const LLSD& content);
|
||||
/*virtual*/ char const* getName(void) const { return "LLNewAgentInventoryResponder"; }
|
||||
/*virtual*/ char const* getName() const { return "LLNewAgentInventoryResponder"; }
|
||||
protected:
|
||||
virtual void httpFailure();
|
||||
};
|
||||
|
||||
// A base class which goes through and performs some default
|
||||
@@ -104,6 +103,7 @@ public:
|
||||
class LLNewAgentInventoryVariablePriceResponder :
|
||||
public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
LOG_CLASS(LLNewAgentInventoryVariablePriceResponder);
|
||||
public:
|
||||
LLNewAgentInventoryVariablePriceResponder(
|
||||
const LLUUID& vfile_id,
|
||||
@@ -116,10 +116,11 @@ public:
|
||||
const LLSD& inventory_info);
|
||||
virtual ~LLNewAgentInventoryVariablePriceResponder();
|
||||
|
||||
/*virtual*/ void httpFailure(void);
|
||||
/*virtual*/ void httpSuccess(void);
|
||||
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return newAgentInventoryVariablePriceResponder_timeout; }
|
||||
private:
|
||||
/* virtual */ void httpFailure();
|
||||
/* virtual */ void httpSuccess();
|
||||
|
||||
public:
|
||||
virtual void onApplicationLevelError(
|
||||
const LLSD& error);
|
||||
virtual void showConfirmationDialog(
|
||||
@@ -132,25 +133,6 @@ private:
|
||||
Impl* mImpl;
|
||||
};
|
||||
|
||||
struct LLBakedUploadData;
|
||||
class LLSendTexLayerResponder : public LLAssetUploadResponder
|
||||
{
|
||||
LOG_CLASS(LLSendTexLayerResponder);
|
||||
public:
|
||||
LLSendTexLayerResponder(const LLSD& post_data,
|
||||
const LLUUID& vfile_id,
|
||||
LLAssetType::EType asset_type,
|
||||
LLBakedUploadData * baked_upload_data);
|
||||
|
||||
~LLSendTexLayerResponder();
|
||||
|
||||
/*virtual*/ void uploadComplete(const LLSD& content);
|
||||
/*virtual*/ void httpFailure(void);
|
||||
/*virtual*/ char const* getName(void) const { return "LLSendTexLayerResponder"; }
|
||||
|
||||
LLBakedUploadData * mBakedUploadData;
|
||||
};
|
||||
|
||||
class LLUpdateAgentInventoryResponder : public LLAssetUploadResponder
|
||||
{
|
||||
public:
|
||||
@@ -161,7 +143,7 @@ public:
|
||||
const std::string& file_name,
|
||||
LLAssetType::EType asset_type);
|
||||
virtual void uploadComplete(const LLSD& content);
|
||||
/*virtual*/ char const* getName(void) const { return "LLUpdateAgentInventoryResponder"; }
|
||||
/*virtual*/ char const* getName() const { return "LLUpdateAgentInventoryResponder"; }
|
||||
};
|
||||
|
||||
class LLUpdateTaskInventoryResponder : public LLAssetUploadResponder
|
||||
@@ -179,7 +161,7 @@ public:
|
||||
LLAssetType::EType asset_type);
|
||||
|
||||
virtual void uploadComplete(const LLSD& content);
|
||||
/*virtual*/ char const* getName(void) const { return "LLUpdateTaskInventoryResponder"; }
|
||||
/*virtual*/ char const* getName() const { return "LLUpdateTaskInventoryResponder"; }
|
||||
|
||||
private:
|
||||
LLUUID mQueueId;
|
||||
|
||||
@@ -1426,7 +1426,7 @@ void LLSnapshotLivePreview::saveTexture()
|
||||
LLAssetStorage::LLStoreAssetCallback callback = &LLSnapshotLivePreview::saveTextureDone;
|
||||
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
saveTextureUserData* user_data = new saveTextureUserData(this, sSnapshotIndex, gSavedSettings.getBOOL("TemporaryUpload"));
|
||||
if (!upload_new_resource(tid, // tid
|
||||
if (upload_new_resource(tid, // tid
|
||||
LLAssetType::AT_TEXTURE,
|
||||
"Snapshot : " + pos_string,
|
||||
"Taken by " + who_took_it + " at " + pos_string,
|
||||
@@ -1437,7 +1437,11 @@ void LLSnapshotLivePreview::saveTexture()
|
||||
LLFloaterPerms::getGroupPerms("Uploads"), // that is more permissive than other uploads
|
||||
LLFloaterPerms::getEveryonePerms("Uploads"),
|
||||
"Snapshot : " + pos_string,
|
||||
callback, expected_upload_cost, user_data, &LLSnapshotLivePreview::saveTextureDone2))
|
||||
callback, expected_upload_cost, user_data))
|
||||
{
|
||||
saveTextureDone2(true, user_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Something went wrong.
|
||||
delete user_data;
|
||||
|
||||
@@ -1177,8 +1177,7 @@ bool upload_new_resource(
|
||||
const std::string& display_name,
|
||||
LLAssetStorage::LLStoreAssetCallback callback,
|
||||
S32 expected_upload_cost,
|
||||
void *userdata,
|
||||
void (*callback2)(bool, void*))
|
||||
void *userdata)
|
||||
{
|
||||
if(gDisconnected)
|
||||
{
|
||||
@@ -1230,9 +1229,7 @@ bool upload_new_resource(
|
||||
new LLNewAgentInventoryResponder(
|
||||
body,
|
||||
uuid,
|
||||
asset_type,
|
||||
callback2,
|
||||
userdata));
|
||||
asset_type));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1294,17 +1291,16 @@ bool upload_new_resource(
|
||||
|
||||
LLAssetID generate_asset_id_for_new_upload(const LLTransactionID& tid)
|
||||
{
|
||||
LLAssetID uuid;
|
||||
|
||||
if (gDisconnected)
|
||||
{
|
||||
uuid.setNull();
|
||||
}
|
||||
else
|
||||
{
|
||||
uuid = tid.makeAssetID(gAgent.getSecureSessionID());
|
||||
LLAssetID rv;
|
||||
|
||||
rv.setNull();
|
||||
return rv;
|
||||
}
|
||||
|
||||
LLAssetID uuid = tid.makeAssetID(gAgent.getSecureSessionID());
|
||||
|
||||
return uuid;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,8 +78,7 @@ bool upload_new_resource(const LLTransactionID &tid,
|
||||
const std::string& display_name,
|
||||
LLAssetStorage::LLStoreAssetCallback callback,
|
||||
S32 expected_upload_cost,
|
||||
void *userdata,
|
||||
void (*callback2)(bool, void*) = NULL);
|
||||
void *userdata);
|
||||
|
||||
// The default callback functions, called when 'callback' == NULL (for normal and temporary uploads).
|
||||
// user_data must be a LLResourceData allocated with new (or NULL).
|
||||
|
||||
@@ -361,6 +361,51 @@ BOOL LLViewerTexLayerSetBuffer::requestUpdateImmediate()
|
||||
return result;
|
||||
}
|
||||
|
||||
class LLSendTexLayerResponder : public LLAssetUploadResponder
|
||||
{
|
||||
LOG_CLASS(LLSendTexLayerResponder);
|
||||
public:
|
||||
LLSendTexLayerResponder(const LLSD& post_data, const LLUUID& vfile_id, LLAssetType::EType asset_type, LLBakedUploadData * baked_upload_data)
|
||||
: LLAssetUploadResponder(post_data, vfile_id, asset_type)
|
||||
, mBakedUploadData(baked_upload_data)
|
||||
{}
|
||||
|
||||
~LLSendTexLayerResponder()
|
||||
{
|
||||
// mBakedUploadData is normally deleted by calls to LLViewerTexLayerSetBuffer::onTextureUploadComplete() below
|
||||
if (mBakedUploadData)
|
||||
{ // ...but delete it in the case where uploadComplete() is never called
|
||||
delete mBakedUploadData;
|
||||
mBakedUploadData = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Baked texture upload completed
|
||||
/*virtual*/ void uploadComplete(const LLSD& content)
|
||||
{
|
||||
const std::string& result = content["state"];
|
||||
const LLUUID& new_id = content["new_asset"];
|
||||
|
||||
llinfos << "result: " << result << " new_id: " << new_id << llendl;
|
||||
LLViewerTexLayerSetBuffer::onTextureUploadComplete(new_id, (void*) mBakedUploadData, (result == "complete" && mBakedUploadData) ? 0 : -1, LL_EXSTAT_NONE);
|
||||
mBakedUploadData = NULL; // deleted in onTextureUploadComplete()
|
||||
}
|
||||
|
||||
/*virtual*/ void httpFailure()
|
||||
{
|
||||
llinfos << dumpResponse() << llendl;
|
||||
|
||||
// Invoke the original callback with an error result
|
||||
LLViewerTexLayerSetBuffer::onTextureUploadComplete(LLUUID::null, (void*) mBakedUploadData, -1, LL_EXSTAT_NONE);
|
||||
mBakedUploadData = NULL; // deleted in onTextureUploadComplete()
|
||||
}
|
||||
|
||||
/*virtual*/ char const* getName() const { return "LLSendTexLayerResponder"; }
|
||||
|
||||
private:
|
||||
LLBakedUploadData* mBakedUploadData;
|
||||
};
|
||||
|
||||
// Create the baked texture, send it out to the server, then wait for it to come
|
||||
// back so we can switch to using it.
|
||||
void LLViewerTexLayerSetBuffer::doUpload()
|
||||
|
||||
Reference in New Issue
Block a user