1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
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_MessagePortList_h
8 #define mozilla_dom_MessagePortList_h
10 #include "mozilla/Attributes.h"
11 #include "mozilla/ErrorResult.h"
12 #include "nsCycleCollectionParticipant.h"
13 #include "mozilla/dom/MessagePort.h"
14 #include "nsWrapperCache.h"
15 #include "nsAutoPtr.h"
21 class MessagePortList MOZ_FINAL
: public nsISupports
22 , public nsWrapperCache
27 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
28 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MessagePortList
)
31 MessagePortList(nsISupports
* aOwner
, nsTArray
<nsRefPtr
<MessagePortBase
>>& aPorts
)
38 GetParentObject() const
44 WrapObject(JSContext
* aCx
) MOZ_OVERRIDE
;
49 return mPorts
.Length();
55 return mPorts
.SafeElementAt(aIndex
);
59 IndexedGetter(uint32_t aIndex
, bool &aFound
)
61 aFound
= aIndex
< mPorts
.Length();
65 return mPorts
[aIndex
];
69 nsCOMPtr
<nsISupports
> mOwner
;
70 nsTArray
<nsRefPtr
<MessagePortBase
>> mPorts
;
74 } // namespace mozilla
76 #endif // mozilla_dom_MessagePortList_h