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 "PerformanceMeasure.h"
8 : #include "MainThreadUtils.h"
9 : #include "mozilla/dom/PerformanceMeasureBinding.h"
10 :
11 : using namespace mozilla::dom;
12 :
13 0 : PerformanceMeasure::PerformanceMeasure(nsISupports* aParent,
14 : const nsAString& aName,
15 : DOMHighResTimeStamp aStartTime,
16 0 : DOMHighResTimeStamp aEndTime)
17 0 : : PerformanceEntry(aParent, aName, NS_LITERAL_STRING("measure")),
18 : mStartTime(aStartTime),
19 0 : mDuration(aEndTime - aStartTime)
20 : {
21 : // mParent is null in workers.
22 0 : MOZ_ASSERT(mParent || !NS_IsMainThread());
23 0 : }
24 :
25 0 : PerformanceMeasure::~PerformanceMeasure()
26 : {
27 0 : }
28 :
29 : JSObject*
30 0 : PerformanceMeasure::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
31 : {
32 0 : return PerformanceMeasureBinding::Wrap(aCx, this, aGivenProto);
33 : }
|