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
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_dom_PerformanceEntry_h___
8 : #define mozilla_dom_PerformanceEntry_h___
9 :
10 : #include "nsDOMNavigationTiming.h"
11 : #include "nsString.h"
12 : #include "nsWrapperCache.h"
13 :
14 : class nsISupports;
15 :
16 : namespace mozilla {
17 : namespace dom {
18 : class PerformanceResourceTiming;
19 :
20 : // http://www.w3.org/TR/performance-timeline/#performanceentry
21 : class PerformanceEntry : public nsISupports,
22 : public nsWrapperCache
23 : {
24 : protected:
25 : virtual ~PerformanceEntry();
26 :
27 : public:
28 : PerformanceEntry(nsISupports* aParent,
29 : const nsAString& aName,
30 : const nsAString& aEntryType);
31 :
32 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
33 6 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PerformanceEntry)
34 :
35 : virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
36 :
37 0 : nsISupports* GetParentObject() const
38 : {
39 0 : return mParent;
40 : }
41 :
42 0 : void GetName(nsAString& aName) const
43 : {
44 0 : aName = mName;
45 0 : }
46 :
47 0 : const nsAString& GetName() const
48 : {
49 0 : return mName;
50 : }
51 :
52 : void SetName(const nsAString& aName)
53 : {
54 : mName = aName;
55 : }
56 :
57 0 : void GetEntryType(nsAString& aEntryType) const
58 : {
59 0 : aEntryType = mEntryType;
60 0 : }
61 :
62 0 : const nsAString& GetEntryType()
63 : {
64 0 : return mEntryType;
65 : }
66 :
67 : void SetEntryType(const nsAString& aEntryType)
68 : {
69 : mEntryType = aEntryType;
70 : }
71 :
72 0 : virtual DOMHighResTimeStamp StartTime() const
73 : {
74 0 : return 0;
75 : }
76 :
77 0 : virtual DOMHighResTimeStamp Duration() const
78 : {
79 0 : return 0;
80 : }
81 :
82 0 : virtual const PerformanceResourceTiming* ToResourceTiming() const
83 : {
84 0 : return nullptr;
85 : }
86 :
87 : protected:
88 : nsCOMPtr<nsISupports> mParent;
89 : nsString mName;
90 : nsString mEntryType;
91 : };
92 :
93 : } // namespace dom
94 : } // namespace mozilla
95 :
96 : #endif /* mozilla_dom_PerformanceEntry_h___ */
|