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

Unified Diff: base/trace_event/trace_config.cc

Issue 2415183004: Revert of [tracing] Add filtering mode in TraceLog (Closed)
Patch Set: Created 4 years, 2 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 | « base/trace_event/trace_config.h ('k') | base/trace_event/trace_event_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_config.cc
diff --git a/base/trace_event/trace_config.cc b/base/trace_event/trace_config.cc
index 9a17adb969a79f12935800b2f69b8da310379d1d..fdeb3294179ab6279edf22e5ce1a792b16b886d8 100644
--- a/base/trace_event/trace_config.cc
+++ b/base/trace_event/trace_config.cc
@@ -117,17 +117,6 @@
allowed_dump_modes.clear();
triggers.clear();
heap_profiler_options.Clear();
-}
-
-void TraceConfig::MemoryDumpConfig::Merge(
- const TraceConfig::MemoryDumpConfig& config) {
- triggers.insert(triggers.end(), config.triggers.begin(),
- config.triggers.end());
- allowed_dump_modes.insert(config.allowed_dump_modes.begin(),
- config.allowed_dump_modes.end());
- heap_profiler_options.breakdown_threshold_bytes =
- std::min(heap_profiler_options.breakdown_threshold_bytes,
- config.heap_profiler_options.breakdown_threshold_bytes);
}
TraceConfig::EventFilterConfig::EventFilterConfig(
@@ -366,7 +355,9 @@
included_categories_.clear();
}
- memory_dump_config_.Merge(config.memory_dump_config_);
+ memory_dump_config_.triggers.insert(memory_dump_config_.triggers.end(),
+ config.memory_dump_config_.triggers.begin(),
+ config.memory_dump_config_.triggers.end());
disabled_categories_.insert(disabled_categories_.end(),
config.disabled_categories_.begin(),
@@ -377,8 +368,6 @@
synthetic_delays_.insert(synthetic_delays_.end(),
config.synthetic_delays_.begin(),
config.synthetic_delays_.end());
- event_filters_.insert(event_filters_.end(), config.event_filters().begin(),
- config.event_filters().end());
}
void TraceConfig::Clear() {
@@ -427,10 +416,6 @@
if (dict.GetList(kSyntheticDelaysParam, &category_list))
SetSyntheticDelaysFromList(*category_list);
- const base::ListValue* category_event_filters = nullptr;
- if (dict.GetList(kEventFiltersParam, &category_event_filters))
- SetEventFiltersFromConfigList(*category_event_filters);
-
if (IsCategoryEnabled(MemoryDumpManager::kTraceCategory)) {
// If dump triggers not set, the client is using the legacy with just
// category enabled. So, use the default periodic dump config.
@@ -440,6 +425,10 @@
else
SetDefaultMemoryDumpConfig();
}
+
+ const base::ListValue* category_event_filters = nullptr;
+ if (dict.GetList(kEventFiltersParam, &category_event_filters))
+ SetEventFilters(*category_event_filters);
}
void TraceConfig::InitializeFromConfigString(StringPiece config_string) {
@@ -629,9 +618,25 @@
memory_dump_config_.triggers.push_back(kDefaultHeavyMemoryDumpTrigger);
memory_dump_config_.triggers.push_back(kDefaultLightMemoryDumpTrigger);
memory_dump_config_.allowed_dump_modes = GetDefaultAllowedMemoryDumpModes();
-}
-
-void TraceConfig::SetEventFiltersFromConfigList(
+
+ if (AllocationContextTracker::capture_mode() ==
+ AllocationContextTracker::CaptureMode::PSEUDO_STACK) {
+ for (const auto& filter : event_filters_) {
+ if (filter.predicate_name() ==
+ TraceLog::TraceEventFilter::kHeapProfilerPredicate)
+ return;
+ }
+ // Adds a filter predicate to filter all categories for the heap profiler.
+ // Note that the heap profiler predicate does not filter-out any events.
+ EventFilterConfig heap_profiler_config(
+ TraceLog::TraceEventFilter::kHeapProfilerPredicate);
+ heap_profiler_config.AddIncludedCategory("*");
+ heap_profiler_config.AddIncludedCategory(MemoryDumpManager::kTraceCategory);
+ event_filters_.push_back(heap_profiler_config);
+ }
+}
+
+void TraceConfig::SetEventFilters(
const base::ListValue& category_event_filters) {
event_filters_.clear();
« no previous file with comments | « base/trace_event/trace_config.h ('k') | base/trace_event/trace_event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698