#include "services/tracing/public/cpp/trace_startup_config.h"
#include <stddef.h>
#include <memory>
#include <string>
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/shared_memory_switch.h"
#include "base/no_destructor.h"
#include "base/strings/string_number_conversions.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/trace_log.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/tracing/common/tracing_switches.h"
#include "services/tracing/public/cpp/perfetto/perfetto_config.h"
#include "services/tracing/public/mojom/perfetto_service.mojom.h"
#include "third_party/perfetto/protos/perfetto/config/track_event/track_event_config.gen.h"
#if BUILDFLAG(IS_ANDROID)
#include "base/android/early_trace_event_binding.h"
#endif
namespace tracing {
namespace {
const size_t kTraceConfigFileSizeLimit = …;
#if BUILDFLAG(IS_ANDROID)
const base::FilePath::CharType kAndroidTraceConfigFile[] =
FILE_PATH_LITERAL("/data/local/chrome-trace-config.json");
#endif
const char kTraceConfigParam[] = …;
const char kStartupDurationParam[] = …;
const char kResultFileParam[] = …;
const char kResultDirectoryParam[] = …;
constexpr std::string_view kDefaultStartupCategories[] = …;
}
TraceStartupConfig& TraceStartupConfig::GetInstance() { … }
perfetto::TraceConfig TraceStartupConfig::GetDefaultBackgroundStartupConfig() { … }
TraceStartupConfig::TraceStartupConfig() { … }
TraceStartupConfig::~TraceStartupConfig() = default;
bool TraceStartupConfig::IsEnabled() const { … }
void TraceStartupConfig::SetDisabled() { … }
perfetto::TraceConfig TraceStartupConfig::GetPerfettoConfig() const { … }
TraceStartupConfig::OutputFormat TraceStartupConfig::GetOutputFormat() const { … }
base::FilePath TraceStartupConfig::GetResultFile() const { … }
void TraceStartupConfig::SetBackgroundStartupTracingEnabled(bool enabled) { … }
TraceStartupConfig::SessionOwner TraceStartupConfig::GetSessionOwner() const { … }
bool TraceStartupConfig::AttemptAdoptBySessionOwner(SessionOwner owner) { … }
bool TraceStartupConfig::EnableFromCommandLine() { … }
bool TraceStartupConfig::EnableFromConfigHandle() { … }
bool TraceStartupConfig::EnableFromConfigFile() { … }
bool TraceStartupConfig::EnableFromBackgroundTracing() { … }
bool TraceStartupConfig::ParseTraceConfigFileContent(
const std::string& content) { … }
}