#ifndef SERVICES_TRACING_PUBLIC_CPP_TRACE_STARTUP_H_
#define SERVICES_TRACING_PUBLIC_CPP_TRACE_STARTUP_H_
#include "base/component_export.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/unsafe_shared_memory_region.h"
#include "base/process/launch.h"
#include "build/build_config.h"
#include "third_party/perfetto/include/perfetto/tracing/core/trace_config.h"
#if BUILDFLAG(IS_POSIX)
#include "base/posix/global_descriptors.h"
#endif
namespace base {
class CommandLine;
}
namespace tracing {
inline constexpr uint32_t kStartupTracingTimeoutMs = 30 * 1000;
bool COMPONENT_EXPORT(TRACING_CPP) IsTracingInitialized();
void COMPONENT_EXPORT(TRACING_CPP)
InitTracing(bool enable_consumer,
bool will_trace_thread_restart,
bool enable_system_backend,
base::RepeatingCallback<bool()> allow_system_tracing_consumer);
void COMPONENT_EXPORT(TRACING_CPP) InitTracingPostFeatureList(
bool enable_consumer,
bool will_trace_thread_restart,
base::RepeatingCallback<bool()> allow_system_tracing_consumer =
base::NullCallback());
base::ReadOnlySharedMemoryRegion COMPONENT_EXPORT(TRACING_CPP)
CreateTracingConfigSharedMemory();
base::UnsafeSharedMemoryRegion COMPONENT_EXPORT(TRACING_CPP)
CreateTracingOutputSharedMemory();
void COMPONENT_EXPORT(TRACING_CPP) AddTraceConfigToLaunchParameters(
const base::ReadOnlySharedMemoryRegion& read_only_memory_region,
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE)
base::GlobalDescriptors::Key descriptor_key,
base::ScopedFD& out_descriptor_to_share,
#endif
base::CommandLine* command_line,
base::LaunchOptions* launch_options);
void COMPONENT_EXPORT(TRACING_CPP) AddTraceOutputToLaunchParameters(
const base::UnsafeSharedMemoryRegion& unsafe_memory_region,
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE)
base::GlobalDescriptors::Key descriptor_key,
base::ScopedFD& out_descriptor_to_share,
#endif
base::CommandLine* command_line,
base::LaunchOptions* launch_options);
}
#endif