From 8d2f7a526545a10cd3669bf837a0b6f02cf5fe71 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 15 Oct 2012 19:43:35 -0700 Subject: SH-3405 WIP convert existing stats to lltrace system converted all remaining LLViewerStats to lltrace --- indra/newview/llcompilequeue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llcompilequeue.cpp') diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 4f5f9e22b6..6739910c38 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -436,7 +436,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, } else { - LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); + //LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ) { -- cgit v1.2.3 From a52d203a4f1d2988e8ffba16258f3f132f22f56d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 17 Oct 2012 20:00:07 -0700 Subject: SH-3405 WIP convert existing stats to lltrace system started conversion of llviewerassetstats removed old, dead LLViewerStats code made units tracing require units declaration clean up of units handling --- indra/newview/llcompilequeue.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llcompilequeue.cpp') diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 6739910c38..033c8f4865 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -436,8 +436,6 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, } else { - //LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ) { LLSD args; -- cgit v1.2.3 From a2e22732f195dc075a733c79f15156752f522a43 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 30 Jul 2013 19:13:45 -0700 Subject: Summer cleaning - removed a lot of llcommon dependencies to speed up build times consolidated most indra-specific constants in llcommon under indra_constants.h fixed issues with operations on mixed unit types (implicit and explicit) made LL_INFOS() style macros variadic in order to subsume other logging methods such as ll_infos added optional tag output to error recorders --- indra/newview/llcompilequeue.cpp | 212 ++++++--------------------------------- 1 file changed, 32 insertions(+), 180 deletions(-) (limited to 'indra/newview/llcompilequeue.cpp') diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index d70d575eab..055a69727e 100755 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -45,7 +45,6 @@ #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" -#include "lscript_rt_interface.h" #include "llviewercontrol.h" #include "llviewerobject.h" #include "llviewerregion.h" @@ -154,7 +153,7 @@ void LLFloaterScriptQueue::onCloseBtn(void* user_data) void LLFloaterScriptQueue::addObject(const LLUUID& id) { - mObjectIDs.put(id); + mObjectIDs.push_back(id); } BOOL LLFloaterScriptQueue::start() @@ -163,7 +162,7 @@ BOOL LLFloaterScriptQueue::start() LLStringUtil::format_map_t args; args["[START]"] = mStartString; - args["[COUNT]"] = llformat ("%d", mObjectIDs.count()); + args["[COUNT]"] = llformat ("%d", mObjectIDs.size()); buffer = getString ("Starting", args); getChild("queue output")->addSimpleElement(buffer, ADD_BOTTOM); @@ -173,18 +172,18 @@ BOOL LLFloaterScriptQueue::start() BOOL LLFloaterScriptQueue::isDone() const { - return (mCurrentObjectID.isNull() && (mObjectIDs.count() == 0)); + return (mCurrentObjectID.isNull() && (mObjectIDs.size() == 0)); } // go to the next object. If no objects left, it falls out silently // and waits to be killed by the window being closed. BOOL LLFloaterScriptQueue::nextObject() { - S32 count; + U32 count; BOOL successful_start = FALSE; do { - count = mObjectIDs.count(); + count = mObjectIDs.size(); llinfos << "LLFloaterScriptQueue::nextObject() - " << count << " objects left to process." << llendl; mCurrentObjectID.setNull(); @@ -195,7 +194,7 @@ BOOL LLFloaterScriptQueue::nextObject() llinfos << "LLFloaterScriptQueue::nextObject() " << (successful_start ? "successful" : "unsuccessful") << llendl; - } while((mObjectIDs.count() > 0) && !successful_start); + } while((mObjectIDs.size() > 0) && !successful_start); if(isDone() && !mDone) { mDone = true; @@ -212,13 +211,13 @@ BOOL LLFloaterScriptQueue::popNext() // get the first element off of the container, and attempt to get // the inventory. BOOL rv = FALSE; - S32 count = mObjectIDs.count(); + S32 count = mObjectIDs.size(); if(mCurrentObjectID.isNull() && (count > 0)) { - mCurrentObjectID = mObjectIDs.get(0); + mCurrentObjectID = mObjectIDs.at(0); llinfos << "LLFloaterScriptQueue::popNext() - mCurrentID: " << mCurrentObjectID << llendl; - mObjectIDs.remove(0); + mObjectIDs.erase(mObjectIDs.begin()); LLViewerObject* obj = gObjectList.findObject(mCurrentObjectID); if(obj) { @@ -306,7 +305,7 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, item->getPermissions().allowCopyBy(gAgent.getID(), gAgent.getGroupID()) ) { LLPointer script = new LLViewerInventoryItem(item); - mCurrentScripts.put(script); + mCurrentScripts.push_back(script); asset_item_map.insert(std::make_pair(item->getAssetUUID(), item)); } } @@ -388,37 +387,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, } else { - // It's now in the file, now compile it. - buffer = LLTrans::getString("CompileQueueDownloadedCompiling") + (": ") + data->mScriptName; - - // Write script to local file for compilation. - LLFILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ - if (fp) - { - const S32 buf_size = 65536; - U8 copy_buf[buf_size]; - - while (file.read(copy_buf, buf_size)) /*Flawfinder: ignore*/ - { - if (fwrite(copy_buf, file.getLastBytesRead(), 1, fp) < 1) - { - // return a bad file error if we can't write the whole thing - status = LL_ERR_CANNOT_OPEN_FILE; - } - } - - fclose(fp); - } - else - { - llerrs << "Unable to find object to compile" << llendl; - } - - // TODO: babbage: No compile if no cap. - queue->compile(filename, data->mItemId); - - // Delete it after we're done compiling? - LLFile::remove(filename); + buffer = LLTrans::getString("CompileQueueServiceUnavailable") + (": ") + data->mScriptName; } } } @@ -455,138 +424,6 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, delete data; } -// static -void LLFloaterCompileQueue::onSaveTextComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) -{ - llinfos << "LLFloaterCompileQueue::onSaveTextComplete()" << llendl; - if (status) - { - llwarns << "Unable to save text for script." << llendl; - LLSD args; - args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); - LLNotificationsUtil::add("CompileQueueSaveText", args); - } -} - -// static -void LLFloaterCompileQueue::onSaveBytecodeComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) -{ - llinfos << "LLFloaterCompileQueue::onSaveBytecodeComplete()" << llendl; - LLCompileQueueData* data = (LLCompileQueueData*)user_data; - LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", data->mQueueID); - if(queue && (0 == status) && data) - { - queue->saveItemByItemID(data->mItemId); - queue->removeItemByItemID(data->mItemId); - } - else - { - llwarns << "Unable to save bytecode for script." << llendl; - LLSD args; - args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); - LLNotificationsUtil::add("CompileQueueSaveBytecode", args); - } - delete data; - data = NULL; -} - -// compile the file given and save it out. -void LLFloaterCompileQueue::compile(const std::string& filename, - const LLUUID& item_id) -{ - LLUUID new_asset_id; - LLTransactionID tid; - tid.generate(); - new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - - std::string uuid_string; - new_asset_id.toString(uuid_string); - std::string dst_filename; - dst_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".lso"; - std::string err_filename; - err_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".out"; - - gAssetStorage->storeAssetData(filename, tid, - LLAssetType::AT_LSL_TEXT, - &onSaveTextComplete, NULL, FALSE); - - const BOOL compile_to_mono = FALSE; - if(!lscript_compile(filename.c_str(), dst_filename.c_str(), - err_filename.c_str(), compile_to_mono, - uuid_string.c_str(), gAgent.isGodlike())) - { - llwarns << "compile failed" << llendl; - removeItemByItemID(item_id); - } - else - { - llinfos << "compile successful." << llendl; - - // Save LSL bytecode - LLCompileQueueData* data = new LLCompileQueueData(getKey().asUUID(), item_id); - gAssetStorage->storeAssetData(dst_filename, new_asset_id, - LLAssetType::AT_LSL_BYTECODE, - &LLFloaterCompileQueue::onSaveBytecodeComplete, - (void*)data, FALSE); - } -} - -void LLFloaterCompileQueue::removeItemByItemID(const LLUUID& asset_id) -{ - llinfos << "LLFloaterCompileQueue::removeItemByAssetID()" << llendl; - for(S32 i = 0; i < mCurrentScripts.count(); ) - { - if(asset_id == mCurrentScripts.get(i)->getUUID()) - { - mCurrentScripts.remove(i); - } - else - { - ++i; - } - } - if(mCurrentScripts.count() == 0) - { - nextObject(); - } -} - -const LLInventoryItem* LLFloaterCompileQueue::findItemByItemID(const LLUUID& asset_id) const -{ - LLInventoryItem* result = NULL; - S32 count = mCurrentScripts.count(); - for(S32 i = 0; i < count; ++i) - { - if(asset_id == mCurrentScripts.get(i)->getUUID()) - { - result = mCurrentScripts.get(i); - } - } - return result; -} - -void LLFloaterCompileQueue::saveItemByItemID(const LLUUID& asset_id) -{ - llinfos << "LLFloaterCompileQueue::saveItemByAssetID()" << llendl; - LLViewerObject* viewer_object = gObjectList.findObject(mCurrentObjectID); - if(viewer_object) - { - S32 count = mCurrentScripts.count(); - for(S32 i = 0; i < count; ++i) - { - if(asset_id == mCurrentScripts.get(i)->getUUID()) - { - // *FIX: this auto-resets active to TRUE. That might - // be a bad idea. - viewer_object->saveScript(mCurrentScripts.get(i), TRUE, false); - } - } - } - else - { - llwarns << "Unable to finish save!" << llendl; - } -} ///---------------------------------------------------------------------------- /// Class LLFloaterResetQueue @@ -608,8 +445,7 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj, { // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. - LLDynamicArray names; - + LLInventoryObject::object_list_t::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator end = inv->end(); for ( ; it != end; ++it) @@ -660,8 +496,6 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj, { // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. - LLDynamicArray names; - LLInventoryObject::object_list_t::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator end = inv->end(); for ( ; it != end; ++it) @@ -710,13 +544,31 @@ LLFloaterNotRunQueue::~LLFloaterNotRunQueue() { } +void LLFloaterCompileQueue::removeItemByItemID(const LLUUID& asset_id) +{ + llinfos << "LLFloaterCompileQueue::removeItemByAssetID()" << llendl; + for(S32 i = 0; i < mCurrentScripts.size(); ) + { + if(asset_id == mCurrentScripts.at(i)->getUUID()) + { + vector_replace_with_last(mCurrentScripts, mCurrentScripts.begin() + i); + } + else + { + ++i; + } + } + if(mCurrentScripts.empty()) + { + nextObject(); + } +} + void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, LLInventoryObject::object_list_t* inv) { // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. - LLDynamicArray names; - LLInventoryObject::object_list_t::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator end = inv->end(); for ( ; it != end; ++it) -- cgit v1.2.3 From e340009fc59d59e59b2e8d903a884acb76b178eb Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 9 Aug 2013 17:11:19 -0700 Subject: second phase summer cleaning replace llinfos, lldebugs, etc with new LL_INFOS(), LL_DEBUGS(), etc. --- indra/newview/llcompilequeue.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'indra/newview/llcompilequeue.cpp') diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 055a69727e..b0916d769a 100755 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -111,8 +111,8 @@ void LLFloaterScriptQueue::inventoryChanged(LLViewerObject* viewer_object, S32, void* q_id) { - llinfos << "LLFloaterScriptQueue::inventoryChanged() for object " - << viewer_object->getID() << llendl; + LL_INFOS() << "LLFloaterScriptQueue::inventoryChanged() for object " + << viewer_object->getID() << LL_ENDL; //Remove this listener from the object since its //listener callback is now being executed. @@ -137,8 +137,8 @@ void LLFloaterScriptQueue::inventoryChanged(LLViewerObject* viewer_object, // something went wrong... // note that we're not working on this one, and move onto the // next object in the list. - llwarns << "No inventory for " << mCurrentObjectID - << llendl; + LL_WARNS() << "No inventory for " << mCurrentObjectID + << LL_ENDL; nextObject(); } } @@ -184,16 +184,16 @@ BOOL LLFloaterScriptQueue::nextObject() do { count = mObjectIDs.size(); - llinfos << "LLFloaterScriptQueue::nextObject() - " << count - << " objects left to process." << llendl; + LL_INFOS() << "LLFloaterScriptQueue::nextObject() - " << count + << " objects left to process." << LL_ENDL; mCurrentObjectID.setNull(); if(count > 0) { successful_start = popNext(); } - llinfos << "LLFloaterScriptQueue::nextObject() " + LL_INFOS() << "LLFloaterScriptQueue::nextObject() " << (successful_start ? "successful" : "unsuccessful") - << llendl; + << LL_ENDL; } while((mObjectIDs.size() > 0) && !successful_start); if(isDone() && !mDone) { @@ -215,14 +215,14 @@ BOOL LLFloaterScriptQueue::popNext() if(mCurrentObjectID.isNull() && (count > 0)) { mCurrentObjectID = mObjectIDs.at(0); - llinfos << "LLFloaterScriptQueue::popNext() - mCurrentID: " - << mCurrentObjectID << llendl; + LL_INFOS() << "LLFloaterScriptQueue::popNext() - mCurrentID: " + << mCurrentObjectID << LL_ENDL; mObjectIDs.erase(mObjectIDs.begin()); LLViewerObject* obj = gObjectList.findObject(mCurrentObjectID); if(obj) { - llinfos << "LLFloaterScriptQueue::popNext() requesting inv for " - << mCurrentObjectID << llendl; + LL_INFOS() << "LLFloaterScriptQueue::popNext() requesting inv for " + << mCurrentObjectID << LL_ENDL; LLUUID* id = new LLUUID(getKey().asUUID()); registerVOInventoryListener(obj,id); requestVOInventory(); @@ -328,7 +328,7 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, viewer_object->getID(), itemp->getUUID()); - //llinfos << "ITEM NAME 2: " << names.get(i) << llendl; + //LL_INFOS() << "ITEM NAME 2: " << names.get(i) << LL_ENDL; gAssetStorage->getInvItemAsset(viewer_object->getRegion()->getHost(), gAgent.getID(), gAgent.getSessionID(), @@ -349,7 +349,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status) { - llinfos << "LLFloaterCompileQueue::scriptArrived()" << llendl; + LL_INFOS() << "LLFloaterCompileQueue::scriptArrived()" << LL_ENDL; LLScriptQueueData* data = (LLScriptQueueData*)user_data; if(!data) { @@ -360,7 +360,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, std::string buffer; if(queue && (0 == status)) { - //llinfos << "ITEM NAME 3: " << data->mScriptName << llendl; + //LL_INFOS() << "ITEM NAME 3: " << data->mScriptName << LL_ENDL; // Dump this into a file on the local disk so we can compile it. std::string filename; @@ -414,7 +414,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, buffer = LLTrans::getString("CompileQueueUnknownFailure") + (" ") + data->mScriptName; } - llwarns << "Problem downloading script asset." << llendl; + LL_WARNS() << "Problem downloading script asset." << LL_ENDL; if(queue) queue->removeItemByItemID(data->mItemId); } if(queue && (buffer.size() > 0)) @@ -546,7 +546,7 @@ LLFloaterNotRunQueue::~LLFloaterNotRunQueue() void LLFloaterCompileQueue::removeItemByItemID(const LLUUID& asset_id) { - llinfos << "LLFloaterCompileQueue::removeItemByAssetID()" << llendl; + LL_INFOS() << "LLFloaterCompileQueue::removeItemByAssetID()" << LL_ENDL; for(S32 i = 0; i < mCurrentScripts.size(); ) { if(asset_id == mCurrentScripts.at(i)->getUUID()) -- cgit v1.2.3