chromium/components/metrics/structured/lib/arena_persistent_proto.h

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

#ifndef COMPONENTS_METRICS_STRUCTURED_LIB_ARENA_PERSISTENT_PROTO_H_
#define COMPONENTS_METRICS_STRUCTURED_LIB_ARENA_PERSISTENT_PROTO_H_

#include <concepts>
#include <memory>
#include <type_traits>

#include "components/metrics/structured/lib/persistent_proto_internal.h"
#include "third_party/protobuf/src/google/protobuf/message_lite.h"

namespace metrics::structured {

// A PersistentProto that stores T in an arena.
//
// The provided arena must live longer than |this| and doesn't
// take ownership.
//
// See comment in persistent_proto.h and persistent_proto_internal.h for more
// details.
template <class T>
  requires(std::derived_from<T, google::protobuf::MessageLite>)
class ArenaPersistentProto : public internal::PersistentProtoInternal {};
}  // namespace metrics::structured

#endif  // COMPONENTS_METRICS_STRUCTURED_LIB_ARENA_PERSISTENT_PROTO_H_