Line data Source code
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 "nsCOMPtr.h"
11 : #include "nsISupports.h"
12 : #include "nsTArray.h"
13 : #include "nsWrapperCache.h"
14 : #include "mozilla/dom/PerformanceEntryBinding.h"
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : struct PerformanceEntryFilterOptions;
20 : class PerformanceEntry;
21 : template<typename T> class Optional;
22 :
23 : class PerformanceObserverEntryList final : public nsISupports,
24 : public nsWrapperCache
25 : {
26 : ~PerformanceObserverEntryList();
27 :
28 : public:
29 0 : PerformanceObserverEntryList(nsISupports* aOwner,
30 : nsTArray<RefPtr<PerformanceEntry>>&
31 : aEntries)
32 0 : : mOwner(aOwner)
33 0 : , mEntries(aEntries)
34 : {
35 0 : }
36 :
37 0 : nsISupports* GetParentObject() const
38 : {
39 0 : return mOwner;
40 : }
41 :
42 : virtual JSObject* WrapObject(JSContext* aCx,
43 : JS::Handle<JSObject*> aGivenProto) override;
44 :
45 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
46 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PerformanceObserverEntryList)
47 :
48 : void GetEntries(const PerformanceEntryFilterOptions& aFilter,
49 : nsTArray<RefPtr<PerformanceEntry>>& aRetval);
50 : void GetEntriesByType(const nsAString& aEntryType,
51 : nsTArray<RefPtr<PerformanceEntry>>& aRetval);
52 : void GetEntriesByName(const nsAString& aName,
53 : const Optional<nsAString>& aEntryType,
54 : nsTArray<RefPtr<PerformanceEntry>>& aRetval);
55 :
56 : private:
57 : nsCOMPtr<nsISupports> mOwner;
58 : nsTArray<RefPtr<PerformanceEntry>> mEntries;
59 : };
60 :
61 : } // namespace dom
62 : } // namespace mozilla
63 :
64 :
65 : #endif
|