diff options
| author | Rider Linden <rider@lindenlab.com> | 2015-09-02 11:50:26 -0700 | 
|---|---|---|
| committer | Rider Linden <rider@lindenlab.com> | 2015-09-02 11:50:26 -0700 | 
| commit | 6c9610b4e44020bf266a5da7375fb9f2b24f4f8a (patch) | |
| tree | baf73d9f0c948149dfee20d850904bed0f01f27c /indra/newview | |
| parent | c5dc9b1a572f00e69b9cd3b5853f0a3d104af20f (diff) | |
Move associated experience fetching into the ExperienceCache as a coro remove the responder.
Diffstat (limited to 'indra/newview')
| -rwxr-xr-x | indra/newview/CMakeLists.txt | 2 | ||||
| -rwxr-xr-x | indra/newview/llcompilequeue.cpp | 5 | ||||
| -rw-r--r-- | indra/newview/llexperienceassociationresponder.cpp | 97 | ||||
| -rw-r--r-- | indra/newview/llexperienceassociationresponder.h | 58 | ||||
| -rwxr-xr-x | indra/newview/llpreviewscript.cpp | 6 | ||||
| -rwxr-xr-x | indra/newview/llsidepaneliteminfo.cpp | 5 | 
6 files changed, 8 insertions, 165 deletions
| diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 090879e372..67af240f8d 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -192,7 +192,6 @@ set(viewer_SOURCE_FILES      lleventnotifier.cpp      lleventpoll.cpp      llexpandabletextbox.cpp -    llexperienceassociationresponder.cpp      llexperiencelog.cpp      llexternaleditor.cpp      llface.cpp @@ -801,7 +800,6 @@ set(viewer_HEADER_FILES      lleventnotifier.h      lleventpoll.h      llexpandabletextbox.h -    llexperienceassociationresponder.h      llexperiencelog.h      llexternaleditor.h      llface.h diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 9545771c8d..f763a59c94 100755 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -57,7 +57,6 @@  #include "lltrans.h"  #include "llselectmgr.h" -#include "llexperienceassociationresponder.h"  #include "llexperiencecache.h"  #include "llviewerassetupload.h" @@ -358,8 +357,8 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object,  			LLScriptQueueData* datap = new LLScriptQueueData(getKey().asUUID(),  				viewer_object->getID(), itemp); -			ExperienceAssociationResponder::fetchAssociatedExperience(itemp->getParentUUID(), itemp->getUUID(),  -				boost::bind(LLFloaterCompileQueue::requestAsset, datap, _1)); +            LLExperienceCache::getInstance()->fetchAssociatedExperience(itemp->getParentUUID(), itemp->getUUID(), +                    boost::bind(LLFloaterCompileQueue::requestAsset, datap, _1));  		}  	}  } diff --git a/indra/newview/llexperienceassociationresponder.cpp b/indra/newview/llexperienceassociationresponder.cpp deleted file mode 100644 index cd4a7516b1..0000000000 --- a/indra/newview/llexperienceassociationresponder.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/**  - * @file llexperienceassociationresponder.cpp - * @brief llexperienceassociationresponder implementation. This class combines  - * a lookup for a script association and an experience details request. The first - * is always async, but the second may be cached locally. - * - * $LicenseInfo:firstyear=2013&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2013, Linden Research, Inc. - *  - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - *  - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU - * Lesser General Public License for more details. - *  - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA - *  - * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "llexperienceassociationresponder.h" -#include "llexperiencecache.h" -#include "llviewerregion.h" -#include "llagent.h" - -ExperienceAssociationResponder::ExperienceAssociationResponder(ExperienceAssociationResponder::callback_t callback):mCallback(callback) -{ -    ref(); -} - -void ExperienceAssociationResponder::fetchAssociatedExperience( const LLUUID& object_id, const LLUUID& item_id, callback_t callback ) -{ -    LLSD request; -    request["object-id"]=object_id; -    request["item-id"]=item_id; -    fetchAssociatedExperience(request, callback); -} - -void ExperienceAssociationResponder::fetchAssociatedExperience(LLSD& request, callback_t callback) -{ -    LLViewerRegion* region = gAgent.getRegion(); -    if (region) -    { -        std::string lookup_url=region->getCapability("GetMetadata");  -        if(!lookup_url.empty()) -        { -            LLSD fields; -            fields.append("experience"); -            request["fields"] = fields; -            LLHTTPClient::post(lookup_url, request, new ExperienceAssociationResponder(callback)); -        } -    } -} - -void ExperienceAssociationResponder::httpFailure() -{ -    LLSD msg; -    msg["error"]=(LLSD::Integer)getStatus(); -    msg["message"]=getReason(); -    LL_INFOS("ExperienceAssociation") << "Failed to look up associated experience: " << getStatus() << ": " << getReason() << LL_ENDL; - -    sendResult(msg); -   -} -void ExperienceAssociationResponder::httpSuccess() -{ -    if(!getContent().has("experience")) -    { - -        LLSD msg; -        msg["message"]="no experience"; -        msg["error"]=-1; -        sendResult(msg); -        return; -    } - -    LLExperienceCache::getInstance()->get(getContent()["experience"].asUUID(), boost::bind(&ExperienceAssociationResponder::sendResult, this, _1)); - -} - -void ExperienceAssociationResponder::sendResult( const LLSD& experience ) -{ -    mCallback(experience); -    unref(); -} - - - diff --git a/indra/newview/llexperienceassociationresponder.h b/indra/newview/llexperienceassociationresponder.h deleted file mode 100644 index 2bdc3d251b..0000000000 --- a/indra/newview/llexperienceassociationresponder.h +++ /dev/null @@ -1,58 +0,0 @@ -#include "llhttpclient.h" -#include "llsd.h" -/**  - * @file llexperienceassociationresponder.h - * @brief llexperienceassociationresponder and related class definitions - * - * $LicenseInfo:firstyear=2013&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2013, Linden Research, Inc. - *  - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - *  - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU - * Lesser General Public License for more details. - *  - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA - *  - * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA - * $/LicenseInfo$ - */ - - - -#ifndef LL_LLEXPERIENCEASSOCIATIONRESPONDER_H -#define LL_LLEXPERIENCEASSOCIATIONRESPONDER_H - -#include "llhttpclient.h" -#include "llsd.h" - -class ExperienceAssociationResponder : public LLHTTPClient::Responder -{ -public: -    typedef boost::function<void(const LLSD& experience)> callback_t; - -    ExperienceAssociationResponder(callback_t callback); - -    /*virtual*/ void httpSuccess(); -    /*virtual*/ void httpFailure(); - -    static void fetchAssociatedExperience(const LLUUID& object_it, const LLUUID& item_id, callback_t callback); - -private:     -    static void fetchAssociatedExperience(LLSD& request, callback_t callback); -     -    void sendResult(const LLSD& experience); - -    callback_t mCallback; - -}; - -#endif // LL_LLEXPERIENCEASSOCIATIONRESPONDER_H diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 4f5d21b6be..8a493b7084 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -87,7 +87,6 @@  #include "llfloatergotoline.h"  #include "llexperiencecache.h"  #include "llfloaterexperienceprofile.h" -#include "llexperienceassociationresponder.h"  #include "llviewerassetupload.h"  const std::string HELLO_LSL = @@ -2039,8 +2038,9 @@ void LLLiveLSLEditor::loadAsset()  			if(item)  			{ -				ExperienceAssociationResponder::fetchAssociatedExperience(item->getParentUUID(), item->getUUID(), boost::bind(&LLLiveLSLEditor::setAssociatedExperience, getDerivedHandle<LLLiveLSLEditor>(), _1)); -				 +                LLExperienceCache::getInstance()->fetchAssociatedExperience(item->getParentUUID(), item->getUUID(), +                        boost::bind(&LLLiveLSLEditor::setAssociatedExperience, getDerivedHandle<LLLiveLSLEditor>(), _1)); +  				bool isGodlike = gAgent.isGodlike();  				bool copyManipulate = gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE);  				mIsModifiable = gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE); diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index a7cfc173af..ca17fe77b1 100755 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -44,7 +44,6 @@  #include "llviewercontrol.h"  #include "llviewerinventory.h"  #include "llviewerobjectlist.h" -#include "llexperienceassociationresponder.h"  #include "llexperiencecache.h"  #include "lltrans.h" @@ -328,7 +327,9 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)          LLTextBox* tb = getChild<LLTextBox>("LabelItemExperience");          tb->setText(getString("loading_experience"));          tb->setVisible(TRUE); -        ExperienceAssociationResponder::fetchAssociatedExperience(item->getParentUUID(), item->getUUID(), boost::bind(&LLSidepanelItemInfo::setAssociatedExperience, getDerivedHandle<LLSidepanelItemInfo>(), _1)); + +        LLExperienceCache::getInstance()->fetchAssociatedExperience(item->getParentUUID(), item->getUUID(),  +            boost::bind(&LLSidepanelItemInfo::setAssociatedExperience, getDerivedHandle<LLSidepanelItemInfo>(), _1));      }  	////////////////////// | 
