#include "components/variations/variations_layers.h"
#include <stddef.h>
#include <stdint.h>
#include <cstdint>
#include <memory>
#include <optional>
#include <set>
#include <type_traits>
#include "base/check_op.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_functions.h"
#include "base/numerics/checked_math.h"
#include "components/variations/entropy_provider.h"
#include "components/variations/proto/layer.pb.h"
namespace variations {
namespace {
void LogInvalidLayerReason(InvalidLayerReason reason) { … }
const Layer::LayerMember* FindActiveMemberBySlot(uint32_t chosen_slot,
const Layer& layer_proto) { … }
struct SlotSelection { … };
SlotSelection SelectSlot(ValueInRange pseudorandom, uint32_t num_slots) { … }
ValueInRange CombineRanges(ValueInRange major, ValueInRange minor) { … }
ValueInRange SlotOfMember(const Layer::LayerMember& chosen_member,
uint32_t chosen_slot) { … }
NormalizedMurmurHashEntropyProvider ComputeRemainderEntropy(
const Layer::LayerMember& chosen_member,
SlotSelection selection) { … }
const base::FieldTrial::EntropyProvider& SelectEntropyProviderForSlot(
const EntropyProviders& entropy_providers,
const Layer::EntropyMode& entropy_mode) { … }
bool AreLayerMemberIDsUnique(const Layer& layer_proto) { … }
}
VariationsLayers::VariationsLayers(const VariationsSeed& seed,
const EntropyProviders& entropy_providers)
: … { … }
VariationsLayers::VariationsLayers() : … { … }
VariationsLayers::~VariationsLayers() = default;
bool VariationsLayers::AreSlotBoundsValid(const Layer& layer_proto) { … }
bool VariationsLayers::AllowsHighEntropy(const Study& study) { … }
bool VariationsLayers::IsReferencingLayerMemberId(
const LayerMemberReference& layer_member_reference,
uint32_t layer_member_id) { … }
bool VariationsLayers::IsLayerActive(uint32_t layer_id) const { … }
bool VariationsLayers::IsLayerMemberActive(
const LayerMemberReference& layer_member_reference) const { … }
bool VariationsLayers::ActiveLayerMemberDependsOnHighEntropy(
uint32_t layer_id) const { … }
base::optional_ref<const base::FieldTrial::EntropyProvider>
VariationsLayers::SelectEntropyProviderForStudy(
const ProcessedStudy& processed_study,
const EntropyProviders& entropy_providers) const { … }
void VariationsLayers::ConstructLayer(const EntropyProviders& entropy_providers,
const Layer& layer_proto) { … }
const VariationsLayers::LayerInfo* VariationsLayers::FindActiveLayer(
uint32_t layer_id) const { … }
const base::FieldTrial::EntropyProvider& VariationsLayers::GetRemainderEntropy(
uint32_t layer_id) const { … }
std::optional<Layer::EntropyMode> VariationsLayers::GetEntropyMode(
uint32_t layer_id) const { … }
}