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"
19 struct PerformanceEntryFilterOptions
;
20 class PerformanceEntry
;
24 class PerformanceObserverEntryList final
: public nsISupports
,
25 public nsWrapperCache
{
26 ~PerformanceObserverEntryList();
29 PerformanceObserverEntryList(
30 nsISupports
* aOwner
, const nsTArray
<RefPtr
<PerformanceEntry
>>& aEntries
)
31 : mOwner(aOwner
), mEntries(aEntries
.Clone()) {}
33 nsISupports
* GetParentObject() const { return mOwner
; }
35 virtual JSObject
* WrapObject(JSContext
* aCx
,
36 JS::Handle
<JSObject
*> aGivenProto
) override
;
38 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
39 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PerformanceObserverEntryList
)
41 void GetEntries(const PerformanceEntryFilterOptions
& aFilter
,
42 nsTArray
<RefPtr
<PerformanceEntry
>>& aRetval
);
43 void GetEntriesByType(const nsAString
& aEntryType
,
44 nsTArray
<RefPtr
<PerformanceEntry
>>& aRetval
);
45 void GetEntriesByName(const nsAString
& aName
,
46 const Optional
<nsAString
>& aEntryType
,
47 nsTArray
<RefPtr
<PerformanceEntry
>>& aRetval
);
50 nsCOMPtr
<nsISupports
> mOwner
;
51 nsTArray
<RefPtr
<PerformanceEntry
>> mEntries
;
55 } // namespace mozilla