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
{
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
22 class PerformancePaintTiming final
: public PerformanceEntry
{
24 PerformancePaintTiming(Performance
* aPerformance
, const nsAString
& aName
,
25 const TimeStamp
& aStartTime
);
27 NS_DECL_ISUPPORTS_INHERITED
29 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PerformancePaintTiming
,
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
;
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___ */