summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llcallstack.cpp40
-rw-r--r--indra/llcommon/llcallstack.h6
2 files changed, 41 insertions, 5 deletions
diff --git a/indra/llcommon/llcallstack.cpp b/indra/llcommon/llcallstack.cpp
index 2409f7a876..9978645ff4 100644
--- a/indra/llcommon/llcallstack.cpp
+++ b/indra/llcommon/llcallstack.cpp
@@ -29,6 +29,7 @@
#include "llcommon.h"
#include "llcallstack.h"
#include "StackWalker.h"
+#include "llthreadlocalstorage.h"
#if LL_WINDOWS
class LLCallStackImpl: public StackWalker
@@ -88,6 +89,19 @@ LLCallStack::LLCallStack(S32 skip_count, bool verbose):
s_impl->getStack(m_strings, m_skipCount, m_verbose);
}
+bool LLCallStack::contains(const std::string& str)
+{
+ for (std::vector<std::string>::const_iterator it = m_strings.begin();
+ it != m_strings.end(); ++it)
+ {
+ if (it->find(str) != std::string::npos)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack)
{
std::vector<std::string>::const_iterator it;
@@ -98,8 +112,6 @@ std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack)
return s;
}
-#include "llthreadlocalstorage.h"
-
LLContextStrings::LLContextStrings()
{
}
@@ -136,17 +148,39 @@ void LLContextStrings::removeContextString(const std::string& str)
}
// static
+bool LLContextStrings::contains(const std::string& str)
+{
+ const std::map<std::string,S32>& strings =
+ LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings;
+ for (std::map<std::string,S32>::const_iterator it = strings.begin(); it!=strings.end(); ++it)
+ {
+ if (it->first.find(str) != std::string::npos)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+// static
void LLContextStrings::output(std::ostream& os)
{
- const std::map<std::string,S32>& strings = LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings;
+ const std::map<std::string,S32>& strings =
+ LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings;
for (std::map<std::string,S32>::const_iterator it = strings.begin(); it!=strings.end(); ++it)
{
os << it->first << "[" << it->second << "]" << "\n";
}
}
+// static
std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status)
{
LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->output(s);
return s;
}
+
+bool LLContextStatus::contains(const std::string& str)
+{
+ return LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->contains(str);
+}
diff --git a/indra/llcommon/llcallstack.h b/indra/llcommon/llcallstack.h
index 7196907980..1f7a7689d7 100644
--- a/indra/llcommon/llcallstack.h
+++ b/indra/llcommon/llcallstack.h
@@ -34,6 +34,7 @@ public:
LLCallStack(S32 skip_count=0, bool verbose=false);
std::vector<std::string> m_strings;
bool m_verbose;
+ bool contains(const std::string& str);
private:
static LLCallStackImpl *s_impl;
S32 m_skipCount;
@@ -49,6 +50,7 @@ public:
static void removeContextString(const std::string& str);
static void output(std::ostream& os);
static LLContextStrings* getThreadLocalInstance();
+ static bool contains(const std::string& str);
private:
std::map<std::string,S32> m_contextStrings;
};
@@ -69,10 +71,10 @@ private:
std::string m_str;
};
-// This doesn't really have any state, just acts as class to hook the
-// ostream override to.
+// Mostly exists as a class to hook an ostream override to.
struct LLContextStatus
{
+ bool contains(const std::string& str);
};
LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status);