Chromium Code Reviews| 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; |
| } |