diff --git a/src/libplatform/tracing/trace-config.cc b/src/libplatform/tracing/trace-config.cc index e77d191e5e..9156301a45 100644 --- a/src/libplatform/tracing/trace-config.cc +++ b/src/libplatform/tracing/trace-config.cc @@ -21,8 +21,13 @@ TraceConfig* TraceConfig::CreateDefaultTraceConfig() { } bool TraceConfig::IsCategoryGroupEnabled(const char* category_group) const { - for (auto included_category : included_categories_) { - if (strcmp(included_category.data(), category_group) == 0) return true; + std::stringstream category_stream(category_group); + while (category_stream.good()) { + std::string category; + getline(category_stream, category, ','); + for (auto included_category : included_categories_) { + if (category == included_category) return true; + } } return false; } diff --git a/test/cctest/libplatform/test-tracing.cc b/test/cctest/libplatform/test-tracing.cc index 6189ed2dfc..5dc6b965f1 100644 --- a/test/cctest/libplatform/test-tracing.cc +++ b/test/cctest/libplatform/test-tracing.cc @@ -25,6 +25,14 @@ TEST(TestTraceConfig) { CHECK_EQ(trace_config->IsCategoryGroupEnabled( TRACE_DISABLED_BY_DEFAULT("v8.runtime")), true); + CHECK_EQ(trace_config->IsCategoryGroupEnabled("v8,v8.cpu_profile"), true); + CHECK_EQ( + trace_config->IsCategoryGroupEnabled("v8,disabled-by-default-v8.runtime"), + true); + CHECK_EQ(trace_config->IsCategoryGroupEnabled( + "v8_cpu_profile,v8.cpu_profile.hires"), + false); + delete trace_config; }