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

Unified Diff: content/browser/tracing/background_tracing_manager_impl.cc

Issue 2041583003: [tracing] Introduce "allowed_dump_modes" for memory dump config (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@background_config
Patch Set: rebase. Created 4 years, 6 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
Index: content/browser/tracing/background_tracing_manager_impl.cc
diff --git a/content/browser/tracing/background_tracing_manager_impl.cc b/content/browser/tracing/background_tracing_manager_impl.cc
index 13c60a93e12d62d95d69962d7f97efdf5cccc696..14746163c2cd28098ffb8de72a0e58835f278103 100644
--- a/content/browser/tracing/background_tracing_manager_impl.cc
+++ b/content/browser/tracing/background_tracing_manager_impl.cc
@@ -50,10 +50,13 @@ void RecordBackgroundTracingMetric(BackgroundTracingMetrics metric) {
}
// Tracing enabled callback for BENCHMARK_MEMORY_LIGHT category preset.
-// TODO(ssid): Remove this when background tracing supports trace config strings
-// and memory-infra supports peak detection crbug.com/609935.
void BenchmarkMemoryLight_TracingEnabledCallback() {
- base::trace_event::MemoryDumpManager::GetInstance()->RequestGlobalDump(
+ auto dump_manager = base::trace_event::MemoryDumpManager::GetInstance();
+ // Safety check to make sure the memory-infra restrictions are properly
oystein (OOO til 10th of July) 2016/06/20 17:02:18 I'm a bit confused by this. Why does it matter whe
ssid 2016/06/20 19:12:06 So, this is here to ensure that all this code in t
Primiano Tucci (use gerrit) 2016/06/21 06:50:49 Yup this is essentially my paranoy in action. It's
+ // propagated via TraceConfig
+ CHECK(!dump_manager->IsDumpModeAllowed(
+ base::trace_event::MemoryDumpLevelOfDetail::DETAILED));
+ dump_manager->RequestGlobalDump(
base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED,
base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND);
}
@@ -414,8 +417,13 @@ void BackgroundTracingManagerImpl::StartTracing(
BENCHMARK_MEMORY_LIGHT) {
// On memory light mode, the periodic memory dumps are disabled and a single
// memory dump is requested after tracing is enabled in all the processes.
- trace_config.ResetMemoryDumpConfig(
- base::trace_event::TraceConfig::MemoryDumpConfig());
+ // TODO(ssid): Remove this when background tracing supports trace config
+ // strings and memory-infra supports peak detection crbug.com/609935.
+ base::trace_event::TraceConfig::MemoryDumpConfig memory_config;
+ memory_config.allowed_dump_modes =
+ std::set<base::trace_event::MemoryDumpLevelOfDetail>(
+ {base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND});
+ trace_config.ResetMemoryDumpConfig(memory_config);
tracing_enabled_callback =
base::Bind(&BenchmarkMemoryLight_TracingEnabledCallback);
}

Powered by Google App Engine
This is Rietveld 408576698