tor-browser

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

Error.h (1167B)


      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_Error_H_
      7 #define GPU_Error_H_
      8 
      9 #include "ObjectModel.h"
     10 #include "js/Value.h"
     11 #include "nsIGlobalObject.h"
     12 #include "nsString.h"
     13 
     14 namespace mozilla {
     15 class ErrorResult;
     16 namespace dom {
     17 class GlobalObject;
     18 }  // namespace dom
     19 namespace webgpu {
     20 
     21 class Error : public nsWrapperCache {
     22 protected:
     23  nsCOMPtr<nsIGlobalObject> mGlobal;
     24  nsString mMessage;
     25 
     26 public:
     27  GPU_DECL_CYCLE_COLLECTION(Error)
     28 
     29  Error(nsIGlobalObject* const aGlobal, const nsAString& aMessage);
     30  Error(nsIGlobalObject* const aGlobal, const nsACString& aMessage);
     31 
     32 protected:
     33  virtual ~Error() = default;
     34 
     35 public:
     36  void GetMessage(nsAString& aMessage) const { aMessage = mMessage; }
     37  nsIGlobalObject* GetParentObject() const { return mGlobal; }
     38  virtual JSObject* WrapObject(JSContext*, JS::Handle<JSObject*>) = 0;
     39 };
     40 
     41 }  // namespace webgpu
     42 }  // namespace mozilla
     43 
     44 #endif  // GPU_Error_H_