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/. */
7 #include "PerformanceMeasure.h"
8 #include "MainThreadUtils.h"
9 #include "mozilla/dom/PerformanceMeasureBinding.h"
11 using namespace mozilla::dom
;
13 PerformanceMeasure::PerformanceMeasure(nsISupports
* aParent
,
14 const nsAString
& aName
,
15 DOMHighResTimeStamp aStartTime
,
16 DOMHighResTimeStamp aEndTime
)
17 : PerformanceEntry(aParent
, aName
, u
"measure"_ns
),
18 mStartTime(aStartTime
),
19 mDuration(aEndTime
- aStartTime
) {}
21 PerformanceMeasure::~PerformanceMeasure() = default;
23 JSObject
* PerformanceMeasure::WrapObject(JSContext
* aCx
,
24 JS::Handle
<JSObject
*> aGivenProto
) {
25 return PerformanceMeasure_Binding::Wrap(aCx
, this, aGivenProto
);
28 size_t PerformanceMeasure::SizeOfIncludingThis(
29 mozilla::MallocSizeOf aMallocSizeOf
) const {
30 return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf
);