1 // Copyright 2018 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "components/metrics/expired_histogram_util.h" 6 7 #include "base/feature_list.h" 8 #include "base/metrics/field_trial_params.h" 9 #include "base/metrics/statistics_recorder.h" 10 #include "components/metrics/expired_histograms_checker.h" 11 12 namespace metrics { 13 namespace { 14 15 BASE_FEATURE(kExpiredHistogramLogicFeature, 16 "ExpiredHistogramLogic", 17 base::FEATURE_DISABLED_BY_DEFAULT); 18 19 const base::FeatureParam<std::string> kAllowlistParam{ 20 &kExpiredHistogramLogicFeature, "allowlist", ""}; 21 22 } // namespace 23 EnableExpiryChecker(base::span<const uint32_t> expired_histograms_hashes)24void EnableExpiryChecker(base::span<const uint32_t> expired_histograms_hashes) { 25 DCHECK(base::FeatureList::GetInstance()); 26 if (base::FeatureList::IsEnabled(kExpiredHistogramLogicFeature)) { 27 std::string allowlist = kAllowlistParam.Get(); 28 base::StatisticsRecorder::SetRecordChecker( 29 std::make_unique<ExpiredHistogramsChecker>(expired_histograms_hashes, 30 allowlist)); 31 } 32 } 33 34 } // namespace metrics 35