1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-06-22 00:08:54 +00:00
Files
UXP/dom/performance/PerformanceMeasure.h
T
FranklinDM 23519e0c22 Issue #2053 - Part 2: Update PerformanceMeasure to User Timing L3
There are a few minor differences between this and Mozilla's implementation:
(a) The type error messages were not hardcoded to the Performance class and were moved to Errors.msg instead.
(b) PerformanceMeasureOptions is used directly and doesn't use the the Maybe<> container class. I haven't found the reason yet, but PerformanceMeasureOptions is disallowed from having a copy constructor and without that, it isn't possible to use it with Maybe<>... There doesn't seem to be any problem with using it directly, though.
(c) Resist fingerprinting-pref changes were skipped.

Partially based on https://bugzilla.mozilla.org/show_bug.cgi?id=1762482
2023-04-12 10:02:42 +08:00

55 lines
1.6 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_performancemeasure_h___
#define mozilla_dom_performancemeasure_h___
#include "mozilla/dom/PerformanceEntry.h"
namespace mozilla {
namespace dom {
// http://www.w3.org/TR/user-timing/#performancemeasure
class PerformanceMeasure final : public PerformanceEntry
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(PerformanceMeasure,
PerformanceEntry);
PerformanceMeasure(nsISupports* aParent,
const nsAString& aName,
DOMHighResTimeStamp aStartTime,
DOMHighResTimeStamp aEndTime,
const JS::Handle<JS::Value>& aDetail);
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
virtual DOMHighResTimeStamp StartTime() const override
{
return mStartTime;
}
virtual DOMHighResTimeStamp Duration() const override
{
return mDuration;
}
void GetDetail(JSContext* aCx, JS::MutableHandle<JS::Value> aRv);
protected:
virtual ~PerformanceMeasure();
DOMHighResTimeStamp mStartTime;
DOMHighResTimeStamp mDuration;
private:
JS::Heap<JS::Value> mDetail;
};
} // namespace dom
} // namespace mozilla
#endif /* mozilla_dom_performancemeasure_h___ */