Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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/. */
6 #include "PerformanceResourceTiming.h"
7 #include "mozilla/dom/PerformanceResourceTimingBinding.h"
9 using namespace mozilla::dom;
11 NS_IMPL_CYCLE_COLLECTION_INHERITED(PerformanceResourceTiming,
12 PerformanceEntry,
13 mTiming)
15 NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(PerformanceResourceTiming,
16 PerformanceEntry)
17 NS_IMPL_CYCLE_COLLECTION_TRACE_END
19 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(PerformanceResourceTiming)
20 NS_INTERFACE_MAP_END_INHERITING(PerformanceEntry)
22 NS_IMPL_ADDREF_INHERITED(PerformanceResourceTiming, PerformanceEntry)
23 NS_IMPL_RELEASE_INHERITED(PerformanceResourceTiming, PerformanceEntry)
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 }
33 PerformanceResourceTiming::~PerformanceResourceTiming()
34 {
35 }
37 DOMHighResTimeStamp
38 PerformanceResourceTiming::StartTime() const
39 {
40 DOMHighResTimeStamp startTime = mTiming->RedirectStartHighRes();
41 return startTime ? startTime : mTiming->FetchStartHighRes();
42 }
44 JSObject*
45 PerformanceResourceTiming::WrapObject(JSContext* aCx)
46 {
47 return PerformanceResourceTimingBinding::Wrap(aCx, this);
48 }