Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / webgpu / CompilationMessage.h
blobd5f252f26a4ec0eae68945a2d6d260c896df28a1
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;
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,
33 dom::GPUCompilationMessageType aType,
34 uint64_t aLineNum, uint64_t aLinePos,
35 uint64_t aOffset, uint64_t aLength,
36 nsString&& aMessage);
38 void GetMessage(dom::DOMString& aMessage) {
39 aMessage.AsAString().Assign(mMessage);
41 dom::GPUCompilationMessageType Type() const { return mType; }
42 uint64_t LineNum() const { return mLineNum; }
43 uint64_t LinePos() const { return mLinePos; }
44 uint64_t Offset() const { return mOffset; }
45 uint64_t Length() const { return mLength; }
47 private:
48 ~CompilationMessage() = default;
49 void Cleanup() {}
52 } // namespace webgpu
53 } // namespace mozilla
55 #endif // GPU_CompilationMessage_H_