/work/obj-fuzz/dist/include/mozilla/dom/MessageChannel.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_MessageChannel_h |
8 | | #define mozilla_dom_MessageChannel_h |
9 | | |
10 | | #include "mozilla/Attributes.h" |
11 | | #include "mozilla/ErrorResult.h" |
12 | | #include "mozilla/dom/BindingDeclarations.h" |
13 | | #include "nsCycleCollectionParticipant.h" |
14 | | #include "nsWrapperCache.h" |
15 | | #include "nsCOMPtr.h" |
16 | | |
17 | | class nsIGlobalObject; |
18 | | |
19 | | namespace mozilla { |
20 | | namespace dom { |
21 | | |
22 | | class MessagePort; |
23 | | |
24 | | class MessageChannel final : public nsISupports |
25 | | , public nsWrapperCache |
26 | | { |
27 | | public: |
28 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
29 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MessageChannel) |
30 | | |
31 | | nsIGlobalObject* |
32 | | GetParentObject() const |
33 | 0 | { |
34 | 0 | return mGlobal; |
35 | 0 | } |
36 | | |
37 | | virtual JSObject* |
38 | | WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
39 | | |
40 | | static already_AddRefed<MessageChannel> |
41 | | Constructor(const GlobalObject& aGlobal, ErrorResult& aRv); |
42 | | |
43 | | static already_AddRefed<MessageChannel> |
44 | | Constructor(nsIGlobalObject* aGlobal, ErrorResult& aRv); |
45 | | |
46 | | MessagePort* |
47 | | Port1() const |
48 | 0 | { |
49 | 0 | return mPort1; |
50 | 0 | } |
51 | | |
52 | | MessagePort* |
53 | | Port2() const |
54 | 0 | { |
55 | 0 | return mPort2; |
56 | 0 | } |
57 | | |
58 | | private: |
59 | | explicit MessageChannel(nsIGlobalObject* aGlobal); |
60 | | ~MessageChannel(); |
61 | | |
62 | | nsCOMPtr<nsIGlobalObject> mGlobal; |
63 | | |
64 | | RefPtr<MessagePort> mPort1; |
65 | | RefPtr<MessagePort> mPort2; |
66 | | }; |
67 | | |
68 | | } // namespace dom |
69 | | } // namespace mozilla |
70 | | |
71 | | #endif // mozilla_dom_MessageChannel_h |