Bug 1654678 Part 2 - Make CUPSPrinter own its CUPS dest data r=nordzilla
[gecko.git] / dom / webgpu / Instance.h
blob0e064e88a1f600f7aa4da8c3b884719af88685d1
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_INSTANCE_H_
7 #define GPU_INSTANCE_H_
9 #include "mozilla/AlreadyAddRefed.h"
10 #include "mozilla/RefPtr.h"
11 #include "nsCOMPtr.h"
12 #include "ObjectModel.h"
14 namespace mozilla {
15 namespace dom {
16 class Promise;
17 struct GPURequestAdapterOptions;
18 } // namespace dom
20 namespace webgpu {
21 class Adapter;
22 class GPUAdapter;
23 class WebGPUChild;
25 class Instance final : public nsWrapperCache {
26 public:
27 GPU_DECL_CYCLE_COLLECTION(Instance)
28 GPU_DECL_JS_WRAP(Instance)
30 nsIGlobalObject* GetParentObject() const { return mOwner; }
32 static already_AddRefed<Instance> Create(nsIGlobalObject* aOwner);
34 already_AddRefed<dom::Promise> RequestAdapter(
35 const dom::GPURequestAdapterOptions& aOptions, ErrorResult& aRv);
37 RefPtr<WebGPUChild> mBridge;
39 private:
40 explicit Instance(nsIGlobalObject* aOwner, WebGPUChild* aBridge);
41 virtual ~Instance();
42 void Cleanup();
44 nsCOMPtr<nsIGlobalObject> mOwner;
46 public:
49 } // namespace webgpu
50 } // namespace mozilla
52 #endif // GPU_INSTANCE_H_