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