chromium/components/tracing/common/background_tracing_utils.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/tracing/common/background_tracing_utils.h"

#include <memory>
#include <string>
#include <utility>

#include "base/base64.h"
#include "base/check.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "components/tracing/common/background_tracing_state_manager.h"
#include "components/tracing/common/tracing_switches.h"
#include "content/public/browser/background_tracing_manager.h"
#include "content/public/browser/browser_thread.h"
#include "third_party/snappy/src/snappy.h"

namespace tracing {

BASE_FEATURE();
BASE_FEATURE();
BASE_FEATURE();

namespace {

const base::FeatureParam<std::string> kTracingTriggerRulesConfig{};
const base::FeatureParam<bool> kTracingTriggerRulesCompressed{};
const base::FeatureParam<std::string> kFieldTracingConfig{};
const base::FeatureParam<bool> kFieldTracingCompressed{};
const base::FeatureParam<bool> kFieldTracingAnonymized{};
const base::FeatureParam<bool> kStartupFieldTracing{};
const base::FeatureParam<std::string> kPresetTracingConfig{};
const base::FeatureParam<bool> kPresetTracingCompressed{};

bool BlockingWriteTraceToFile(const base::FilePath& output_file,
                              std::string file_contents) {}

void WriteTraceToFile(
    const base::FilePath& output_path,
    const std::string& file_name,
    std::string file_contents,
    content::BackgroundTracingManager::FinishedProcessingCallback
        done_callback) {}

std::unique_ptr<content::BackgroundTracingConfig>
GetBackgroundTracingConfigFromFile(const base::FilePath& config_file) {}

std::optional<perfetto::protos::gen::ChromeFieldTracingConfig>
GetTracingConfigFromFeature(const base::Feature& feature,
                            const base::FeatureParam<std::string> feature_param,
                            bool is_compressed) {}

}  // namespace

void RecordDisallowedMetric(TracingFinalizationDisallowedReason reason) {}

bool SetupBackgroundTracingFromJsonConfigFile(
    const base::FilePath& config_file) {}

bool SetupBackgroundTracingFromProtoConfigFile(
    const base::FilePath& config_file) {}

bool SetupBackgroundTracingFromCommandLine() {}

bool SetupPresetTracingFromFieldTrial() {}

bool HasBackgroundTracingOutputPath() {}

bool SetBackgroundTracingOutputPath() {}

BackgroundTracingSetupMode GetBackgroundTracingSetupMode() {}

std::optional<perfetto::protos::gen::ChromeFieldTracingConfig>
GetFieldTracingConfig() {}

bool ShouldAnonymizeFieldTracing() {}

bool ShouldTraceStartup() {}

std::optional<perfetto::protos::gen::ChromeFieldTracingConfig>
GetPresetTracingConfig() {}

std::optional<perfetto::protos::gen::TracingTriggerRulesConfig>
GetTracingTriggerRulesConfig() {}

bool IsFieldTracingEnabled() {}

}  // namespace tracing