#include "components/metrics/structured/structured_metrics_recorder.h"
#include <sstream>
#include <utility>
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/metrics_hashes.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/task/current_thread.h"
#include "base/task/sequenced_task_runner.h"
#include "components/metrics/metrics_features.h"
#include "components/metrics/structured/enums.h"
#include "components/metrics/structured/histogram_util.h"
#include "components/metrics/structured/project_validator.h"
#include "components/metrics/structured/proto/event_storage.pb.h"
#include "components/metrics/structured/structured_metrics_features.h"
#include "components/metrics/structured/structured_metrics_validator.h"
#include "third_party/metrics_proto/chrome_user_metrics_extension.pb.h"
#include "third_party/metrics_proto/structured_data.pb.h"
namespace metrics::structured {
StructuredMetricsRecorder::StructuredMetricsRecorder(
std::unique_ptr<KeyDataProvider> key_data_provider,
std::unique_ptr<EventStorage<StructuredEventProto>> event_storage)
: … { … }
StructuredMetricsRecorder::~StructuredMetricsRecorder() { … }
void StructuredMetricsRecorder::EnableRecording() { … }
void StructuredMetricsRecorder::DisableRecording() { … }
void StructuredMetricsRecorder::ProvideUmaEventMetrics(
ChromeUserMetricsExtension& uma_proto) { … }
void StructuredMetricsRecorder::ProvideEventMetrics(
ChromeUserMetricsExtension& uma_proto) { … }
void StructuredMetricsRecorder::ProvideLogMetadata(
ChromeUserMetricsExtension& uma_proto) { … }
bool StructuredMetricsRecorder::CanProvideMetrics() { … }
bool StructuredMetricsRecorder::HasMetricsToProvide() { … }
void StructuredMetricsRecorder::OnKeyReady() { … }
void StructuredMetricsRecorder::AddEventsObserver(Observer* watcher) { … }
void StructuredMetricsRecorder::RemoveEventsObserver(Observer* watcher) { … }
void StructuredMetricsRecorder::OnEventRecord(const Event& event) { … }
bool StructuredMetricsRecorder::HasState(State state) const { … }
void StructuredMetricsRecorder::Purge() { … }
void StructuredMetricsRecorder::RecordEventBeforeInitialization(
const Event& event) { … }
void StructuredMetricsRecorder::RecordProfileEventBeforeInitialization(
const Event& event) { … }
void StructuredMetricsRecorder::RecordEvent(const Event& event) { … }
void StructuredMetricsRecorder::InitializeEventProto(
StructuredEventProto* proto,
const Event& event,
const ProjectValidator& project_validator,
const EventValidator& event_validator) { … }
void StructuredMetricsRecorder::AddMetricsToProto(
StructuredEventProto* proto,
const Event& event,
const ProjectValidator& project_validator,
const EventValidator& event_validator) { … }
void StructuredMetricsRecorder::HashUnhashedEventsAndPersist() { … }
bool StructuredMetricsRecorder::CanUploadProject(
uint64_t project_name_hash) const { … }
void StructuredMetricsRecorder::CacheDisallowedProjectsSet() { … }
bool StructuredMetricsRecorder::IsKeyDataInitialized() { … }
bool StructuredMetricsRecorder::IsInitialized() { … }
bool StructuredMetricsRecorder::IsProfileInitialized() { … }
bool StructuredMetricsRecorder::CanForceRecord(const Event& event) const { … }
bool StructuredMetricsRecorder::IsDeviceEvent(const Event& event) const { … }
bool StructuredMetricsRecorder::IsProfileEvent(const Event& event) const { … }
std::optional<std::pair<const ProjectValidator*, const EventValidator*>>
StructuredMetricsRecorder::GetEventValidators(const Event& event) const { … }
void StructuredMetricsRecorder::SetOnReadyToRecord(base::OnceClosure callback) { … }
void StructuredMetricsRecorder::SetEventRecordCallbackForTest(
base::RepeatingClosure callback) { … }
void StructuredMetricsRecorder::AddDisallowedProjectForTest(
uint64_t project_name_hash) { … }
void StructuredMetricsRecorder::NotifyEventRecorded(
const StructuredEventProto& event) { … }
void StructuredMetricsRecorder::LockStorage() { … }
void StructuredMetricsRecorder::ReleaseStorage() { … }
void StructuredMetricsRecorder::StoreLockedEvents() { … }
}