michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "PerformanceResourceTiming.h" michael@0: #include "mozilla/dom/PerformanceResourceTimingBinding.h" michael@0: michael@0: using namespace mozilla::dom; michael@0: michael@0: NS_IMPL_CYCLE_COLLECTION_INHERITED(PerformanceResourceTiming, michael@0: PerformanceEntry, michael@0: mTiming) michael@0: michael@0: NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(PerformanceResourceTiming, michael@0: PerformanceEntry) michael@0: NS_IMPL_CYCLE_COLLECTION_TRACE_END michael@0: michael@0: NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(PerformanceResourceTiming) michael@0: NS_INTERFACE_MAP_END_INHERITING(PerformanceEntry) michael@0: michael@0: NS_IMPL_ADDREF_INHERITED(PerformanceResourceTiming, PerformanceEntry) michael@0: NS_IMPL_RELEASE_INHERITED(PerformanceResourceTiming, PerformanceEntry) michael@0: michael@0: PerformanceResourceTiming::PerformanceResourceTiming(nsPerformanceTiming* aPerformanceTiming, michael@0: nsPerformance* aPerformance) michael@0: : PerformanceEntry(aPerformance), michael@0: mTiming(aPerformanceTiming) michael@0: { michael@0: MOZ_ASSERT(aPerformance, "Parent performance object should be provided"); michael@0: } michael@0: michael@0: PerformanceResourceTiming::~PerformanceResourceTiming() michael@0: { michael@0: } michael@0: michael@0: DOMHighResTimeStamp michael@0: PerformanceResourceTiming::StartTime() const michael@0: { michael@0: DOMHighResTimeStamp startTime = mTiming->RedirectStartHighRes(); michael@0: return startTime ? startTime : mTiming->FetchStartHighRes(); michael@0: } michael@0: michael@0: JSObject* michael@0: PerformanceResourceTiming::WrapObject(JSContext* aCx) michael@0: { michael@0: return PerformanceResourceTimingBinding::Wrap(aCx, this); michael@0: }