tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

CompilationMessage.h (1688B)


      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_CompilationMessage_H_
      7 #define GPU_CompilationMessage_H_
      8 
      9 #include "ObjectModel.h"
     10 #include "mozilla/dom/WebGPUBinding.h"
     11 #include "nsWrapperCache.h"
     12 
     13 namespace mozilla {
     14 namespace dom {
     15 class DOMString;
     16 }  // namespace dom
     17 namespace webgpu {
     18 class CompilationInfo;
     19 
     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;
     27 
     28 public:
     29  GPU_DECL_CYCLE_COLLECTION(CompilationMessage)
     30  GPU_DECL_JS_WRAP(CompilationMessage)
     31 
     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);
     37 
     38  void GetMessage(dom::DOMString& aMessage) {
     39    aMessage.AsAString().Assign(mMessage);
     40  }
     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; }
     46 
     47 private:
     48  virtual ~CompilationMessage();
     49 };
     50 
     51 }  // namespace webgpu
     52 }  // namespace mozilla
     53 
     54 #endif  // GPU_CompilationMessage_H_