Bug 1377251 - Expose TIME_TO_NON_BLANK_PAINT as Performance Entry behind pref. r=qDot

This commit is contained in:
Perry Jiang 2017-07-05 16:51:50 -07:00
Родитель 1b64928d17
Коммит 211a8becfd
4 изменённых файлов: 27 добавлений и 1 удалений

Просмотреть файл

@ -82,6 +82,14 @@ public:
{
return mLoadEventEnd;
}
DOMTimeMilliSec GetTimeToNonBlankPaint() const
{
if (mNonBlankPaintTimeStamp.IsNull()) {
return 0;
}
return TimeStampToDOMHighRes(mNonBlankPaintTimeStamp);
}
enum class DocShellState : uint8_t {
eActive,
@ -110,7 +118,7 @@ public:
DOMTimeMilliSec TimeStampToDOM(mozilla::TimeStamp aStamp) const;
inline DOMHighResTimeStamp TimeStampToDOMHighRes(mozilla::TimeStamp aStamp)
inline DOMHighResTimeStamp TimeStampToDOMHighRes(mozilla::TimeStamp aStamp) const
{
mozilla::TimeDuration duration = aStamp - mNavigationStartTimeStamp;
return duration.ToMilliseconds();

Просмотреть файл

@ -244,6 +244,15 @@ public:
return GetDOMTiming()->GetLoadEventEnd();
}
DOMTimeMilliSec TimeToNonBlankPaint() const
{
if (!nsContentUtils::IsPerformanceTimingEnabled() ||
nsContentUtils::ShouldResistFingerprinting()) {
return 0;
}
return GetDOMTiming()->GetTimeToNonBlankPaint();
}
private:
~PerformanceTiming();

Просмотреть файл

@ -34,5 +34,11 @@ interface PerformanceTiming {
readonly attribute unsigned long long loadEventStart;
readonly attribute unsigned long long loadEventEnd;
// This is a Chrome proprietary extension and not part of the
// performance/navigation timing specification.
// Returns 0 if a non-blank paint has not happened.
[Pref="dom.performance.time_to_non_blank_paint.enabled"]
readonly attribute unsigned long long timeToNonBlankPaint;
jsonifier;
};

Просмотреть файл

@ -180,6 +180,9 @@ pref("dom.performance.enable_notify_performance_timing", false);
// Enable Permission API's .revoke() method
pref("dom.permissions.revoke.enable", false);
// Enable exposing timeToNonBlankPaint
pref("dom.performance.time_to_non_blank_paint.enabled", false);
// Enable Performance Observer API
#ifdef NIGHTLY_BUILD
pref("dom.enable_performance_observer", true);