#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "services/tracing/perfetto/producer_host.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/process/process.h"
#include "base/tracing/perfetto_task_runner.h"
#include "build/build_config.h"
#include "services/tracing/perfetto/perfetto_service.h"
#include "services/tracing/public/cpp/perfetto/producer_client.h"
#include "services/tracing/public/cpp/perfetto/shared_memory.h"
#include "third_party/perfetto/include/perfetto/ext/tracing/core/client_identity.h"
#include "third_party/perfetto/include/perfetto/ext/tracing/core/commit_data_request.h"
#include "third_party/perfetto/include/perfetto/tracing/core/data_source_descriptor.h"
#include "third_party/perfetto/include/perfetto/tracing/core/trace_config.h"
namespace tracing {
ProducerHost::ProducerHost(base::tracing::PerfettoTaskRunner* task_runner)
: … { … }
ProducerHost::~ProducerHost() { … }
ProducerHost::InitializationResult ProducerHost::Initialize(
mojo::PendingRemote<mojom::ProducerClient> producer_client,
perfetto::TracingService* service,
const std::string& name,
base::UnsafeSharedMemoryRegion shared_memory,
uint64_t shared_memory_buffer_page_size_bytes) { … }
void ProducerHost::OnConnect() { … }
void ProducerHost::OnDisconnect() { … }
void ProducerHost::OnTracingSetup() { … }
void ProducerHost::SetupDataSource(perfetto::DataSourceInstanceID,
const perfetto::DataSourceConfig&) { … }
void ProducerHost::StartDataSource(perfetto::DataSourceInstanceID id,
const perfetto::DataSourceConfig& config) { … }
void ProducerHost::StopDataSource(perfetto::DataSourceInstanceID id) { … }
void ProducerHost::Flush(
perfetto::FlushRequestID id,
const perfetto::DataSourceInstanceID* raw_data_source_ids,
size_t num_data_sources,
perfetto::FlushFlags ) { … }
void ProducerHost::ClearIncrementalState(const perfetto::DataSourceInstanceID*,
size_t) { … }
void ProducerHost::CommitData(const perfetto::CommitDataRequest& data_request,
CommitDataCallback callback) { … }
void ProducerHost::RegisterDataSource(
const perfetto::DataSourceDescriptor& registration_info) { … }
void ProducerHost::RegisterTraceWriter(uint32_t writer_id,
uint32_t target_buffer) { … }
void ProducerHost::UnregisterTraceWriter(uint32_t writer_id) { … }
}