chromium/base/metrics/ranges_manager.h

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BASE_METRICS_RANGES_MANAGER_H_
#define BASE_METRICS_RANGES_MANAGER_H_

#include <unordered_set>
#include <vector>

#include "base/base_export.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/bucket_ranges.h"
#include "base/synchronization/lock.h"

namespace base {

// Manages BucketRanges and their lifetime. When registering a BucketRanges
// to a RangesManager instance, if an equivalent one already exists (one with
// the exact same ranges), the passed BucketRanges is deleted. This is useful to
// prevent duplicate instances of equivalent BucketRanges. Upon the destruction
// of a RangesManager instance, all BucketRanges managed by it are destroyed. A
// BucketRanges instance should not be registered to multiple RangesManagers.
class BASE_EXPORT RangesManager {};

class BASE_EXPORT ThreadSafeRangesManager final : public RangesManager {};

}  // namespace base

#endif  // BASE_METRICS_RANGES_MANAGER_H_