/work/obj-fuzz/dist/include/mozilla/dom/CallbackInterface.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 | | /** |
8 | | * A common base class for representing WebIDL callback interface types in C++. |
9 | | * |
10 | | * This class implements common functionality like lifetime management, |
11 | | * initialization with the callback object, and setup of the call environment. |
12 | | * Subclasses corresponding to particular callback interface types should |
13 | | * provide methods that actually do the various necessary calls. |
14 | | */ |
15 | | |
16 | | #ifndef mozilla_dom_CallbackInterface_h |
17 | | #define mozilla_dom_CallbackInterface_h |
18 | | |
19 | | #include "mozilla/dom/CallbackObject.h" |
20 | | |
21 | | namespace mozilla { |
22 | | namespace dom { |
23 | | |
24 | | class CallbackInterface : public CallbackObject |
25 | | { |
26 | | public: |
27 | | // See CallbackObject for an explanation of the arguments. |
28 | | explicit CallbackInterface(JSContext* aCx, JS::Handle<JSObject*> aCallback, |
29 | | JS::Handle<JSObject*> aCallbackGlobal, |
30 | | nsIGlobalObject* aIncumbentGlobal) |
31 | | : CallbackObject(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal) |
32 | 0 | { |
33 | 0 | } |
34 | | |
35 | | // See CallbackObject for an explanation of the arguments. |
36 | | explicit CallbackInterface(JSObject* aCallback, |
37 | | JSObject* aCallbackGlobal, |
38 | | JSObject* aAsyncStack, |
39 | | nsIGlobalObject* aIncumbentGlobal) |
40 | | : CallbackObject(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal) |
41 | 0 | { |
42 | 0 | } |
43 | | |
44 | | protected: |
45 | | bool GetCallableProperty(JSContext* cx, JS::Handle<jsid> aPropId, |
46 | | JS::MutableHandle<JS::Value> aCallable); |
47 | | |
48 | | // See CallbackObject for an explanation of the arguments. |
49 | | CallbackInterface(JSObject* aCallback, |
50 | | JSObject* aCallbackGlobal, |
51 | | const FastCallbackConstructor&) |
52 | | : CallbackObject(aCallback, aCallbackGlobal, FastCallbackConstructor()) |
53 | 0 | { |
54 | 0 | } |
55 | | }; |
56 | | |
57 | | } // namespace dom |
58 | | } // namespace mozilla |
59 | | |
60 | | #endif // mozilla_dom_CallbackFunction_h |