#ifndef MEDIA_GPU_ANDROID_PROMOTION_HINT_AGGREGATOR_IMPL_H_
#define MEDIA_GPU_ANDROID_PROMOTION_HINT_AGGREGATOR_IMPL_H_
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/time/tick_clock.h"
#include "base/time/time.h"
#include "media/gpu/android/promotion_hint_aggregator.h"
#include "media/gpu/media_gpu_export.h"
namespace media {
class MEDIA_GPU_EXPORT PromotionHintAggregatorImpl
: public PromotionHintAggregator {
public:
PromotionHintAggregatorImpl(const base::TickClock* tick_clock = nullptr);
PromotionHintAggregatorImpl(const PromotionHintAggregatorImpl&) = delete;
PromotionHintAggregatorImpl& operator=(const PromotionHintAggregatorImpl&) =
delete;
~PromotionHintAggregatorImpl() override;
void NotifyPromotionHint(const Hint& hint) override;
bool IsSafeToPromote() override;
private:
raw_ptr<const base::TickClock> tick_clock_;
base::TimeTicks most_recent_unpromotable_;
base::TimeTicks most_recent_update_;
int consecutive_promotable_frames_ = 0;
base::WeakPtrFactory<PromotionHintAggregatorImpl> weak_ptr_factory_{this};
};
}
#endif