chromium/content/browser/tracing/background_tracing_rule.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/tracing/background_tracing_rule.h"

#include <limits>
#include <optional>
#include <string>
#include <type_traits>

#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/metrics_hashes.h"
#include "base/metrics/statistics_recorder.h"
#include "base/rand_util.h"
#include "base/strings/safe_sprintf.h"
#include "base/strings/strcat.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_id_helper.h"
#include "base/values.h"
#include "components/variations/hashing.h"
#include "content/browser/tracing/background_tracing_manager_impl.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "services/tracing/public/cpp/perfetto/macros.h"
#include "services/tracing/public/mojom/background_tracing_agent.mojom.h"
#include "third_party/perfetto/protos/perfetto/trace/track_event/chrome_histogram_sample.pbzero.h"

namespace {

const char kConfigRuleKey[] =;
const char kConfigRuleTriggerNameKey[] =;
const char kConfigRuleTriggerDelay[] =;
const char kConfigRuleTriggerChance[] =;
const char kConfigRuleIdKey[] =;
const char kConfigIsCrashKey[] =;

const char kConfigRuleHistogramNameKey[] =;
const char kConfigRuleHistogramValueOldKey[] =;
const char kConfigRuleHistogramValue1Key[] =;
const char kConfigRuleHistogramValue2Key[] =;

const char kConfigRuleTypeMonitorNamed[] =;

const char kConfigRuleTypeMonitorHistogram[] =;

}  // namespace

namespace content {

BackgroundTracingRule::BackgroundTracingRule() = default;

BackgroundTracingRule::~BackgroundTracingRule() {}

void BackgroundTracingRule::Install(RuleTriggeredCallback trigger_callback) {}

void BackgroundTracingRule::Uninstall() {}

bool BackgroundTracingRule::OnRuleTriggered(std::optional<int32_t> value) {}

base::TimeDelta BackgroundTracingRule::GetTraceDelay() const {}

std::string BackgroundTracingRule::GetDefaultRuleId() const {}

base::Value::Dict BackgroundTracingRule::ToDict() const {}

perfetto::protos::gen::TriggerRule BackgroundTracingRule::ToProtoForTesting()
    const {}

void BackgroundTracingRule::GenerateMetadataProto(
    BackgroundTracingRule::MetadataProto* out) const {}

void BackgroundTracingRule::Setup(const base::Value::Dict& dict) {}

void BackgroundTracingRule::Setup(
    const perfetto::protos::gen::TriggerRule& config) {}

namespace {

class NamedTriggerRule : public BackgroundTracingRule {};

class HistogramRule : public BackgroundTracingRule,
                      public BackgroundTracingManagerImpl::AgentObserver {};

class TimerRule : public BackgroundTracingRule {};

class RepeatingIntervalRule : public BackgroundTracingRule {};

}  // namespace

std::unique_ptr<BackgroundTracingRule>
BackgroundTracingRule::CreateRuleFromDict(const base::Value::Dict& dict) {}

std::unique_ptr<BackgroundTracingRule> BackgroundTracingRule::Create(
    const perfetto::protos::gen::TriggerRule& config) {}

bool BackgroundTracingRule::Append(
    const std::vector<perfetto::protos::gen::TriggerRule>& configs,
    std::vector<std::unique_ptr<BackgroundTracingRule>>& rules) {}

}  // namespace content