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"
18 // https://w3c.github.io/paint-timing/#sec-PerformancePaintTiming
19 // Unlike timeToContentfulPaint, this timing is generated during
20 // displaylist building, when a frame is contentful, we collect
21 // the timestamp. Whereas, timeToContentfulPaint uses a compositor-side
23 class PerformancePaintTiming final
: public PerformanceEntry
{
25 PerformancePaintTiming(Performance
* aPerformance
, const nsAString
& aName
,
26 const TimeStamp
& aStartTime
);
28 NS_DECL_ISUPPORTS_INHERITED
30 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PerformancePaintTiming
,
33 JSObject
* WrapObject(JSContext
* aCx
,
34 JS::Handle
<JSObject
*> aGivenProto
) override
;
36 DOMHighResTimeStamp
StartTime() const override
;
38 size_t SizeOfIncludingThis(
39 mozilla::MallocSizeOf aMallocSizeOf
) const override
;
42 ~PerformancePaintTiming();
43 RefPtr
<Performance
> mPerformance
;
45 const TimeStamp mRawStarTime
;
46 mutable Maybe
<DOMHighResTimeStamp
> mCachedStartTime
;
50 } // namespace mozilla
52 #endif /* mozilla_dom_PerformanacePaintTiming_h___ */