|
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 #include "PerformanceResourceTiming.h" |
|
7 #include "mozilla/dom/PerformanceResourceTimingBinding.h" |
|
8 |
|
9 using namespace mozilla::dom; |
|
10 |
|
11 NS_IMPL_CYCLE_COLLECTION_INHERITED(PerformanceResourceTiming, |
|
12 PerformanceEntry, |
|
13 mTiming) |
|
14 |
|
15 NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(PerformanceResourceTiming, |
|
16 PerformanceEntry) |
|
17 NS_IMPL_CYCLE_COLLECTION_TRACE_END |
|
18 |
|
19 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(PerformanceResourceTiming) |
|
20 NS_INTERFACE_MAP_END_INHERITING(PerformanceEntry) |
|
21 |
|
22 NS_IMPL_ADDREF_INHERITED(PerformanceResourceTiming, PerformanceEntry) |
|
23 NS_IMPL_RELEASE_INHERITED(PerformanceResourceTiming, PerformanceEntry) |
|
24 |
|
25 PerformanceResourceTiming::PerformanceResourceTiming(nsPerformanceTiming* aPerformanceTiming, |
|
26 nsPerformance* aPerformance) |
|
27 : PerformanceEntry(aPerformance), |
|
28 mTiming(aPerformanceTiming) |
|
29 { |
|
30 MOZ_ASSERT(aPerformance, "Parent performance object should be provided"); |
|
31 } |
|
32 |
|
33 PerformanceResourceTiming::~PerformanceResourceTiming() |
|
34 { |
|
35 } |
|
36 |
|
37 DOMHighResTimeStamp |
|
38 PerformanceResourceTiming::StartTime() const |
|
39 { |
|
40 DOMHighResTimeStamp startTime = mTiming->RedirectStartHighRes(); |
|
41 return startTime ? startTime : mTiming->FetchStartHighRes(); |
|
42 } |
|
43 |
|
44 JSObject* |
|
45 PerformanceResourceTiming::WrapObject(JSContext* aCx) |
|
46 { |
|
47 return PerformanceResourceTimingBinding::Wrap(aCx, this); |
|
48 } |