Commit a99adfed authored by Ehsan Chiniforooshan's avatar Ehsan Chiniforooshan Committed by Commit Bot

Tracing: Fix a crash

After https://chromium-review.googlesource.com/c/chromium/src/+/1372719,
a trace flush could be completed before SendRecorder is run. It's
because we may decide to ignore a new agent and send a dummy recorder
to it. So, SendRecorder should not assume trace_streamer_ exists, and
it really does not need to.

Bug: 916974
Change-Id: Ic335a176e1ed7158ce65578bc7c4f73e0e02e8a4
Reviewed-on: https://chromium-review.googlesource.com/c/1387026Reviewed-by: default avataroysteine <oysteine@chromium.org>
Commit-Queue: Ehsan Chiniforooshan <chiniforooshan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619422}
parent 8cf5f350
...@@ -87,10 +87,6 @@ class Coordinator::TraceStreamer : public base::SupportsWeakPtr<TraceStreamer> { ...@@ -87,10 +87,6 @@ class Coordinator::TraceStreamer : public base::SupportsWeakPtr<TraceStreamer> {
agent_entry, std::move(ptr))); agent_entry, std::move(ptr)));
} }
// Called from |backend_task_runner_| to close the recorder proxy on the
// correct task runner.
void CloseRecorder(mojom::RecorderPtr recorder) {}
// Called from |main_task_runner_| either after flushing is complete or at // Called from |main_task_runner_| either after flushing is complete or at
// shutdown. We either will not write to the stream afterwards or do not care // shutdown. We either will not write to the stream afterwards or do not care
// what happens to what we try to write. // what happens to what we try to write.
...@@ -435,8 +431,7 @@ void Coordinator::SendRecorder( ...@@ -435,8 +431,7 @@ void Coordinator::SendRecorder(
// Recorders are created and closed on |backend_task_runner_|. // Recorders are created and closed on |backend_task_runner_|.
backend_task_runner_->PostTask( backend_task_runner_->PostTask(
FROM_HERE, FROM_HERE,
base::BindOnce(&Coordinator::TraceStreamer::CloseRecorder, base::BindOnce([](mojom::RecorderPtr ptr) {}, std::move(recorder)));
trace_streamer_->AsWeakPtr(), std::move(recorder)));
} }
} }
......
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