blob: 99540d2897ead1b82271015a42eedd70e45aadd5 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/tracing/public/cpp/base_agent.h"
#include <utility>
#include "services/tracing/public/cpp/traced_process_impl.h"
#include "services/tracing/public/mojom/constants.mojom.h"
namespace tracing {
BaseAgent::BaseAgent(const std::string& label,
mojom::TraceDataType type,
base::ProcessId pid)
: binding_(this), label_(label), type_(type), pid_(pid) {
TracedProcessImpl::GetInstance()->RegisterAgent(this);
}
BaseAgent::~BaseAgent() {
TracedProcessImpl::GetInstance()->UnregisterAgent(this);
}
void BaseAgent::Connect(tracing::mojom::AgentRegistry* agent_registry) {
tracing::mojom::AgentPtr agent;
binding_.Bind(mojo::MakeRequest(&agent));
binding_.set_connection_error_handler(
base::BindRepeating(&BaseAgent::Disconnect, base::Unretained(this)));
agent_registry->RegisterAgent(std::move(agent), label_, type_, pid_);
}
void BaseAgent::GetCategories(std::set<std::string>* category_set) {}
void BaseAgent::Disconnect() {
binding_.Close();
}
void BaseAgent::StartTracing(const std::string& config,
base::TimeTicks coordinator_time) {}
void BaseAgent::StopAndFlush(tracing::mojom::RecorderPtr recorder) {}
void BaseAgent::RequestBufferStatus(
Agent::RequestBufferStatusCallback callback) {
std::move(callback).Run(0 /* capacity */, 0 /* count */);
}
} // namespace tracing