Backed out 2 changesets (bug 1865921) for causing failures on test_device_lost.html...
[gecko.git] / dom / webgpu / CompilationMessage.h
blobbac786dec61825aabaf10fb568d7ecb70c55c376
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_CompilationMessage_H_
7 #define GPU_CompilationMessage_H_
9 #include "nsWrapperCache.h"
10 #include "ObjectModel.h"
11 #include "mozilla/dom/WebGPUBinding.h"
13 namespace mozilla {
14 namespace dom {
15 class DOMString;
16 } // namespace dom
17 namespace webgpu {
18 class CompilationInfo;
20 class CompilationMessage final : public nsWrapperCache, public ChildOf<Device> {
21 dom::GPUCompilationMessageType mType = dom::GPUCompilationMessageType::Error;
22 uint64_t mLineNum = 0;
23 uint64_t mLinePos = 0;
24 uint64_t mOffset = 0;
25 uint64_t mLength = 0;
26 nsString mMessage;
28 public:
29 GPU_DECL_CYCLE_COLLECTION(CompilationMessage)
30 GPU_DECL_JS_WRAP(CompilationMessage)
32 explicit CompilationMessage(Device* const aParent, uint64_t aLineNum,
33 uint64_t aLinePos, uint64_t aOffset,
34 nsString&& aMessage);
36 void GetMessage(dom::DOMString& aMessage) {
37 aMessage.AsAString().Assign(mMessage);
39 dom::GPUCompilationMessageType Type() const { return mType; }
40 uint64_t LineNum() const { return mLineNum; }
41 uint64_t LinePos() const { return mLinePos; }
42 uint64_t Offset() const { return mOffset; }
43 uint64_t Length() const { return mLength; }
45 private:
46 ~CompilationMessage() = default;
47 void Cleanup() {}
50 } // namespace webgpu
51 } // namespace mozilla
53 #endif // GPU_CompilationMessage_H_