Bug 1866894 - Update failing subtest for content-visibility-auto-resize.html. r=fredw
[gecko.git] / dom / messagechannel / MessageChannel.h
bloba618bd4abd0c8861fa927dd97b8b6bbc0f68a796
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/. */
7 #ifndef mozilla_dom_MessageChannel_h
8 #define mozilla_dom_MessageChannel_h
10 #include "mozilla/Attributes.h"
11 #include "mozilla/dom/BindingDeclarations.h"
12 #include "nsCycleCollectionParticipant.h"
13 #include "nsWrapperCache.h"
14 #include "nsCOMPtr.h"
16 class nsIGlobalObject;
18 namespace mozilla {
19 class ErrorResult;
21 namespace dom {
23 class MessagePort;
25 class MessageChannel final : public nsISupports, public nsWrapperCache {
26 public:
27 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
28 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(MessageChannel)
30 nsIGlobalObject* GetParentObject() const { return mGlobal; }
32 virtual JSObject* WrapObject(JSContext* aCx,
33 JS::Handle<JSObject*> aGivenProto) override;
35 static already_AddRefed<MessageChannel> Constructor(
36 const GlobalObject& aGlobal, ErrorResult& aRv);
38 static already_AddRefed<MessageChannel> Constructor(nsIGlobalObject* aGlobal,
39 ErrorResult& aRv);
41 MessagePort* Port1() const { return mPort1; }
43 MessagePort* Port2() const { return mPort2; }
45 private:
46 explicit MessageChannel(nsIGlobalObject* aGlobal);
47 ~MessageChannel();
49 nsCOMPtr<nsIGlobalObject> mGlobal;
51 RefPtr<MessagePort> mPort1;
52 RefPtr<MessagePort> mPort2;
55 } // namespace dom
56 } // namespace mozilla
58 #endif // mozilla_dom_MessageChannel_h