Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / dom / performance / PerformancePaintTiming.h
blob395866dbc25202188d052b1aee736ea412109d64
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 #ifndef mozilla_dom_PerformancePaintTiming_h___
8 #define mozilla_dom_PerformancePaintTiming_h___
10 #include "mozilla/dom/PerformanceEntry.h"
11 #include "mozilla/dom/PerformancePaintTimingBinding.h"
13 namespace mozilla::dom {
15 class Performance;
17 // https://w3c.github.io/paint-timing/#sec-PerformancePaintTiming
18 // Unlike timeToContentfulPaint, this timing is generated during
19 // displaylist building, when a frame is contentful, we collect
20 // the timestamp. Whereas, timeToContentfulPaint uses a compositor-side
21 // timestamp.
22 class PerformancePaintTiming final : public PerformanceEntry {
23 public:
24 PerformancePaintTiming(Performance* aPerformance, const nsAString& aName,
25 const TimeStamp& aStartTime);
27 NS_DECL_ISUPPORTS_INHERITED
29 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PerformancePaintTiming,
30 PerformanceEntry)
32 JSObject* WrapObject(JSContext* aCx,
33 JS::Handle<JSObject*> aGivenProto) override;
35 DOMHighResTimeStamp StartTime() const override;
37 size_t SizeOfIncludingThis(
38 mozilla::MallocSizeOf aMallocSizeOf) const override;
40 private:
41 ~PerformancePaintTiming();
42 RefPtr<Performance> mPerformance;
44 const TimeStamp mRawStartTime;
45 mutable Maybe<DOMHighResTimeStamp> mCachedStartTime;
48 } // namespace mozilla::dom
50 #endif /* mozilla_dom_PerformanacePaintTiming_h___ */