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(const uint32_t * expired_histograms_hashes,size_t num_expired_histograms)24void EnableExpiryChecker(const uint32_t* expired_histograms_hashes, 25 size_t num_expired_histograms) { 26 DCHECK(base::FeatureList::GetInstance()); 27 if (base::FeatureList::IsEnabled(kExpiredHistogramLogicFeature)) { 28 std::string allowlist = kAllowlistParam.Get(); 29 base::StatisticsRecorder::SetRecordChecker( 30 std::make_unique<ExpiredHistogramsChecker>( 31 expired_histograms_hashes, num_expired_histograms, allowlist)); 32 } 33 } 34 35 } // namespace metrics 36