Bug 1297773 - Fix thread filter to use case insensitive substring matching. r=mstange
MozReview-Commit-ID: 9umKsSQ9a73
--- a/tools/profiler/core/GeckoSampler.h
+++ b/tools/profiler/core/GeckoSampler.h
@@ -13,31 +13,40 @@
#include "ThreadInfo.h"
#ifndef SPS_STANDALONE
#include "IntelPowerGadget.h"
#endif
#ifdef MOZ_TASK_TRACER
#include "GeckoTaskTracer.h"
#endif
+#include <algorithm>
+
namespace mozilla {
class ProfileGatherer;
} // namespace mozilla
typedef mozilla::Vector<std::string> ThreadNameFilterList;
typedef mozilla::Vector<std::string> FeatureList;
static bool
threadSelected(ThreadInfo* aInfo, const ThreadNameFilterList &aThreadNameFilters) {
if (aThreadNameFilters.empty()) {
return true;
}
+ std::string name = aInfo->Name();
+ std::transform(name.begin(), name.end(), name.begin(), ::tolower);
+
for (uint32_t i = 0; i < aThreadNameFilters.length(); ++i) {
- if (aThreadNameFilters[i] == aInfo->Name()) {
+ std::string filter = aThreadNameFilters[i];
+ std::transform(filter.begin(), filter.end(), filter.begin(), ::tolower);
+
+ // Crude, non UTF-8 compatible, case insensitive substring search
+ if (name.find(filter) != std::string::npos) {
return true;
}
}
return false;
}
extern mozilla::TimeStamp sLastTracerEvent;