#include "components/variations/variations_crash_keys.h"
#include <set>
#include <string>
#include "base/command_line.h"
#include "base/debug/leak_annotations.h"
#include "base/metrics/field_trial_list_including_low_anonymity.h"
#include "base/metrics/histogram_macros.h"
#include "base/sequence_checker.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "build/buildflag.h"
#include "build/chromeos_buildflags.h"
#include "components/crash/core/common/crash_key.h"
#include "components/variations/active_field_trials.h"
#include "components/variations/buildflags.h"
#include "components/variations/synthetic_trials.h"
#include "components/variations/variations_switches.h"
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)
#include "base/task/thread_pool.h"
#include "components/variations/variations_crash_keys_chromeos.h"
#endif
namespace variations {
namespace {
#if BUILDFLAG(LARGE_VARIATION_KEY_SIZE)
constexpr size_t kVariationsKeySize = 1024 * 8;
constexpr char kVariationKeySizeHistogram[] =
"Variations.Limits.VariationKeySize.Large";
#else
constexpr size_t kVariationsKeySize = …;
constexpr char kVariationKeySizeHistogram[] = …;
#endif
constexpr size_t kVariationsKeySizeNumBuckets = …;
crash_reporter::CrashKeyString<8> g_num_variations_crash_key(
kNumExperimentsKey);
crash_reporter::CrashKeyString<kVariationsKeySize> g_variations_crash_key(
kExperimentListKey);
crash_reporter::CrashKeyString<64> g_variations_seed_version_crash_key(
kVariationsSeedVersionKey);
std::string GetVariationsSeedVersion() { … }
}
class VariationsCrashKeys final : public base::FieldTrialList::Observer { … };
VariationsCrashKeys::VariationsCrashKeys() { … }
VariationsCrashKeys::~VariationsCrashKeys() { … }
void VariationsCrashKeys::OnFieldTrialGroupFinalized(
const base::FieldTrial& trial,
const std::string& group_name) { … }
bool VariationsCrashKeys::AppendFieldTrial(const std::string& trial_name,
const std::string& group_name,
bool is_overridden) { … }
void VariationsCrashKeys::AppendFieldTrialAndUpdateCrashKeys(
const std::string& trial_name,
const std::string& group_name,
bool is_overridden) { … }
ExperimentListInfo VariationsCrashKeys::GetExperimentListInfo() { … }
void VariationsCrashKeys::UpdateCrashKeys() { … }
void VariationsCrashKeys::OnSyntheticTrialsChanged(
const std::vector<SyntheticTrialGroup>& synthetic_trials) { … }
VariationsCrashKeys* g_variations_crash_keys = …;
const char kNumExperimentsKey[] = …;
const char kExperimentListKey[] = …;
const char kVariationsSeedVersionKey[] = …;
void InitCrashKeys() { … }
void UpdateCrashKeysWithSyntheticTrials(
const std::vector<SyntheticTrialGroup>& synthetic_trials) { … }
void ClearCrashKeysInstanceForTesting() { … }
ExperimentListInfo GetExperimentListInfo() { … }
std::string ActiveGroupToString(const ActiveGroupId& active_group) { … }
}