summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2013-02-01 10:20:44 -0500
committerOz Linden <oz@lindenlab.com>2013-02-01 10:20:44 -0500
commit90bf22ef24fbb8ff3497dd271abc7f7555a4f758 (patch)
treeb059090df378ef876b2c28339d86423a42125f20 /indra
parent510a68134110b06779f34d2dd896a337911d5fef (diff)
add debug logging, ostream support for material ids, and some minor cleanup
Diffstat (limited to 'indra')
-rw-r--r--indra/llprimitive/llmaterialid.cpp7
-rw-r--r--indra/llprimitive/llmaterialid.h2
-rw-r--r--indra/newview/llmaterialmgr.cpp47
3 files changed, 42 insertions, 14 deletions
diff --git a/indra/llprimitive/llmaterialid.cpp b/indra/llprimitive/llmaterialid.cpp
index 590f5cd91f..820f62c43c 100644
--- a/indra/llprimitive/llmaterialid.cpp
+++ b/indra/llprimitive/llmaterialid.cpp
@@ -150,6 +150,13 @@ std::string LLMaterialID::asString() const
return materialIDString;
}
+std::ostream& operator<<(std::ostream& s, const LLMaterialID &material_id)
+{
+ s << material_id.asString();
+ return s;
+}
+
+
void LLMaterialID::parseFromBinary (const LLSD::Binary& pMaterialID)
{
llassert(pMaterialID.size() == (MATERIAL_ID_SIZE * sizeof(U8)));
diff --git a/indra/llprimitive/llmaterialid.h b/indra/llprimitive/llmaterialid.h
index 9db4065302..0a95204085 100644
--- a/indra/llprimitive/llmaterialid.h
+++ b/indra/llprimitive/llmaterialid.h
@@ -60,6 +60,8 @@ public:
LLSD asLLSD() const;
std::string asString() const;
+ friend std::ostream& operator<<(std::ostream& s, const LLMaterialID &material_id);
+
static const LLMaterialID null;
private:
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp
index 3895411bb9..aa98748dbe 100644
--- a/indra/newview/llmaterialmgr.cpp
+++ b/indra/newview/llmaterialmgr.cpp
@@ -2,9 +2,9 @@
* @file llmaterialmgr.cpp
* @brief Material manager
*
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2013&license=viewerlgpl$
* Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * 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
@@ -128,23 +128,31 @@ bool LLMaterialMgr::isGetPending(const LLUUID& region_id, const LLMaterialID& ma
const LLMaterialPtr LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id)
{
+ LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL;
+ LLMaterialPtr material;
material_map_t::const_iterator itMaterial = mMaterials.find(material_id);
if (mMaterials.end() != itMaterial)
{
- return itMaterial->second;
+ material = itMaterial->second;
+ LL_DEBUGS("Materials") << " found material " << LL_ENDL;
}
-
- if (!isGetPending(region_id, material_id))
+ else
{
- get_queue_t::iterator itQueue = mGetQueue.find(region_id);
- if (mGetQueue.end() == itQueue)
+ if (!isGetPending(region_id, material_id))
{
- std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t()));
- itQueue = ret.first;
+ LL_DEBUGS("Materials") << " material pending " << material_id << LL_ENDL;
+ get_queue_t::iterator itQueue = mGetQueue.find(region_id);
+ if (mGetQueue.end() == itQueue)
+ {
+ std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t()));
+ itQueue = ret.first;
+ }
+ itQueue->second.insert(material_id);
}
- itQueue->second.insert(material_id);
+ LL_DEBUGS("Materials") << " returning empty material " << LL_ENDL;
+ material = LLMaterialPtr();
}
- return LLMaterialPtr();
+ return material;
}
boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id, LLMaterialMgr::get_callback_t::slot_type cb)
@@ -188,8 +196,13 @@ void LLMaterialMgr::getAll(const LLUUID& region_id)
{
if (!isGetAllPending(region_id))
{
+ LL_DEBUGS("Materials") << "queuing for region " << region_id << LL_ENDL;
mGetAllQueue.insert(region_id);
}
+ else
+ {
+ LL_DEBUGS("Materials") << "already pending for region " << region_id << LL_ENDL;
+ }
}
boost::signals2::connection LLMaterialMgr::getAll(const LLUUID& region_id, LLMaterialMgr::getall_callback_t::slot_type cb)
@@ -210,6 +223,7 @@ boost::signals2::connection LLMaterialMgr::getAll(const LLUUID& region_id, LLMat
void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& material)
{
+ LL_DEBUGS("Materials") << "object " << object_id << LL_ENDL;
put_queue_t::iterator itQueue = mPutQueue.find(object_id);
if (mPutQueue.end() == itQueue)
{
@@ -230,9 +244,11 @@ void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial&
const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LLMaterialID& material_id, const LLSD& material_data)
{
+ LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL;
material_map_t::const_iterator itMaterial = mMaterials.find(material_id);
if (mMaterials.end() == itMaterial)
{
+ LL_DEBUGS("Materials") << "new material" << LL_ENDL;
LLMaterialPtr newMaterial(new LLMaterial(material_data));
std::pair<material_map_t::const_iterator, bool> ret = mMaterials.insert(std::pair<LLMaterialID, LLMaterialPtr>(material_id, newMaterial));
itMaterial = ret.first;
@@ -257,6 +273,7 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI
if (!success)
{
// *TODO: is there any kind of error handling we can do here?
+ LL_WARNS("Materials")<< "failed"<<LL_ENDL;
return;
}
@@ -271,7 +288,7 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI
LLSD response_data;
if (!unzip_llsd(response_data, content_stream, content_binary.size()))
{
- LL_ERRS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL;
+ LL_WARNS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL;
return;
}
@@ -297,6 +314,7 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL
if (!success)
{
// *TODO: is there any kind of error handling we can do here?
+ LL_WARNS("Materials")<< "failed"<<LL_ENDL;
return;
}
@@ -311,7 +329,7 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL
LLSD response_data;
if (!unzip_llsd(response_data, content_stream, content_binary.size()))
{
- LL_ERRS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL;
+ LL_WARNS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL;
return;
}
@@ -361,6 +379,7 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content)
if (!success)
{
// *TODO: is there any kind of error handling we can do here?
+ LL_WARNS("Materials")<< "failed"<<LL_ENDL;
return;
}
@@ -375,7 +394,7 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content)
LLSD response_data;
if (!unzip_llsd(response_data, content_stream, content_binary.size()))
{
- LL_ERRS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL;
+ LL_WARNS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL;
return;
}
else