// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MEDIA_BASE_CALLBACK_REGISTRY_H_ #define MEDIA_BASE_CALLBACK_REGISTRY_H_ #include <stdint.h> #include <map> #include <memory> #include "base/functional/callback.h" #include "base/logging.h" #include "base/memory/raw_ptr.h" #include "base/synchronization/lock.h" #include "base/task/bind_post_task.h" #include "base/thread_annotations.h" namespace media { // A class that keeps a callback registered. The callback will be unregistered // upon destruction of this object. class CallbackRegistration { … }; template <typename Sig> class CallbackRegistry; // A helper class that can register, unregister callbacks, and notify registered // callbacks. This class is thread safe: all methods can be called on any // thread. The CallbackRegistry must outlive all CallbackRegistrations returned // by Register(). // TODO(xhwang): This class is similar to base::RepeatingCallbackList, but is // simpler, and provides thread safety. Consider merging these two. CallbackRegistry<void (Args...)>; ClosureRegistry; } // namespace media #endif // MEDIA_BASE_CALLBACK_REGISTRY_H_