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.
5 #ifndef MEDIA_MOJO_SERVICES_MEDIA_FOUNDATION_GPU_INFO_MONITOR_H_
6 #define MEDIA_MOJO_SERVICES_MEDIA_FOUNDATION_GPU_INFO_MONITOR_H_
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"
16 // A singleton class keeps track of GPUInfo and manages notifications.
17 class MEDIA_MOJO_EXPORT MediaFoundationGpuInfoMonitor {
19 static MediaFoundationGpuInfoMonitor* GetInstance();
21 MediaFoundationGpuInfoMonitor();
22 MediaFoundationGpuInfoMonitor(const MediaFoundationGpuInfoMonitor&) = delete;
23 MediaFoundationGpuInfoMonitor operator=(
24 const MediaFoundationGpuInfoMonitor&) = delete;
25 ~MediaFoundationGpuInfoMonitor();
27 // Updates GpuInfo in `this` and notify observers if needed.
28 void UpdateGpuInfo(const gpu::GPUInfo& gpu_info);
30 CHROME_LUID gpu_luid() const { return gpu_luid_; }
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);
38 CHROME_LUID gpu_luid_;
39 LuidObservers luid_observers_;
44 #endif // MEDIA_MOJO_SERVICES_MEDIA_FOUNDATION_GPU_INFO_MONITOR_H_