Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(781)

Unified Diff: base/debug/trace_event_impl.cc

Issue 11823016: Trace category groups and category filter. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event_impl.cc
diff --git a/base/debug/trace_event_impl.cc b/base/debug/trace_event_impl.cc
index 07679d1131250fb101401191d02434dc6e59e8b8..f4d81a3f511f2247de0c3a284215a4eaff1d1a0d 100644
--- a/base/debug/trace_event_impl.cc
+++ b/base/debug/trace_event_impl.cc
@@ -393,18 +393,39 @@ const char* TraceLog::GetCategoryName(const unsigned char* category_enabled) {
return g_categories[category_index];
}
+static bool IsTagInCategory(const char* tag_expr, const char* category) {
+ CStringTokenizer tokens(category, category + strlen(category), ",");
+ while (tokens.GetNext()) {
+ if (MatchPattern(tokens.token().c_str(), tag_expr))
+ return true;
+ }
+ return false;
+}
+
+// A tag composite category name would be something like: "webkit,input"
+static bool IsTagCompositeCategory(const char* category) {
+ return strchr(category, ',');
+}
+
static void EnableMatchingCategory(int category_index,
nduca 2013/01/09 09:43:33 I'd like to update the naming convention throughou
const std::vector<std::string>& patterns,
unsigned char matched_value,
unsigned char unmatched_value) {
std::vector<std::string>::const_iterator ci = patterns.begin();
bool is_match = false;
+ bool has_matching_tag = false;
+ bool is_tag_composite_category =
+ IsTagCompositeCategory(g_categories[category_index]);
for (; ci != patterns.end(); ++ci) {
is_match = MatchPattern(g_categories[category_index], ci->c_str());
- if (is_match)
nduca 2013/01/09 09:43:33 cant you make this just a change to MatchPattern?
+ has_matching_tag = is_tag_composite_category &&
+ IsTagInCategory(ci->c_str(),
+ g_categories[category_index]);
+
+ if (is_match || has_matching_tag)
break;
}
- g_category_enabled[category_index] = is_match ?
+ g_category_enabled[category_index] = is_match || has_matching_tag ?
matched_value : unmatched_value;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698