summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRider Linden <none@none>2015-03-20 13:16:25 -0700
committerRider Linden <none@none>2015-03-20 13:16:25 -0700
commit9d676ce5b97d7ce09630d7d6ab8abd562b958cae (patch)
treecf7b8f154652009f38551ae79c40a4c75a0b5d2d /indra/newview
parent6b8c814df3141fa705b9921ba0a73aeaa3fe63b6 (diff)
Clean up and use policies for Material transfer.
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llappcorehttp.cpp7
-rwxr-xr-xindra/newview/llappcorehttp.h11
-rwxr-xr-xindra/newview/llmaterialmgr.cpp55
-rw-r--r--indra/newview/llmaterialmgr.h45
4 files changed, 78 insertions, 40 deletions
diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp
index dd39b9a959..420d37369f 100755
--- a/indra/newview/llappcorehttp.cpp
+++ b/indra/newview/llappcorehttp.cpp
@@ -97,6 +97,11 @@ static const struct
4, 1, 4, 0, false,
"",
"inventory"
+ },
+ { // AP_MATERIALS
+ 2, 1, 8, 0, false,
+ "RenderMaterials",
+ "material manager requests"
}
};
@@ -195,6 +200,8 @@ void LLAppCoreHttp::init()
}
mHttpClasses[app_policy].mPolicy = LLCore::HttpRequest::createPolicyClass();
+ // We have run out of available HTTP policies. Adjust HTTP_POLICY_CLASS_LIMIT in _httpinternal.h
+ llassert(mHttpClasses[app_policy].mPolicy != LLCore::HttpRequest::INVALID_POLICY_ID);
if (! mHttpClasses[app_policy].mPolicy)
{
// Use default policy (but don't accidentally modify default)
diff --git a/indra/newview/llappcorehttp.h b/indra/newview/llappcorehttp.h
index 9616354093..b636c3b43c 100755
--- a/indra/newview/llappcorehttp.h
+++ b/indra/newview/llappcorehttp.h
@@ -164,6 +164,17 @@ public:
/// Pipelined: no
AP_INVENTORY,
AP_REPORTING = AP_INVENTORY, // Piggy-back on inventory
+
+ /// Material resource requests and puts.
+ ///
+ /// Destination: simhost:12043
+ /// Protocol: https:
+ /// Transfer size: KB
+ /// Long poll: no
+ /// Concurrency: low
+ /// Request rate: low
+ /// Pipelined: no
+ AP_MATERIALS,
AP_COUNT // Must be last
};
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp
index f43efd75b8..b4ebe4adb1 100755
--- a/indra/newview/llmaterialmgr.cpp
+++ b/indra/newview/llmaterialmgr.cpp
@@ -38,7 +38,6 @@
#include "llworld.h"
#include "llhttpsdhandler.h"
#include "httpcommon.h"
-#include "httpheaders.h"
#include "llcorehttputil.h"
/**
@@ -120,10 +119,29 @@ void LLMaterialHttpHandler::onFailure(LLCore::HttpResponse * response, LLCore::H
/**
* LLMaterialMgr class
*/
-
-LLMaterialMgr::LLMaterialMgr()
+LLMaterialMgr::LLMaterialMgr():
+ mGetQueue(),
+ mGetPending(),
+ mGetCallbacks(),
+ mGetTECallbacks(),
+ mGetAllQueue(),
+ mGetAllRequested(),
+ mGetAllPending(),
+ mGetAllCallbacks(),
+ mPutQueue(),
+ mMaterials(),
+ mHttpRequest(NULL),
+ mHttpHeaders(NULL),
+ mHttpOptions(NULL),
+ mHttpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID),
+ mHttpPriority(0)
{
- mRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest());
+ LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp());
+
+ mHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest());
+ mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders(), false);
+ mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions(), false);
+ mHttpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_MATERIALS);
mMaterials.insert(std::pair<LLMaterialID, LLMaterialPtr>(LLMaterialID::null, LLMaterialPtr(NULL)));
gIdleCallbacks.addFunction(&LLMaterialMgr::onIdle, NULL);
@@ -558,7 +576,7 @@ void LLMaterialMgr::onIdle(void*)
instancep->processPutQueue();
}
- instancep->mRequest->update(0L);
+ instancep->mHttpRequest->update(0L);
}
void LLMaterialMgr::processGetQueue()
@@ -639,19 +657,17 @@ void LLMaterialMgr::processGetQueue()
boost::bind(&LLMaterialMgr::onGetResponse, this, _1, _2, region_id)
);
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders(), false);
-
LL_DEBUGS("Materials") << "POSTing to region '" << regionp->getName() << "' at '" << capURL << " for " << materialsData.size() << " materials."
<< "\ndata: " << ll_pretty_print_sd(materialsData) << LL_ENDL;
- LLCore::HttpHandle handle = LLCoreHttpUtil::requestPutWithLLSD(mRequest.get(),
- LLCore::HttpRequest::DEFAULT_POLICY_ID, 0, capURL,
- postData, NULL, headers.get(), handler);
+ LLCore::HttpHandle handle = LLCoreHttpUtil::requestPutWithLLSD(mHttpRequest,
+ mHttpPolicy, mHttpPriority, capURL,
+ postData, mHttpOptions, mHttpHeaders, handler);
if (handle == LLCORE_HTTP_HANDLE_INVALID)
{
delete handler;
- LLCore::HttpStatus status = mRequest->getStatus();
+ LLCore::HttpStatus status = mHttpRequest->getStatus();
LL_ERRS("Meterials") << "Failed to execute material POST. Status = " <<
status.toULong() << "\"" << status.toString() << "\"" << LL_ENDL;
}
@@ -695,15 +711,13 @@ void LLMaterialMgr::processGetAllQueue()
boost::bind(&LLMaterialMgr::onGetAllResponse, this, _1, _2, *itRegion)
);
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders(), false);
-
- LLCore::HttpHandle handle = mRequest->requestGet(LLCore::HttpRequest::DEFAULT_POLICY_ID, 0,
- capURL, NULL, headers.get(), handler);
+ LLCore::HttpHandle handle = mHttpRequest->requestGet(mHttpPolicy, mHttpPriority, capURL,
+ mHttpOptions.get(), mHttpHeaders.get(), handler);
if (handle == LLCORE_HTTP_HANDLE_INVALID)
{
delete handler;
- LLCore::HttpStatus status = mRequest->getStatus();
+ LLCore::HttpStatus status = mHttpRequest->getStatus();
LL_ERRS("Meterials") << "Failed to execute material GET. Status = " <<
status.toULong() << "\"" << status.toString() << "\"" << LL_ENDL;
}
@@ -800,15 +814,14 @@ void LLMaterialMgr::processPutQueue()
boost::bind(&LLMaterialMgr::onPutResponse, this, _1, _2)
);
- LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders(), false);
-
- LLCore::HttpHandle handle = LLCoreHttpUtil::requestPutWithLLSD(mRequest.get(), LLCore::HttpRequest::DEFAULT_POLICY_ID, 0,
- capURL, putData, NULL, headers.get(), handler);
+ LLCore::HttpHandle handle = LLCoreHttpUtil::requestPutWithLLSD(
+ mHttpRequest, mHttpPolicy, mHttpPriority, capURL,
+ putData, mHttpOptions, mHttpHeaders, handler);
if (handle == LLCORE_HTTP_HANDLE_INVALID)
{
delete handler;
- LLCore::HttpStatus status = mRequest->getStatus();
+ LLCore::HttpStatus status = mHttpRequest->getStatus();
LL_ERRS("Meterials") << "Failed to execute material PUT. Status = " <<
status.toULong() << "\"" << status.toString() << "\"" << LL_ENDL;
}
diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h
index 0904c9b2c4..ef202d24ba 100644
--- a/indra/newview/llmaterialmgr.h
+++ b/indra/newview/llmaterialmgr.h
@@ -31,6 +31,8 @@
#include "llmaterialid.h"
#include "llsingleton.h"
#include "httprequest.h"
+#include "httpheaders.h"
+#include "httpoptions.h"
class LLViewerRegion;
@@ -74,16 +76,6 @@ private:
void onRegionRemoved(LLViewerRegion* regionp);
private:
- typedef std::set<LLMaterialID> material_queue_t;
- typedef std::map<LLUUID, material_queue_t> get_queue_t;
- typedef std::pair<const LLUUID, LLMaterialID> pending_material_t;
- typedef std::map<const pending_material_t, F64> get_pending_map_t;
- typedef std::map<LLMaterialID, get_callback_t*> get_callback_map_t;
-
- get_queue_t mGetQueue;
- get_pending_map_t mGetPending;
- get_callback_map_t mGetCallbacks;
-
// struct for TE-specific material ID query
class TEMaterialPair
{
@@ -110,6 +102,13 @@ private:
bool operator()(const TEMaterialPair& left, const TEMaterialPair& right) const { return left < right; }
};
+ typedef std::set<LLMaterialID> material_queue_t;
+ typedef std::map<LLUUID, material_queue_t> get_queue_t;
+ typedef std::pair<const LLUUID, LLMaterialID> pending_material_t;
+ typedef std::map<const pending_material_t, F64> get_pending_map_t;
+ typedef std::map<LLMaterialID, get_callback_t*> get_callback_map_t;
+
+
typedef boost::unordered_map<TEMaterialPair, get_callback_te_t*, TEMaterialPairHasher> get_callback_te_map_t;
typedef std::set<LLUUID> getall_queue_t;
typedef std::map<LLUUID, F64> getall_pending_map_t;
@@ -117,15 +116,23 @@ private:
typedef std::map<U8, LLMaterial> facematerial_map_t;
typedef std::map<LLUUID, facematerial_map_t> put_queue_t;
- get_callback_te_map_t mGetTECallbacks;
- getall_queue_t mGetAllQueue;
- getall_queue_t mGetAllRequested;
- getall_pending_map_t mGetAllPending;
- getall_callback_map_t mGetAllCallbacks;
- put_queue_t mPutQueue;
- material_map_t mMaterials;
-
- LLCore::HttpRequest::ptr_t mRequest;
+ get_queue_t mGetQueue;
+ get_pending_map_t mGetPending;
+ get_callback_map_t mGetCallbacks;
+
+ get_callback_te_map_t mGetTECallbacks;
+ getall_queue_t mGetAllQueue;
+ getall_queue_t mGetAllRequested;
+ getall_pending_map_t mGetAllPending;
+ getall_callback_map_t mGetAllCallbacks;
+ put_queue_t mPutQueue;
+ material_map_t mMaterials;
+
+ LLCore::HttpRequest::ptr_t mHttpRequest;
+ LLCore::HttpHeaders::ptr_t mHttpHeaders;
+ LLCore::HttpOptions::ptr_t mHttpOptions;
+ LLCore::HttpRequest::policy_t mHttpPolicy;
+ LLCore::HttpRequest::priority_t mHttpPriority;
U32 getMaxEntries(const LLViewerRegion* regionp);
};