Bug 1850713: remove duplicated setting of early hint preloader id in `ScriptLoader...
[gecko.git] / dom / webgpu / Sampler.cpp
blob9a3b90c4ddaaf3b049bfdd649ac3cfbb994c9827
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 #include "mozilla/dom/WebGPUBinding.h"
7 #include "Sampler.h"
8 #include "ipc/WebGPUChild.h"
10 #include "Device.h"
12 namespace mozilla::webgpu {
14 GPU_IMPL_CYCLE_COLLECTION(Sampler, mParent)
15 GPU_IMPL_JS_WRAP(Sampler)
17 Sampler::Sampler(Device* const aParent, RawId aId)
18 : ChildOf(aParent), mId(aId) {}
20 Sampler::~Sampler() { Cleanup(); }
22 void Sampler::Cleanup() {
23 if (mValid && mParent) {
24 mValid = false;
25 auto bridge = mParent->GetBridge();
26 if (bridge && bridge->IsOpen()) {
27 bridge->SendSamplerDestroy(mId);
32 } // namespace mozilla::webgpu