Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM Worker.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_WorkerBinding_h
4 : #define mozilla_dom_WorkerBinding_h
5 :
6 : #include "js/RootingAPI.h"
7 : #include "jspubtd.h"
8 : #include "mozilla/ErrorResult.h"
9 : #include "mozilla/dom/BindingDeclarations.h"
10 : #include "mozilla/dom/Nullable.h"
11 :
12 : namespace mozilla {
13 : namespace dom {
14 :
15 : struct NativePropertyHooks;
16 : class ProtoAndIfaceCache;
17 : struct WorkerOptionsAtoms;
18 :
19 : namespace workers {
20 :
21 : class ChromeWorkerPrivate;
22 : struct ChromeWorkerPrivateAtoms;
23 : class WorkerPrivate;
24 : struct WorkerPrivateAtoms;
25 :
26 : } // namespace workers
27 :
28 : } // namespace dom
29 : } // namespace mozilla
30 :
31 : namespace mozilla {
32 : namespace dom {
33 :
34 0 : struct WorkerOptions : public DictionaryBase
35 : {
36 : MOZ_INIT_OUTSIDE_CTOR nsString mName;
37 :
38 : WorkerOptions();
39 :
40 0 : explicit inline WorkerOptions(const FastDictionaryInitializer& )
41 0 : {
42 : // Do nothing here; this is used by our "Fast" subclass
43 0 : }
44 :
45 : explicit inline WorkerOptions(const WorkerOptions& aOther)
46 : {
47 : *this = aOther;
48 : }
49 :
50 : bool
51 : Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
52 :
53 : bool
54 : Init(const nsAString& aJSON);
55 :
56 : bool
57 : ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
58 :
59 : bool
60 : ToJSON(nsAString& aJSON) const;
61 :
62 : void
63 : TraceDictionary(JSTracer* trc);
64 :
65 : WorkerOptions&
66 : operator=(const WorkerOptions& aOther);
67 :
68 : private:
69 : static bool
70 : InitIds(JSContext* cx, WorkerOptionsAtoms* atomsCache);
71 : };
72 :
73 : namespace binding_detail {
74 0 : struct FastWorkerOptions : public WorkerOptions
75 : {
76 0 : inline FastWorkerOptions()
77 0 : : WorkerOptions(FastDictionaryInitializer())
78 : {
79 : // Doesn't matter what int we pass to the parent constructor
80 0 : }
81 : };
82 : } // namespace binding_detail
83 :
84 :
85 : namespace ChromeWorkerBinding {
86 :
87 : typedef mozilla::dom::workers::ChromeWorkerPrivate NativeType;
88 :
89 : bool
90 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
91 :
92 : JSObject*
93 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
94 :
95 : const JSClass*
96 : GetJSClass();
97 :
98 : bool
99 : Wrap(JSContext* aCx, mozilla::dom::workers::ChromeWorkerPrivate* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
100 :
101 : template <class T>
102 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
103 : {
104 : JS::Rooted<JSObject*> reflector(aCx);
105 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
106 : }
107 :
108 : // We declare this as an array so that retrieving a pointer to this
109 : // binding's property hooks only requires compile/link-time resolvable
110 : // address arithmetic. Declaring it as a pointer instead would require
111 : // doing a run-time load to fetch a pointer to this binding's property
112 : // hooks. And then structures which embedded a pointer to this structure
113 : // would require a run-time load for proper initialization, which would
114 : // then induce static constructors. Lots of static constructors.
115 : extern const NativePropertyHooks sNativePropertyHooks[];
116 :
117 : void
118 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
119 :
120 : JS::Handle<JSObject*>
121 : GetProtoObjectHandle(JSContext* aCx);
122 :
123 : JS::Handle<JSObject*>
124 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
125 :
126 : JSObject*
127 : GetConstructorObject(JSContext* aCx);
128 :
129 : } // namespace ChromeWorkerBinding
130 :
131 :
132 :
133 : namespace WorkerBinding {
134 :
135 : typedef mozilla::dom::workers::WorkerPrivate NativeType;
136 :
137 : bool
138 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
139 :
140 : JSObject*
141 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
142 :
143 : const JSClass*
144 : GetJSClass();
145 :
146 : bool
147 : Wrap(JSContext* aCx, mozilla::dom::workers::WorkerPrivate* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
148 :
149 : template <class T>
150 1 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
151 : {
152 2 : JS::Rooted<JSObject*> reflector(aCx);
153 2 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
154 : }
155 :
156 : // We declare this as an array so that retrieving a pointer to this
157 : // binding's property hooks only requires compile/link-time resolvable
158 : // address arithmetic. Declaring it as a pointer instead would require
159 : // doing a run-time load to fetch a pointer to this binding's property
160 : // hooks. And then structures which embedded a pointer to this structure
161 : // would require a run-time load for proper initialization, which would
162 : // then induce static constructors. Lots of static constructors.
163 : extern const NativePropertyHooks sNativePropertyHooks[];
164 :
165 : void
166 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
167 :
168 : JS::Handle<JSObject*>
169 : GetProtoObjectHandle(JSContext* aCx);
170 :
171 : JSObject*
172 : GetProtoObject(JSContext* aCx);
173 :
174 : JS::Handle<JSObject*>
175 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
176 :
177 : JSObject*
178 : GetConstructorObject(JSContext* aCx);
179 :
180 : } // namespace WorkerBinding
181 :
182 :
183 :
184 : } // namespace dom
185 : } // namespace mozilla
186 :
187 : #endif // mozilla_dom_WorkerBinding_h
|