Bug 1882660 [wpt PR 44844] - IDB: Consolidate previously extended WPT files into...
[gecko.git] / dom / webgpu / SupportedFeatures.h
blobb60c554f6cde17d77df9e31b4e90b66cf3220e15
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef GPU_SupportedFeatures_H_
7 #define GPU_SupportedFeatures_H_
9 #include "nsWrapperCache.h"
10 #include "ObjectModel.h"
12 #include <unordered_set>
14 namespace mozilla {
15 class ErrorResult;
16 namespace dom {
17 enum class GPUFeatureName : uint8_t;
18 } // namespace dom
19 } // namespace mozilla
21 namespace mozilla::webgpu {
22 class Adapter;
24 class SupportedFeatures final : public nsWrapperCache, public ChildOf<Adapter> {
25 public:
26 GPU_DECL_CYCLE_COLLECTION(SupportedFeatures)
27 GPU_DECL_JS_WRAP(SupportedFeatures)
29 explicit SupportedFeatures(Adapter* const aParent);
31 void Add(dom::GPUFeatureName, ErrorResult&);
32 const auto& Features() const { return mFeatures; }
34 private:
35 ~SupportedFeatures() = default;
36 void Cleanup() {}
38 std::unordered_set<dom::GPUFeatureName> mFeatures;
41 } // namespace mozilla::webgpu
43 #endif // GPU_SupportedFeatures_H_