/src/mozilla-central/dom/performance/PerformanceMainThread.h
Line | Count | Source (jump to first uncovered line) |
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 |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef mozilla_dom_PerformanceMainThread_h |
8 | | #define mozilla_dom_PerformanceMainThread_h |
9 | | |
10 | | #include "Performance.h" |
11 | | #include "PerformanceStorage.h" |
12 | | |
13 | | namespace mozilla { |
14 | | namespace dom { |
15 | | |
16 | | class PerformanceNavigationTiming; |
17 | | |
18 | | class PerformanceMainThread final : public Performance |
19 | | , public PerformanceStorage |
20 | | { |
21 | | public: |
22 | | PerformanceMainThread(nsPIDOMWindowInner* aWindow, |
23 | | nsDOMNavigationTiming* aDOMTiming, |
24 | | nsITimedChannel* aChannel, |
25 | | bool aPrincipal); |
26 | | |
27 | | NS_DECL_ISUPPORTS_INHERITED |
28 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(PerformanceMainThread, |
29 | | Performance) |
30 | | |
31 | | PerformanceStorage* AsPerformanceStorage() override |
32 | 0 | { |
33 | 0 | return this; |
34 | 0 | } |
35 | | |
36 | | virtual PerformanceTiming* Timing() override; |
37 | | |
38 | | virtual PerformanceNavigation* Navigation() override; |
39 | | |
40 | | virtual void AddEntry(nsIHttpChannel* channel, |
41 | | nsITimedChannel* timedChannel) override; |
42 | | |
43 | | TimeStamp CreationTimeStamp() const override; |
44 | | |
45 | | DOMHighResTimeStamp CreationTime() const override; |
46 | | |
47 | | virtual void GetMozMemory(JSContext *aCx, |
48 | | JS::MutableHandle<JSObject*> aObj) override; |
49 | | |
50 | | virtual nsDOMNavigationTiming* GetDOMTiming() const override |
51 | 0 | { |
52 | 0 | return mDOMTiming; |
53 | 0 | } |
54 | | |
55 | | virtual uint64_t GetRandomTimelineSeed() override |
56 | 0 | { |
57 | 0 | return GetDOMTiming()->GetRandomTimelineSeed(); |
58 | 0 | } |
59 | | |
60 | | virtual nsITimedChannel* GetChannel() const override |
61 | 0 | { |
62 | 0 | return mChannel; |
63 | 0 | } |
64 | | |
65 | | // The GetEntries* methods need to be overriden in order to add the |
66 | | // the document entry of type navigation. |
67 | | virtual void GetEntries(nsTArray<RefPtr<PerformanceEntry>>& aRetval) override; |
68 | | virtual void GetEntriesByType(const nsAString& aEntryType, |
69 | | nsTArray<RefPtr<PerformanceEntry>>& aRetval) override; |
70 | | virtual void GetEntriesByName(const nsAString& aName, |
71 | | const Optional<nsAString>& aEntryType, |
72 | | nsTArray<RefPtr<PerformanceEntry>>& aRetval) override; |
73 | | |
74 | | void QueueNavigationTimingEntry() override; |
75 | | |
76 | | protected: |
77 | | ~PerformanceMainThread(); |
78 | | |
79 | | void CreateNavigationTimingEntry(); |
80 | | |
81 | | void InsertUserEntry(PerformanceEntry* aEntry) override; |
82 | | |
83 | | bool IsPerformanceTimingAttribute(const nsAString& aName) override; |
84 | | |
85 | | DOMHighResTimeStamp |
86 | | GetPerformanceTimingFromString(const nsAString& aTimingName) override; |
87 | | |
88 | | void DispatchBufferFullEvent() override; |
89 | | |
90 | | RefPtr<PerformanceNavigationTiming> mDocEntry; |
91 | | RefPtr<nsDOMNavigationTiming> mDOMTiming; |
92 | | nsCOMPtr<nsITimedChannel> mChannel; |
93 | | RefPtr<PerformanceTiming> mTiming; |
94 | | RefPtr<PerformanceNavigation> mNavigation; |
95 | | JS::Heap<JSObject*> mMozMemory; |
96 | | }; |
97 | | |
98 | | } // namespace dom |
99 | | } // namespace mozilla |
100 | | |
101 | | #endif // mozilla_dom_PerformanceMainThread_h |