PerformanceObserverEntryList.h (1909B)
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/. */ 6 7 #ifndef mozilla_dom_PerformanceObserverEntryList_h__ 8 #define mozilla_dom_PerformanceObserverEntryList_h__ 9 10 #include "mozilla/dom/PerformanceEntryBinding.h" 11 #include "nsCOMPtr.h" 12 #include "nsISupports.h" 13 #include "nsTArray.h" 14 #include "nsWrapperCache.h" 15 16 namespace mozilla::dom { 17 18 struct PerformanceEntryFilterOptions; 19 class PerformanceEntry; 20 template <typename T> 21 class Optional; 22 23 class PerformanceObserverEntryList final : public nsISupports, 24 public nsWrapperCache { 25 ~PerformanceObserverEntryList(); 26 27 public: 28 PerformanceObserverEntryList( 29 nsISupports* aOwner, const nsTArray<RefPtr<PerformanceEntry>>& aEntries) 30 : mOwner(aOwner), mEntries(aEntries.Clone()) {} 31 32 nsISupports* GetParentObject() const { return mOwner; } 33 34 virtual JSObject* WrapObject(JSContext* aCx, 35 JS::Handle<JSObject*> aGivenProto) override; 36 37 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 38 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(PerformanceObserverEntryList) 39 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); 47 48 private: 49 nsCOMPtr<nsISupports> mOwner; 50 nsTArray<RefPtr<PerformanceEntry>> mEntries; 51 }; 52 53 } // namespace mozilla::dom 54 55 #endif