/src/mozilla-central/dom/worklet/WorkletGlobalScope.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef mozilla_dom_WorkletGlobalScope_h |
8 | | #define mozilla_dom_WorkletGlobalScope_h |
9 | | |
10 | | #include "mozilla/Attributes.h" |
11 | | #include "mozilla/ErrorResult.h" |
12 | | #include "mozilla/dom/BindingDeclarations.h" |
13 | | #include "nsIGlobalObject.h" |
14 | | #include "nsWrapperCache.h" |
15 | | |
16 | | #define WORKLET_IID \ |
17 | | { 0x1b3f62e7, 0xe357, 0x44be, \ |
18 | | { 0xbf, 0xe0, 0xdf, 0x85, 0xe6, 0x56, 0x85, 0xac } } |
19 | | |
20 | | namespace mozilla { |
21 | | namespace dom { |
22 | | |
23 | | class Console; |
24 | | |
25 | | class WorkletGlobalScope : public nsIGlobalObject |
26 | | , public nsWrapperCache |
27 | | { |
28 | | public: |
29 | | NS_DECLARE_STATIC_IID_ACCESSOR(WORKLET_IID) |
30 | | |
31 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
32 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WorkletGlobalScope) |
33 | | |
34 | | WorkletGlobalScope(); |
35 | | |
36 | | nsIGlobalObject* GetParentObject() const |
37 | | { |
38 | | return nullptr; |
39 | | } |
40 | | |
41 | | virtual JSObject* |
42 | | WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
43 | | |
44 | | virtual bool |
45 | | WrapGlobalObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector) = 0; |
46 | | |
47 | | virtual JSObject* |
48 | | GetGlobalJSObject() override |
49 | 0 | { |
50 | 0 | return GetWrapper(); |
51 | 0 | } |
52 | | |
53 | | already_AddRefed<Console> |
54 | | GetConsole(JSContext* aCx, ErrorResult& aRv); |
55 | | |
56 | | void |
57 | | Dump(const Optional<nsAString>& aString) const; |
58 | | |
59 | | protected: |
60 | 0 | ~WorkletGlobalScope() = default; |
61 | | |
62 | | private: |
63 | | RefPtr<Console> mConsole; |
64 | | }; |
65 | | |
66 | | NS_DEFINE_STATIC_IID_ACCESSOR(WorkletGlobalScope, WORKLET_IID) |
67 | | |
68 | | } // namespace dom |
69 | | } // namespace mozilla |
70 | | |
71 | | #endif // mozilla_dom_WorkletGlobalScope_h |