#include "third_party/blink/common/privacy_budget/aggregating_sample_collector.h"
#include <type_traits>
#include <unordered_map>
#include <vector>
#include "base/check.h"
#include "base/compiler_specific.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/synchronization/lock.h"
#include "base/time/time.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/metrics/public/mojom/ukm_interface.mojom.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_sample_collector.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_sample.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_surface.h"
namespace blink {
namespace internal {
AggregatingSampleCollector* GetCollectorInstance() { … }
}
namespace {
bool IsStudyActive() { … }
}
const unsigned AggregatingSampleCollector::kMaxTrackedSources;
const unsigned AggregatingSampleCollector::kMaxTrackedSurfaces;
const unsigned
AggregatingSampleCollector::kMaxTrackedSamplesPerSurfacePerSourceId;
const unsigned AggregatingSampleCollector::kMaxUnsentSamples;
const unsigned AggregatingSampleCollector::kMaxUnsentSources;
const base::TimeDelta AggregatingSampleCollector::kMaxUnsentSampleAge;
AggregatingSampleCollector::AggregatingSampleCollector() = default;
AggregatingSampleCollector::~AggregatingSampleCollector() = default;
void AggregatingSampleCollector::Record(
ukm::UkmRecorder* recorder,
ukm::SourceId source,
std::vector<IdentifiableSample> samples) { … }
void AggregatingSampleCollector::Flush(ukm::UkmRecorder* recorder) { … }
void AggregatingSampleCollector::FlushSource(ukm::UkmRecorder* recorder,
ukm::SourceId source) { … }
void AggregatingSampleCollector::ResetForTesting() { … }
bool AggregatingSampleCollector::TryAcceptSamples(
ukm::SourceId source,
std::vector<IdentifiableSample> samples) { … }
void AggregatingSampleCollector::TryAcceptSingleSample(
ukm::SourceId new_source,
const IdentifiableSample& new_sample) { … }
void AggregatingSampleCollector::AddNewUnsentSample(
ukm::SourceId source,
const IdentifiableSample& new_sample) { … }
bool AggregatingSampleCollector::AddNewUnsentSampleToKnownSource(
ukm::SourceId source,
uint64_t key,
int64_t value) { … }
}