1 // Copyright 2021 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_AURA_HOST_FRAME_RATE_THROTTLER_H_
6 #define UI_AURA_HOST_FRAME_RATE_THROTTLER_H_
8 #include "base/containers/flat_set.h"
9 #include "base/no_destructor.h"
10 #include "ui/aura/aura_export.h"
16 // Used to throttle the frame rate of hosts that are occluded.
17 class AURA_EXPORT HostFrameRateThrottler {
19 static HostFrameRateThrottler& GetInstance();
21 void AddHost(WindowTreeHost* host);
22 void RemoveHost(WindowTreeHost* host);
24 const base::flat_set<WindowTreeHost*>& hosts() const { return hosts_; }
27 friend class base::NoDestructor<HostFrameRateThrottler>;
29 HostFrameRateThrottler();
30 ~HostFrameRateThrottler();
32 void UpdateHostFrameSinkManager();
34 // Set of hosts that are currently throttled.
35 base::flat_set<WindowTreeHost*> hosts_;
40 #endif // UI_AURA_HOST_FRAME_RATE_THROTTLER_H_