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

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: Change mode to int. 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
« no previous file with comments | « content/browser/devtools/protocol/tracing_handler_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
+ // 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);
}
« no previous file with comments | « content/browser/devtools/protocol/tracing_handler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698