Chromium Code Reviews| Index: base/trace_event/memory_dump_manager.cc |
| diff --git a/base/trace_event/memory_dump_manager.cc b/base/trace_event/memory_dump_manager.cc |
| index 9719a6c672086ad9fc9f1c0d815c0b127efcb430..3b5f327197ad2970a05620f4140c2f349c9ac76f 100644 |
| --- a/base/trace_event/memory_dump_manager.cc |
| +++ b/base/trace_event/memory_dump_manager.cc |
| @@ -201,12 +201,32 @@ void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate, |
| nullptr); |
| #endif |
| + TRACE_EVENT0(kTraceCategory, "init"); // Add to trace-viewer category list. |
|
Primiano Tucci (use gerrit)
2016/10/12 17:50:17
I learned only recently that there is a macro for
ssid
2016/10/12 19:04:43
Done.
|
| + |
| + // TODO(ssid): This should be done in EnableHeapProfiling so that we capture |
| + // more allocations (crbug.com/625170). |
| + // Adding filters if filtering was already enabled is not supported by |
| + // TraceLog. So, in case of startup tracing filtering mode is not enabled. |
|
Primiano Tucci (use gerrit)
2016/10/12 17:50:17
s/startup/background/ I think?
ssid
2016/10/12 19:04:43
Actually this is not true. The first comment takes
|
| + if (heap_profiling_enabled_ && |
| + !(TraceLog::GetInstance()->enabled_modes() & TraceLog::FILTERING_MODE)) { |
|
Primiano Tucci (use gerrit)
2016/10/12 17:50:17
shouldn't you do all this only if enabled for pseu
ssid
2016/10/12 19:04:43
Sorry this was mistake. That will be different pat
|
| + TraceConfig::EventFilterConfig heap_profiler_filter_config( |
| + TraceLog::TraceEventFilter::kHeapProfilerPredicate); |
| + heap_profiler_filter_config.AddIncludedCategory("*"); |
|
Primiano Tucci (use gerrit)
2016/10/12 17:50:17
should you also include here disabled-by-default-*
ssid
2016/10/12 19:04:43
Currently we enable disabled-by-default categories
|
| + heap_profiler_filter_config.AddIncludedCategory( |
| + MemoryDumpManager::kTraceCategory); |
|
Primiano Tucci (use gerrit)
2016/10/12 17:50:17
out of curiosity why do yo need to add memory-infr
ssid
2016/10/12 19:04:43
In case in future we decide to have enabled-catego
oystein (OOO til 10th of July)
2016/10/13 00:34:29
If this is just in-case we change this in the futu
|
| + TraceConfig::EventFilters filters; |
| + filters.push_back(heap_profiler_filter_config); |
| + TraceConfig filtering_trace_config; |
| + filtering_trace_config.SetEventFilterConfigs(filters); |
| + TraceLog::GetInstance()->SetEnabled(filtering_trace_config, |
| + TraceLog::FILTERING_MODE); |
| + } |
| + |
| // If tracing was enabled before initializing MemoryDumpManager, we missed the |
| // OnTraceLogEnabled() event. Synthetize it so we can late-join the party. |
| - bool is_tracing_already_enabled = TraceLog::GetInstance()->IsEnabled(); |
| - TRACE_EVENT0(kTraceCategory, "init"); // Add to trace-viewer category list. |
| + bool tracing_already_enabled = TraceLog::GetInstance()->IsEnabled(); |
| TraceLog::GetInstance()->AddEnabledStateObserver(this); |
| - if (is_tracing_already_enabled) |
| + if (tracing_already_enabled) |
| OnTraceLogEnabled(); |
| } |