diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llcommon/llassettype.cpp | 90 | ||||
| -rw-r--r-- | indra/llcommon/llassettype.h | 5 | ||||
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 12 | ||||
| -rw-r--r-- | indra/newview/llstartup.cpp | 10 | ||||
| -rw-r--r-- | indra/newview/llviewerassetstorage.cpp | 162 | ||||
| -rw-r--r-- | indra/newview/llviewerassetstorage.h | 12 | ||||
| -rw-r--r-- | indra/newview/llviewercontrol.cpp | 8 | 
7 files changed, 65 insertions, 234 deletions
| diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 6ecc2ec740..5e8129b9b2 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -51,8 +51,7 @@ struct AssetEntry : public LLDictionaryEntry  		mHumanName(human_name),  		mCanLink(can_link),  		mCanFetch(can_fetch), -		mCanKnow(can_know), -        mFetchWithVACap(false) +		mCanKnow(can_know)  	{  		llassert(strlen(mTypeName) <= 8);  	} @@ -62,7 +61,6 @@ struct AssetEntry : public LLDictionaryEntry  	bool mCanLink;  	bool mCanFetch;  	bool mCanKnow; -    bool mFetchWithVACap;  };  class LLAssetDictionary : public LLSingleton<LLAssetDictionary>, @@ -256,89 +254,3 @@ bool LLAssetType::lookupIsAssetIDKnowable(EType asset_type)  	}  	return false;  } - -// static -bool LLAssetType::lookupFetchWithVACap(EType asset_type) -{ -	LLAssetDictionary *dict = LLAssetDictionary::getInstance(); -	const AssetEntry *entry = dict->lookup(asset_type); -	if (entry) -	{ -		return entry->mFetchWithVACap; -	} -	return false; -} - -// FIXME asset-http yank all this after asset-http becomes universal -void LLAssetType::setFetchWithVACapTypeString(const std::string& type_string) -{ -	LLAssetDictionary *dict = LLAssetDictionary::getInstance(); -    if (type_string=="none") -    { -        for (LLAssetDictionary::iterator iter = dict->begin(); -             iter != dict->end(); -             iter++) -        { -            AssetEntry *entry = iter->second; -            entry->mFetchWithVACap = false; -        }  -    } -    else if (type_string=="all") -    { -        for (LLAssetDictionary::iterator iter = dict->begin(); -             iter != dict->end(); -             iter++) -        { -            AssetEntry *entry = iter->second; -            entry->mFetchWithVACap = true; -        }  -    } -    else -    { -        for (LLAssetDictionary::iterator iter = dict->begin(); -             iter != dict->end(); -             iter++) -        { -            AssetEntry *entry = iter->second; -            if (entry->mTypeName==type_string) -            { -                entry->mFetchWithVACap = true; -            } -        }  -    } -} - -// FIXME asset-http yank all this after asset-http becomes universal -void LLAssetType::setFetchWithVACapConfigString(const std::string& config_string) -{ -    // Clear any currently enabled types -    LLAssetType::setFetchWithVACapTypeString("none"); - -    // Enable all types specified in the config string. -    std::set<std::string> type_names_for_va_cap; -    boost::split(type_names_for_va_cap, config_string, boost::is_any_of(" :,")); -    for (std::set<std::string>::const_iterator it = type_names_for_va_cap.begin(); -         it != type_names_for_va_cap.end(); ++it) -    { -        const std::string& type_string = *it; -        LLAssetType::setFetchWithVACapTypeString(type_string); -    } - -	LLAssetDictionary *dict = LLAssetDictionary::getInstance(); -	bool any_found = false; -    for (LLAssetDictionary::iterator iter = dict->begin(); -         iter != dict->end(); -         iter++) -    { -        AssetEntry *entry = iter->second; -        if (entry->mFetchWithVACap) -        { -            any_found = true; -            LL_WARNS() << "Fetch with ViewerAsset cap enabled for " << entry->mTypeName << LL_ENDL; -        } -    }  -	if (!any_found) -	{ -		LL_WARNS() << "Fetch with ViewerAsset cap disabled for all types" << LL_ENDL; -	} -} diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index e06ebc2a35..b849be9f16 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -153,11 +153,6 @@ public:  	static bool 				lookupIsAssetFetchByIDAllowed(EType asset_type); // the asset allows direct download  	static bool 				lookupIsAssetIDKnowable(EType asset_type); // asset data can be known by the viewer -	static bool 				lookupFetchWithVACap(EType asset_type); // asset data is fetched via http using ViewerAsset cap. - -    static void					setFetchWithVACapTypeString(const std::string& type_string); -    static void					setFetchWithVACapConfigString(const std::string& config_string); -	  	static const std::string&	badLookup(); // error string when a lookup fails  protected: diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9b26053fb5..717deba8c7 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -15808,18 +15808,6 @@        <integer>0</integer>      </map> -    <key>ViewerAssetHttpTypes</key> -    <map> -      <key>Comment</key> -      <string>Use the ViewerAsset cap and HTTP pipeline for fetching assets of the listed type names. "none" and "all" are recognized as a special values.</string> -      <key>Persist</key> -      <integer>1</integer> -      <key>Type</key> -      <string>String</string> -      <key>Value</key> -      <string>all</string> -    </map> -    <key>SimulateFBOFailure</key>    <map>      <key>Comment</key> diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 0ef337b6c4..b762b2ae1c 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -312,16 +312,6 @@ void set_flags_and_update_appearance()  // true when all initialization done.  bool idle_startup()  { -    // FIXME asset-http - this configuration stuff is temporary -    // construction; once it is always on for certain types -    // we can remove the setting. -    static bool va_types_initialized = false; -    if (!va_types_initialized) -    { -        va_types_initialized = true; -        LLAssetType::setFetchWithVACapConfigString(gSavedSettings.getString("ViewerAssetHttpTypes")); -    } -  	const F32 PRECACHING_DELAY = gSavedSettings.getF32("PrecachingDelay");  	static LLTimer timeout; diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 496fbbecff..cb60337a7f 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -42,6 +42,7 @@  #include "llcoros.h"  #include "lleventcoro.h"  #include "llsdutil.h" +#include "llworld.h"  ///----------------------------------------------------------------------------  /// LLViewerAssetRequest @@ -350,17 +351,10 @@ void LLViewerAssetStorage::_queueDataRequest(      BOOL duplicate,      BOOL is_priority)  { -    if (LLAssetType::lookupFetchWithVACap(atype)) -    { -        queueRequestHttp(uuid, atype, callback, user_data, duplicate, is_priority); -    } -    else -    { -        queueRequestUDP(uuid, atype, callback, user_data, duplicate, is_priority); -    } +    queueRequestHttp(uuid, atype, callback, user_data, duplicate, is_priority);  } -void LLViewerAssetStorage::queueRequestUDP( +void LLViewerAssetStorage::queueRequestHttp(      const LLUUID& uuid,      LLAssetType::EType atype,      LLGetAssetCallback callback, @@ -368,116 +362,84 @@ void LLViewerAssetStorage::queueRequestUDP(      BOOL duplicate,      BOOL is_priority)  { -    LL_DEBUGS("ViewerAsset") << "Request asset via UDP " << uuid << " type " << LLAssetType::lookup(atype) << LL_ENDL; +    LL_DEBUGS("ViewerAsset") << "Request asset via HTTP " << uuid << " type " << LLAssetType::lookup(atype) << LL_ENDL; -    if (mUpstreamHost.isOk()) +    bool with_http = true; +    LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype, with_http); +    req->mDownCallback = callback; +    req->mUserData = user_data; +    req->mIsPriority = is_priority; +    if (!duplicate)      { -        // stash the callback info so we can find it after we get the response message -		bool with_http = false; -        LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype, with_http); -        req->mDownCallback = callback; -        req->mUserData = user_data; -        req->mIsPriority = is_priority; -        if (!duplicate) -        { -            // Only collect metrics for non-duplicate requests.  Others  -            // are piggy-backing and will artificially lower averages. -            req->mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp(); -        } -         -        mPendingDownloads.push_back(req); -     -        if (!duplicate) -        { -            // send request message to our upstream data provider -            // Create a new asset transfer. -            LLTransferSourceParamsAsset spa; -            spa.setAsset(uuid, atype); - -            // Set our destination file, and the completion callback. -            LLTransferTargetParamsVFile tpvf; -            tpvf.setAsset(uuid, atype); -            tpvf.setCallback(downloadCompleteCallback, *req); - -            LL_DEBUGS("AssetStorage") << "Starting transfer for " << uuid << LL_ENDL; -            LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(mUpstreamHost, LLTCT_ASSET); -            ttcp->requestTransfer(spa, tpvf, 100.f + (is_priority ? 1.f : 0.f)); - -            bool with_http = false; -            bool is_temp = false; -            LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); -        } +        // Only collect metrics for non-duplicate requests.  Others  +        // are piggy-backing and will artificially lower averages. +        req->mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp();      } -    else +    mPendingDownloads.push_back(req); + +    // This is the same as the current UDP logic - don't re-request a duplicate. +    if (!duplicate)      { -        // uh-oh, we shouldn't have gotten here -        LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL; -        if (callback) -        { -            callback(mVFS, uuid, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM); -        } +        bool with_http = true; +        bool is_temp = false; +        LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); + +        LLCoros::instance().launch("LLViewerAssetStorage::assetRequestCoro", +                                   boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data));      }  } -void LLViewerAssetStorage::queueRequestHttp( +void LLViewerAssetStorage::capsRecvForRegion(const LLUUID& region_id, std::string pumpname) +{ +    LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(region_id); +    mViewerAssetUrl = regionp->getViewerAssetUrl(); + +    LLEventPumps::instance().obtain(pumpname).post(LLSD()); +} + +void LLViewerAssetStorage::assetRequestCoro( +    LLViewerAssetRequest *req,      const LLUUID& uuid,      LLAssetType::EType atype,      LLGetAssetCallback callback, -    void *user_data, -    BOOL duplicate, -    BOOL is_priority) +    void *user_data)  { -    LL_DEBUGS("ViewerAsset") << "Request asset via HTTP " << uuid << " type " << LLAssetType::lookup(atype) << LL_ENDL; +    S32 result_code = LL_ERR_NOERR; +    LLExtStat ext_status = LL_EXSTAT_NONE; +      if (!gAgent.getRegion())      { -        LL_WARNS() << "No region, fetch fails" << LL_ENDL; +        LL_WARNS_ONCE() << "Asset request fails: no region set" << LL_ENDL; +        result_code = LL_ERR_ASSET_REQUEST_FAILED; +        ext_status = LL_EXSTAT_NONE; +        removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status);  		return;      } -    std::string cap_url = gAgent.getRegion()->getCapability("ViewerAsset"); -    if (cap_url.empty()) +    else if (!gAgent.getRegion()->capabilitiesReceived())      { -        LL_WARNS() << "No ViewerAsset cap found, fetch fails" << LL_ENDL; -        // TODO asset-http: handle waiting for caps? Other failure mechanism? -        return; +        LLEventStream capsRecv("waitForCaps", true); + +        gAgent.getRegion()->setCapabilitiesReceivedCallback( +            boost::bind(&LLViewerAssetStorage::capsRecvForRegion, this, _1, capsRecv.getName())); +         +        llcoro::suspendUntilEventOn(capsRecv);      }      else      { -        LL_DEBUGS("ViewerAsset") << "Will fetch via ViewerAsset cap " << cap_url << LL_ENDL; - -        bool with_http = true; -        LLViewerAssetRequest *req = new LLViewerAssetRequest(uuid, atype, with_http); -        req->mDownCallback = callback; -        req->mUserData = user_data; -        req->mIsPriority = is_priority; -        if (!duplicate) -        { -            // Only collect metrics for non-duplicate requests.  Others  -            // are piggy-backing and will artificially lower averages. -            req->mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp(); -        } -        mPendingDownloads.push_back(req); - -        // This is the same as the current UDP logic - don't re-request a duplicate. -        if (!duplicate) +        if (mViewerAssetUrl.empty())          { -            bool with_http = true; -            bool is_temp = false; -            LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp); - -            LLCoros::instance().launch("LLViewerAssetStorage::assetRequestCoro", -                                       boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data)); +            mViewerAssetUrl = gAgent.getRegion()->getViewerAssetUrl();          }      } -} - -void LLViewerAssetStorage::assetRequestCoro( -    LLViewerAssetRequest *req, -    const LLUUID& uuid, -    LLAssetType::EType atype, -    LLGetAssetCallback callback, -    void *user_data) -{ -    std::string url = getAssetURL(uuid,atype); +    if (mViewerAssetUrl.empty()) +    { +        LL_WARNS_ONCE() << "asset request fails: caps received but no viewer asset cap found" << LL_ENDL; +        result_code = LL_ERR_ASSET_REQUEST_FAILED; +        ext_status = LL_EXSTAT_NONE; +        removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status); +		return; +    } +    std::string url = getAssetURL(mViewerAssetUrl, uuid,atype);      LL_DEBUGS("ViewerAsset") << "request url: " << url << LL_ENDL;      LLCore::HttpRequest::policy_t httpPolicy(LLAppCoreHttp::AP_TEXTURE); @@ -488,9 +450,6 @@ void LLViewerAssetStorage::assetRequestCoro(      LLSD result = httpAdapter->getRawAndSuspend(httpRequest, url, httpOpts); -    S32 result_code = LL_ERR_NOERR; -    LLExtStat ext_status = LL_EXSTAT_NONE; -          LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];      LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);      if (!status) @@ -542,9 +501,8 @@ void LLViewerAssetStorage::assetRequestCoro(      removeAndCallbackPendingDownloads(uuid, atype, uuid, atype, result_code, ext_status);  } -std::string LLViewerAssetStorage::getAssetURL(const LLUUID& uuid, LLAssetType::EType atype) +std::string LLViewerAssetStorage::getAssetURL(const std::string& cap_url, const LLUUID& uuid, LLAssetType::EType atype)  { -	std::string cap_url = gAgent.getRegion()->getViewerAssetUrl();      std::string type_name = LLAssetType::lookup(atype);      std::string url = cap_url + "/?" + type_name + "_id=" + uuid.asString();      return url; diff --git a/indra/newview/llviewerassetstorage.h b/indra/newview/llviewerassetstorage.h index 3ca8112601..2f3eaa15a7 100644 --- a/indra/newview/llviewerassetstorage.h +++ b/indra/newview/llviewerassetstorage.h @@ -73,13 +73,6 @@ protected:  						   BOOL duplicate,  						   BOOL is_priority); -    void queueRequestUDP(const LLUUID& uuid, -                         LLAssetType::EType type, -                         void (*callback) (LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), -                         void *user_data, -                         BOOL duplicate, -                         BOOL is_priority); -      void queueRequestHttp(const LLUUID& uuid,                            LLAssetType::EType type,                            void (*callback) (LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat), @@ -87,14 +80,17 @@ protected:                            BOOL duplicate,                            BOOL is_priority); +    void capsRecvForRegion(const LLUUID& region_id, std::string pumpname); +          void assetRequestCoro(LLViewerAssetRequest *req,                            const LLUUID& uuid,                            LLAssetType::EType atype,                            void (*callback) (LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat),                            void *user_data); -    std::string getAssetURL(const LLUUID& uuid, LLAssetType::EType atype); +    std::string getAssetURL(const std::string& cap_url, const LLUUID& uuid, LLAssetType::EType atype); +    std::string mViewerAssetUrl;  };  #endif diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index c0a87adca5..7c1921b143 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -127,13 +127,6 @@ static bool handleDebugAvatarJointsChanged(const LLSD& newvalue)      return true;  } -static bool handleViewerAssetHttpTypesChanged(const LLSD& newvalue) -{ -    std::string new_string = newvalue.asString(); -    LLAssetType::setFetchWithVACapConfigString(new_string); -    return true; -} -  static bool handleSetShaderChanged(const LLSD& newvalue)  {  	// changing shader level may invalidate existing cached bump maps, as the shader type determines the format of the bump map it expects - clear and repopulate the bump cache @@ -757,7 +750,6 @@ void settings_setup_listeners()  	gSavedSettings.getControl("SpellCheckDictionary")->getSignal()->connect(boost::bind(&handleSpellCheckChanged));  	gSavedSettings.getControl("LoginLocation")->getSignal()->connect(boost::bind(&handleLoginLocationChanged));      gSavedSettings.getControl("DebugAvatarJoints")->getCommitSignal()->connect(boost::bind(&handleDebugAvatarJointsChanged, _2)); -    gSavedSettings.getControl("ViewerAssetHttpTypes")->getCommitSignal()->connect(boost::bind(&handleViewerAssetHttpTypesChanged, _2));  }  #if TEST_CACHED_CONTROL | 
