chromium/services/tracing/public/cpp/perfetto/producer_client.cc

// Copyright 2018 The Chromium Authors
// 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/perfetto/producer_client.h"

#include <utility>

#include "base/auto_reset.h"
#include "base/containers/adapters.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/memory/unsafe_shared_memory_region.h"
#include "base/metrics/histogram_functions.h"
#include "base/process/process.h"
#include "base/tracing/tracing_tls.h"
#include "build/build_config.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/tracing/public/cpp/perfetto/shared_memory.h"
#include "services/tracing/public/cpp/perfetto/trace_event_data_source.h"
#include "services/tracing/public/cpp/traced_process_impl.h"
#include "services/tracing/public/mojom/constants.mojom.h"
#include "third_party/perfetto/include/perfetto/ext/tracing/core/commit_data_request.h"
#include "third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_arbiter.h"
#include "third_party/perfetto/include/perfetto/ext/tracing/core/trace_writer.h"
#include "third_party/perfetto/include/perfetto/protozero/scattered_heap_buffer.h"
#include "third_party/perfetto/include/perfetto/protozero/scattered_stream_writer.h"
#include "third_party/perfetto/protos/perfetto/common/track_event_descriptor.pbzero.h"

namespace {
// Result for getting the shared buffer in InitSharedMemoryIfNeeded.
constexpr char kSharedBufferIsValidMetricName[] =;
}  // namespace

ShmemMode;

namespace tracing {

ProducerClient::ProducerClient(base::tracing::PerfettoTaskRunner* task_runner)
    :{}

ProducerClient::~ProducerClient() {}

void ProducerClient::Connect(
    mojo::PendingRemote<mojom::PerfettoService> perfetto_service) {}

void ProducerClient::BindInProcessSharedMemoryArbiter(
    perfetto::TracingService::ProducerEndpoint* producer_endpoint,
    base::tracing::PerfettoTaskRunner* task_runner) {}

void ProducerClient::Disconnect() {}

void ProducerClient::BindStartupTargetBuffer(
    uint16_t target_buffer_reservation_id,
    perfetto::BufferID startup_target_buffer) {}

void ProducerClient::AbortStartupTracingForReservation(
    uint16_t target_buffer_reservation_id) {}

perfetto::SharedMemoryArbiter* ProducerClient::MaybeSharedMemoryArbiter() {}

void ProducerClient::NewDataSourceAdded(
    const PerfettoTracedProcess::DataSourceBase* const data_source) {}

bool ProducerClient::IsTracingActive() {}

void ProducerClient::OnTracingStart() {}

void ProducerClient::StartDataSource(
    uint64_t id,
    const perfetto::DataSourceConfig& data_source_config,
    StartDataSourceCallback callback) {}

void ProducerClient::StopDataSource(uint64_t id,
                                    StopDataSourceCallback callback) {}

void ProducerClient::Flush(uint64_t flush_request_id,
                           const std::vector<uint64_t>& data_source_ids) {}

void ProducerClient::ClearIncrementalState() {}

std::unique_ptr<perfetto::TraceWriter> ProducerClient::CreateTraceWriter(
    perfetto::BufferID target_buffer,
    perfetto::BufferExhaustedPolicy buffer_exhausted_policy) {}

void ProducerClient::CommitData(const perfetto::CommitDataRequest& commit,
                                CommitDataCallback callback) {}

void ProducerClient::RegisterTraceWriter(uint32_t writer_id,
                                         uint32_t target_buffer) {}

void ProducerClient::UnregisterTraceWriter(uint32_t writer_id) {}

perfetto::SharedMemory* ProducerClient::shared_memory() const {}

void ProducerClient::NotifyFlushComplete(perfetto::FlushRequestID id) {}

void ProducerClient::RegisterDataSource(const perfetto::DataSourceDescriptor&) {}

void ProducerClient::UpdateDataSource(const perfetto::DataSourceDescriptor&) {}

void ProducerClient::UnregisterDataSource(const std::string& name) {}

void ProducerClient::NotifyDataSourceStopped(
    perfetto::DataSourceInstanceID id) {}

void ProducerClient::NotifyDataSourceStarted(
    perfetto::DataSourceInstanceID id) {}

void ProducerClient::ActivateTriggers(const std::vector<std::string>&) {}

size_t ProducerClient::shared_buffer_page_size_kb() const {}

bool ProducerClient::IsShmemProvidedByProducer() const {}

void ProducerClient::Sync(std::function<void()>) {}

void ProducerClient::BindClientAndHostPipesForTesting(
    mojo::PendingReceiver<mojom::ProducerClient> producer_client_receiver,
    mojo::PendingRemote<mojom::ProducerHost> producer_host_remote) {}

perfetto::SharedMemory* ProducerClient::shared_memory_for_testing() {}

bool ProducerClient::InitSharedMemoryIfNeeded() {}

bool ProducerClient::SetupSharedMemoryForStartupTracing() {}

// The Mojo binding should run on the same sequence as the one we get
// callbacks from Perfetto on, to avoid additional PostTasks.
void ProducerClient::BindClientAndHostPipesOnSequence(
    mojo::PendingReceiver<mojom::ProducerClient> producer_client_receiver,
    mojo::PendingRemote<mojom::ProducerHost> producer_host_info) {}

void ProducerClient::NotifyDataSourceFlushComplete(
    perfetto::FlushRequestID id) {}

}  // namespace tracing