Clear client priority when comparing config hashes for startup tracing
Chrome always sets the priority to USER_INITIATED when setting up
startup tracing.
Bug: b/256614804
Change-Id: I3ac2a7cec7b5b35a674b47400d9c6b495a7d6b59
diff --git a/src/tracing/internal/tracing_muxer_impl.cc b/src/tracing/internal/tracing_muxer_impl.cc
index 219b413..729bdb4 100644
--- a/src/tracing/internal/tracing_muxer_impl.cc
+++ b/src/tracing/internal/tracing_muxer_impl.cc
@@ -46,6 +46,7 @@
#include "src/tracing/core/null_trace_writer.h"
#include "src/tracing/internal/tracing_muxer_fake.h"
+#include "protos/perfetto/config/chrome/chrome_config.gen.h"
#include "protos/perfetto/config/interceptor_config.gen.h"
#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
@@ -144,6 +145,14 @@
config.set_trace_duration_ms(0);
config.set_stop_timeout_ms(0);
config.set_enable_extra_guardrails(false);
+ // Clear client priority inside Chrome config, because Chrome always sets
+ // the priority to USER_INITIATED when setting up startup tracing.
+ // TODO(khokhlov): Remove this when Chrome correctly sets client_priority
+ // for startup tracing (and propagates it to all child processes).
+ if (config.has_chrome_config()) {
+ config.mutable_chrome_config()->set_client_priority(
+ perfetto::protos::gen::ChromeConfig::UNKNOWN);
+ }
base::Hasher hasher;
std::string config_bytes = config.SerializeAsString();
hasher.Update(config_bytes.data(), config_bytes.size());