Commit cb318362 authored by Alexandr Ilin's avatar Alexandr Ilin Committed by Commit Bot

tracing: Display all categories in about:tracing UI.

about:tracing UI calls TraceLog::GetKnownCategoryGroups() to get categories to
display in "Record" dialog. This function assumes that built-in categories
shouldn't be displayed.

However, the CL https://crrev.com/c/1251361 made almost all categories built-in,
thus a majority of categories isn't displayed in the UI.

This CL fixes this by narrowing the list of non-displayed categories to "meta"
categories.

Bug: 708990
Change-Id: Ic8ccfa396e890983afda96a20ebfe00557f319a9
Reviewed-on: https://chromium-review.googlesource.com/c/1341909Reviewed-by: default avatarSami Kyöstilä <skyostil@chromium.org>
Reviewed-by: default avatarPrimiano Tucci <primiano@chromium.org>
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609344}
parent fe25b3e2
......@@ -122,9 +122,9 @@ const TraceCategory* CategoryRegistry::GetCategoryByStatePtr(
}
// static
bool CategoryRegistry::IsBuiltinCategory(const TraceCategory* category) {
bool CategoryRegistry::IsMetaCategory(const TraceCategory* category) {
DCHECK(IsValidCategoryPtr(category));
return category < &categories_[BuiltinCategories::Size()];
return category <= kCategoryMetadata;
}
// static
......
......@@ -83,7 +83,9 @@ class BASE_EXPORT CategoryRegistry {
#endif
}
static bool IsBuiltinCategory(const TraceCategory*);
// Returns whether |category| points at one of the meta categories that
// shouldn't be displayed in the tracing UI.
static bool IsMetaCategory(const TraceCategory* category);
private:
friend class TraceCategoryTest;
......
......@@ -112,10 +112,10 @@ TEST_F(TraceCategoryTest, Basic) {
int num_test_categories_seen = 0;
for (const TraceCategory& cat : GetAllCategories()) {
if (strcmp(cat.name(), kMetadataName) == 0)
ASSERT_TRUE(CategoryRegistry::IsBuiltinCategory(&cat));
ASSERT_TRUE(CategoryRegistry::IsMetaCategory(&cat));
if (strncmp(cat.name(), "__test_basic_", 13) == 0) {
ASSERT_FALSE(CategoryRegistry::IsBuiltinCategory(&cat));
ASSERT_FALSE(CategoryRegistry::IsMetaCategory(&cat));
num_test_categories_seen++;
}
}
......
......@@ -562,7 +562,7 @@ void TraceLog::CreateFiltersForTraceConfig() {
void TraceLog::GetKnownCategoryGroups(
std::vector<std::string>* category_groups) {
for (const auto& category : CategoryRegistry::GetAllCategories()) {
if (!CategoryRegistry::IsBuiltinCategory(&category))
if (!CategoryRegistry::IsMetaCategory(&category))
category_groups->push_back(category.name());
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment