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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_PerformanceObserverEntryList_h__
8 #define mozilla_dom_PerformanceObserverEntryList_h__
11 #include "nsISupports.h"
13 #include "nsWrapperCache.h"
14 #include "mozilla/dom/PerformanceEntryBinding.h"
16 namespace mozilla::dom
{
18 struct PerformanceEntryFilterOptions
;
19 class PerformanceEntry
;
23 class PerformanceObserverEntryList final
: public nsISupports
,
24 public nsWrapperCache
{
25 ~PerformanceObserverEntryList();
28 PerformanceObserverEntryList(
29 nsISupports
* aOwner
, const nsTArray
<RefPtr
<PerformanceEntry
>>& aEntries
)
30 : mOwner(aOwner
), mEntries(aEntries
.Clone()) {}
32 nsISupports
* GetParentObject() const { return mOwner
; }
34 virtual JSObject
* WrapObject(JSContext
* aCx
,
35 JS::Handle
<JSObject
*> aGivenProto
) override
;
37 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
38 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(PerformanceObserverEntryList
)
40 void GetEntries(const PerformanceEntryFilterOptions
& aFilter
,
41 nsTArray
<RefPtr
<PerformanceEntry
>>& aRetval
);
42 void GetEntriesByType(const nsAString
& aEntryType
,
43 nsTArray
<RefPtr
<PerformanceEntry
>>& aRetval
);
44 void GetEntriesByName(const nsAString
& aName
,
45 const Optional
<nsAString
>& aEntryType
,
46 nsTArray
<RefPtr
<PerformanceEntry
>>& aRetval
);
49 nsCOMPtr
<nsISupports
> mOwner
;
50 nsTArray
<RefPtr
<PerformanceEntry
>> mEntries
;
53 } // namespace mozilla::dom