|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef mozilla_dom_PerformanceEntry_h___ |
|
7 #define mozilla_dom_PerformanceEntry_h___ |
|
8 |
|
9 #include "nsPerformance.h" |
|
10 #include "nsDOMNavigationTiming.h" |
|
11 |
|
12 namespace mozilla { |
|
13 namespace dom { |
|
14 |
|
15 // http://www.w3.org/TR/performance-timeline/#performanceentry |
|
16 class PerformanceEntry : public nsISupports, |
|
17 public nsWrapperCache |
|
18 { |
|
19 public: |
|
20 PerformanceEntry(nsPerformance* aPerformance); |
|
21 virtual ~PerformanceEntry(); |
|
22 |
|
23 NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
|
24 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PerformanceEntry) |
|
25 |
|
26 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; |
|
27 |
|
28 nsPerformance* GetParentObject() const |
|
29 { |
|
30 return mPerformance; |
|
31 } |
|
32 |
|
33 void GetName(nsAString& aName) const |
|
34 { |
|
35 aName = mName; |
|
36 } |
|
37 |
|
38 const nsAString& GetName() const |
|
39 { |
|
40 return mName; |
|
41 } |
|
42 |
|
43 void SetName(const nsAString& aName) |
|
44 { |
|
45 mName = aName; |
|
46 } |
|
47 |
|
48 void GetEntryType(nsAString& aEntryType) const |
|
49 { |
|
50 aEntryType = mEntryType; |
|
51 } |
|
52 |
|
53 const nsAString& GetEntryType() |
|
54 { |
|
55 return mEntryType; |
|
56 } |
|
57 |
|
58 void SetEntryType(const nsAString& aEntryType) |
|
59 { |
|
60 mEntryType = aEntryType; |
|
61 } |
|
62 |
|
63 virtual DOMHighResTimeStamp StartTime() const |
|
64 { |
|
65 return 0; |
|
66 } |
|
67 |
|
68 virtual DOMHighResTimeStamp Duration() const |
|
69 { |
|
70 return 0; |
|
71 } |
|
72 |
|
73 protected: |
|
74 nsRefPtr<nsPerformance> mPerformance; |
|
75 nsString mName; |
|
76 nsString mEntryType; |
|
77 }; |
|
78 |
|
79 } // namespace dom |
|
80 } // namespace mozilla |
|
81 |
|
82 #endif /* mozilla_dom_PerformanceEntry_h___ */ |