Commit c5b331e9 authored by Oystein Eftevaag's avatar Oystein Eftevaag Committed by Commit Bot

Perfetto: Start tracing as soon as the Consumer endpoint is created

Previously this was done in the OnConnect() callback, but it turns
out this is called via PostTask() so if tracing gets disabled immediately
after it's enabled, the disable call can come in between and causes
test failures due to the StopAndFlush callback never happening.

Bug: 873073,872631
Change-Id: I343060c5e4b9d66575e6b8fe71a28cc9b706a429
Reviewed-on: https://chromium-review.googlesource.com/1171658Reviewed-by: default avatarSiddhartha S <ssid@chromium.org>
Commit-Queue: oysteine <oysteine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582758}
parent aaca598d
...@@ -487,9 +487,7 @@ IN_PROC_BROWSER_TEST_F(TracingControllerTest, ...@@ -487,9 +487,7 @@ IN_PROC_BROWSER_TEST_F(TracingControllerTest,
} }
// TODO(crbug.com/871770): Disabled for failing on ASAN. // TODO(crbug.com/871770): Disabled for failing on ASAN.
// TODO(crbug.com/872631): Disabled on Android as flaky. #if defined(ADDRESS_SANITIZER)
// TODO(crbug.com/873073): Disabled on Linux as flaky.
#if defined(ADDRESS_SANITIZER) || defined(OS_ANDROID) || defined(OS_LINUX)
#define MAYBE_EnableAndStopTracingWithEmptyFile \ #define MAYBE_EnableAndStopTracingWithEmptyFile \
DISABLED_EnableAndStopTracingWithEmptyFile DISABLED_EnableAndStopTracingWithEmptyFile
#else #else
...@@ -517,9 +515,7 @@ IN_PROC_BROWSER_TEST_F(TracingControllerTest, ...@@ -517,9 +515,7 @@ IN_PROC_BROWSER_TEST_F(TracingControllerTest,
} }
// TODO(crbug.com/871770): Disabled for failing on ASAN. // TODO(crbug.com/871770): Disabled for failing on ASAN.
// TODO(crbug.com/872631): Disabled on Android as flaky. #if defined(ADDRESS_SANITIZER)
// TODO(crbug.com/873073): Disabled on Linux as flaky.
#if defined(ADDRESS_SANITIZER) || defined(OS_ANDROID) || defined(OS_LINUX)
#define MAYBE_DoubleStopTracing DISABLED_DoubleStopTracing #define MAYBE_DoubleStopTracing DISABLED_DoubleStopTracing
#else #else
#define MAYBE_DoubleStopTracing DoubleStopTracing #define MAYBE_DoubleStopTracing DoubleStopTracing
......
...@@ -184,11 +184,7 @@ JSONTraceExporter::JSONTraceExporter(const std::string& config, ...@@ -184,11 +184,7 @@ JSONTraceExporter::JSONTraceExporter(const std::string& config,
perfetto::TracingService* service) perfetto::TracingService* service)
: config_(config), metadata_(std::make_unique<base::DictionaryValue>()) { : config_(config), metadata_(std::make_unique<base::DictionaryValue>()) {
consumer_endpoint_ = service->ConnectConsumer(this); consumer_endpoint_ = service->ConnectConsumer(this);
}
JSONTraceExporter::~JSONTraceExporter() = default;
void JSONTraceExporter::OnConnect() {
// Start tracing. // Start tracing.
perfetto::TraceConfig trace_config; perfetto::TraceConfig trace_config;
trace_config.add_buffers()->set_size_kb(4096 * 100); trace_config.add_buffers()->set_size_kb(4096 * 100);
...@@ -207,6 +203,10 @@ void JSONTraceExporter::OnConnect() { ...@@ -207,6 +203,10 @@ void JSONTraceExporter::OnConnect() {
consumer_endpoint_->EnableTracing(trace_config); consumer_endpoint_->EnableTracing(trace_config);
} }
JSONTraceExporter::~JSONTraceExporter() = default;
void JSONTraceExporter::OnConnect() {}
void JSONTraceExporter::OnDisconnect() {} void JSONTraceExporter::OnDisconnect() {}
void JSONTraceExporter::OnTracingDisabled() { void JSONTraceExporter::OnTracingDisabled() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment