chromium/components/reporting/util/refcounted_closure_list.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 COMPONENTS_REPORTING_UTIL_REFCOUNTED_CLOSURE_LIST_H_
#define COMPONENTS_REPORTING_UTIL_REFCOUNTED_CLOSURE_LIST_H_

#include <utility>
#include <vector>

#include "base/functional/callback.h"
#include "base/memory/ref_counted.h"
#include "base/memory/ref_counted_delete_on_sequence.h"
#include "base/memory/scoped_refptr.h"
#include "base/task/sequenced_task_runner.h"
#include "base/thread_annotations.h"

namespace reporting {

// Thread-safe refcounted closure class, combining `BarrierClosure` and
// `OnceClosureList`, but allowing to take and drop references at arbitrary
// time. When the last reference is dropped, `OnceClosureList` is notified.
class RefCountedClosureList
    : public base::RefCountedDeleteOnSequence<RefCountedClosureList> {};

}  // namespace reporting

#endif  // COMPONENTS_REPORTING_UTIL_REFCOUNTED_CLOSURE_LIST_H_