DeviceLostInfo.h (1246B)
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/. */ 5 6 #ifndef GPU_DeviceLostInfo_H_ 7 #define GPU_DeviceLostInfo_H_ 8 9 #include "ObjectModel.h" 10 #include "mozilla/dom/WebGPUBinding.h" 11 #include "nsWrapperCache.h" 12 13 namespace mozilla::webgpu { 14 class Device; 15 16 class DeviceLostInfo final : public nsWrapperCache { 17 public: 18 GPU_DECL_CYCLE_COLLECTION(DeviceLostInfo) 19 GPU_DECL_JS_WRAP(DeviceLostInfo) 20 21 DeviceLostInfo(nsIGlobalObject* const aGlobal, 22 dom::GPUDeviceLostReason aReason, const nsAString& aMessage) 23 : mGlobal(aGlobal), mReason(aReason), mMessage(aMessage) {} 24 25 private: 26 virtual ~DeviceLostInfo() = default; 27 28 nsCOMPtr<nsIGlobalObject> mGlobal; 29 const dom::GPUDeviceLostReason mReason; 30 const nsAutoString mMessage; 31 32 public: 33 dom::GPUDeviceLostReason Reason() { return mReason; } 34 35 void GetMessage(nsAString& aValue) const { aValue = mMessage; } 36 37 nsIGlobalObject* GetParentObject() const { return mGlobal; } 38 }; 39 40 } // namespace mozilla::webgpu 41 42 #endif // GPU_DeviceLostInfo_H_