Bug 1708193 - Remove mozapps/extensions/internal/Content.js r=rpl
[gecko.git] / dom / performance / PerformanceObserverEntryList.h
blob9f2aa2b7dd00927ade41ad585f1c1ade46833334
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__
10 #include "nsCOMPtr.h"
11 #include "nsISupports.h"
12 #include "nsTArray.h"
13 #include "nsWrapperCache.h"
14 #include "mozilla/dom/PerformanceEntryBinding.h"
16 namespace mozilla {
17 namespace dom {
19 struct PerformanceEntryFilterOptions;
20 class PerformanceEntry;
21 template <typename T>
22 class Optional;
24 class PerformanceObserverEntryList final : public nsISupports,
25 public nsWrapperCache {
26 ~PerformanceObserverEntryList();
28 public:
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);
49 private:
50 nsCOMPtr<nsISupports> mOwner;
51 nsTArray<RefPtr<PerformanceEntry>> mEntries;
54 } // namespace dom
55 } // namespace mozilla
57 #endif