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"
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;
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
,
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
; }
46 ~CompilationMessage() = default;
51 } // namespace mozilla
53 #endif // GPU_CompilationMessage_H_