#include "services/tracing/perfetto/perfetto_service.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/no_destructor.h"
#include "base/process/process_handle.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/task/sequenced_task_runner.h"
#include "build/build_config.h"
#include "mojo/public/cpp/bindings/message.h"
#include "services/tracing/perfetto/consumer_host.h"
#include "services/tracing/perfetto/producer_host.h"
#include "services/tracing/public/cpp/perfetto/custom_event_recorder.h"
#include "services/tracing/public/cpp/perfetto/shared_memory.h"
#include "third_party/perfetto/include/perfetto/ext/tracing/core/tracing_service.h"
namespace tracing {
namespace {
bool ParseProcessId(const std::string& pid_as_string, base::ProcessId* pid) { … }
}
bool PerfettoService::ParsePidFromProducerName(const std::string& producer_name,
base::ProcessId* pid) { … }
PerfettoService* PerfettoService::GetInstance() { … }
PerfettoService::PerfettoService(
scoped_refptr<base::SequencedTaskRunner> task_runner_for_testing)
: … { … }
PerfettoService::~PerfettoService() = default;
perfetto::TracingService* PerfettoService::GetService() const { … }
void PerfettoService::BindReceiver(
mojo::PendingReceiver<mojom::PerfettoService> receiver,
uint32_t pid) { … }
void PerfettoService::ConnectToProducerHost(
mojo::PendingRemote<mojom::ProducerClient> producer_client,
mojo::PendingReceiver<mojom::ProducerHost> producer_host_receiver,
base::UnsafeSharedMemoryRegion shared_memory,
uint64_t shared_memory_buffer_page_size_bytes) { … }
void PerfettoService::AddActiveServicePid(base::ProcessId pid) { … }
void PerfettoService::RemoveActiveServicePid(base::ProcessId pid) { … }
void PerfettoService::RemoveActiveServicePidIfNoActiveConnections(
base::ProcessId pid) { … }
void PerfettoService::SetActiveServicePidsInitialized() { … }
void PerfettoService::RegisterTracingSession(
ConsumerHost::TracingSession* tracing_session) { … }
void PerfettoService::UnregisterTracingSession(
ConsumerHost::TracingSession* tracing_session) { … }
void PerfettoService::RequestTracingSession(
mojom::TracingClientPriority priority,
base::OnceClosure callback) { … }
void PerfettoService::OnServiceDisconnect() { … }
void PerfettoService::OnProducerHostDisconnect() { … }
void PerfettoService::OnDisconnectFromProcess(base::ProcessId pid) { … }
}