Enable IME support for Ozone Efl
[platform/framework/web/chromium-efl.git] / ui / aura / host_frame_rate_throttler.h
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.
4
5 #ifndef UI_AURA_HOST_FRAME_RATE_THROTTLER_H_
6 #define UI_AURA_HOST_FRAME_RATE_THROTTLER_H_
7
8 #include "base/containers/flat_set.h"
9 #include "base/no_destructor.h"
10 #include "ui/aura/aura_export.h"
11
12 namespace aura {
13
14 class WindowTreeHost;
15
16 // Used to throttle the frame rate of hosts that are occluded.
17 class AURA_EXPORT HostFrameRateThrottler {
18  public:
19   static HostFrameRateThrottler& GetInstance();
20
21   void AddHost(WindowTreeHost* host);
22   void RemoveHost(WindowTreeHost* host);
23
24   const base::flat_set<WindowTreeHost*>& hosts() const { return hosts_; }
25
26  private:
27   friend class base::NoDestructor<HostFrameRateThrottler>;
28
29   HostFrameRateThrottler();
30   ~HostFrameRateThrottler();
31
32   void UpdateHostFrameSinkManager();
33
34   // Set of hosts that are currently throttled.
35   base::flat_set<WindowTreeHost*> hosts_;
36 };
37
38 }  // namespace aura
39
40 #endif  // UI_AURA_HOST_FRAME_RATE_THROTTLER_H_