2018-01-19 03:59:58 +08:00
|
|
|
/* -*- 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:
|
2023-04-05 22:22:34 +08:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(PerformanceMeasure,
|
|
|
|
|
PerformanceEntry);
|
|
|
|
|
|
2018-01-19 03:59:58 +08:00
|
|
|
PerformanceMeasure(nsISupports* aParent,
|
|
|
|
|
const nsAString& aName,
|
|
|
|
|
DOMHighResTimeStamp aStartTime,
|
2023-04-05 22:22:34 +08:00
|
|
|
DOMHighResTimeStamp aEndTime,
|
|
|
|
|
const JS::Handle<JS::Value>& aDetail);
|
2018-01-19 03:59:58 +08:00
|
|
|
|
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
|
|
|
|
|
virtual DOMHighResTimeStamp StartTime() const override
|
|
|
|
|
{
|
|
|
|
|
return mStartTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual DOMHighResTimeStamp Duration() const override
|
|
|
|
|
{
|
|
|
|
|
return mDuration;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-05 22:22:34 +08:00
|
|
|
void GetDetail(JSContext* aCx, JS::MutableHandle<JS::Value> aRv);
|
|
|
|
|
|
2018-01-19 03:59:58 +08:00
|
|
|
protected:
|
|
|
|
|
virtual ~PerformanceMeasure();
|
|
|
|
|
DOMHighResTimeStamp mStartTime;
|
|
|
|
|
DOMHighResTimeStamp mDuration;
|
2023-04-05 22:22:34 +08:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
JS::Heap<JS::Value> mDetail;
|
2018-01-19 03:59:58 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
|
|
#endif /* mozilla_dom_performancemeasure_h___ */
|