[M120 Migration][MM][CAPI] Fix the logic for media using capi player.
[platform/framework/web/chromium-efl.git] / media / mojo / services / media_foundation_gpu_info_monitor.h
1 // Copyright 2022 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 MEDIA_MOJO_SERVICES_MEDIA_FOUNDATION_GPU_INFO_MONITOR_H_
6 #define MEDIA_MOJO_SERVICES_MEDIA_FOUNDATION_GPU_INFO_MONITOR_H_
7
8 #include "base/callback_list.h"
9 #include "base/functional/callback.h"
10 #include "base/win/windows_types.h"
11 #include "gpu/config/gpu_info.h"
12 #include "media/mojo/services/media_mojo_export.h"
13
14 namespace media {
15
16 // A singleton class keeps track of GPUInfo and manages notifications.
17 class MEDIA_MOJO_EXPORT MediaFoundationGpuInfoMonitor {
18  public:
19   static MediaFoundationGpuInfoMonitor* GetInstance();
20
21   MediaFoundationGpuInfoMonitor();
22   MediaFoundationGpuInfoMonitor(const MediaFoundationGpuInfoMonitor&) = delete;
23   MediaFoundationGpuInfoMonitor operator=(
24       const MediaFoundationGpuInfoMonitor&) = delete;
25   ~MediaFoundationGpuInfoMonitor();
26
27   // Updates GpuInfo in `this` and notify observers if needed.
28   void UpdateGpuInfo(const gpu::GPUInfo& gpu_info);
29
30   CHROME_LUID gpu_luid() const { return gpu_luid_; }
31
32   // Adds an observer to get notified on GPU LUID changes.
33   using LuidObservers = base::RepeatingCallbackList<void(const CHROME_LUID&)>;
34   base::CallbackListSubscription AddLuidObserver(
35       LuidObservers::CallbackType cb);
36
37  private:
38   CHROME_LUID gpu_luid_;
39   LuidObservers luid_observers_;
40 };
41
42 }  // namespace media
43
44 #endif  // MEDIA_MOJO_SERVICES_MEDIA_FOUNDATION_GPU_INFO_MONITOR_H_