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"
12 #include "ObjectModel.h"
17 struct GPURequestAdapterOptions
;
25 class Instance final
: public nsWrapperCache
{
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
;
40 explicit Instance(nsIGlobalObject
* aOwner
, WebGPUChild
* aBridge
);
44 nsCOMPtr
<nsIGlobalObject
> mOwner
;
50 } // namespace mozilla
52 #endif // GPU_INSTANCE_H_