Commit c214961e authored by charliea's avatar charliea Committed by Commit bot

trace_controller: Makes StopTracing callback ignore empty event strings

This will give us the flexibility within PowerTracingAgent to signify
that an error occurred (such as bad data coming over the serial
connection).

Review URL: https://codereview.chromium.org/1637933002

Cr-Commit-Position: refs/heads/master@{#371587}
parent 5b2e8d78
......@@ -26,6 +26,8 @@ class TraceConfig;
// system trace and PowerTracingAgent for BattOr power trace.
class BASE_EXPORT TracingAgent {
public:
// Passing a null or empty events_str_ptr indicates that no trace data is
// available for the specified agent.
using StopAgentTracingCallback = base::Callback<void(
const std::string& agent_name,
const std::string& events_label,
......
......@@ -714,7 +714,8 @@ void TracingControllerImpl::OnEndAgentTracingAcked(
const scoped_refptr<base::RefCountedString>& events_str_ptr) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (trace_data_sink_.get()) {
if (trace_data_sink_.get() && events_str_ptr &&
!events_str_ptr->data().empty()) {
std::string json_string;
if (agent_name == kETWTracingAgentName) {
// The Windows kernel events are kept into a JSON format stored as string
......
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