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

Unified Diff: tools/telemetry/telemetry/core/platform/tracing_category_filter.py

Issue 474613002: telemetry: Fix TracingCategoryFilter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Raise assertion when both included and excluded. Created 6 years, 4 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 | tools/telemetry/telemetry/core/platform/tracing_category_filter_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/platform/tracing_category_filter.py
diff --git a/tools/telemetry/telemetry/core/platform/tracing_category_filter.py b/tools/telemetry/telemetry/core/platform/tracing_category_filter.py
index 06f2502a75f58ca782d23a8255ecf4431d11a52d..7e58685ba4dfeb17c74699421fd5ba1401d92ef4 100644
--- a/tools/telemetry/telemetry/core/platform/tracing_category_filter.py
+++ b/tools/telemetry/telemetry/core/platform/tracing_category_filter.py
@@ -70,6 +70,7 @@ class TracingCategoryFilter(object):
continue
if category[0] == '-':
+ assert not category[1:] in self._included_categories
self._excluded_categories.add(category[1:])
continue
@@ -77,7 +78,8 @@ class TracingCategoryFilter(object):
self._disabled_by_default_categories.add(category)
continue
- self.included_categories.add(category)
+ assert not category in self._excluded_categories
+ self._included_categories.add(category)
@property
def included_categories(self):
@@ -122,14 +124,14 @@ class TracingCategoryFilter(object):
def AddIncludedCategory(self, category_glob):
"""Explicitly enables anything matching category_glob."""
assert not category_glob.startswith('disabled-by-default-')
- if category_glob not in self._included_categories:
- self._included_categories.append(category_glob)
+ assert not category_glob in self._excluded_categories
+ self._included_categories.add(category_glob)
def AddExcludedCategory(self, category_glob):
"""Explicitly disables anything matching category_glob."""
assert not category_glob.startswith('disabled-by-default-')
- if category_glob not in self._excluded_categories:
- self._excluded_categories.append(category_glob)
+ assert not category_glob in self._included_categories
+ self._excluded_categories.add(category_glob)
def AddSyntheticDelay(self, delay):
assert _delay_re.match(delay)
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/platform/tracing_category_filter_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698