Backed out 3 changesets (bug 1299118) for ES lint failures

Backed out changeset 14451eb9a2b8 (bug 1299118)
Backed out changeset e5adc30bdf7f (bug 1299118)
Backed out changeset 8f7bb583fbb5 (bug 1299118)
This commit is contained in:
shindli 2018-10-11 20:47:58 +03:00
parent 056511891c
commit 0f211616dc
17 changed files with 8 additions and 314 deletions

View File

@ -19,7 +19,6 @@
#include "mozilla/dom/PerformanceNavigation.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Telemetry.h"
#include "ProfilerMarkerPayload.h"
using namespace mozilla;
@ -254,113 +253,6 @@ nsDOMNavigationTiming::NotifyDOMContentLoadedEnd(nsIURI* aURI)
}
}
// static
void
nsDOMNavigationTiming::TTITimeoutCallback(nsITimer* aTimer, void *aClosure)
{
nsDOMNavigationTiming* self = static_cast<nsDOMNavigationTiming*>(aClosure);
self->TTITimeout(aTimer);
}
// Return the max of aT1 and aT2, or the lower of the two if there's more
// than Nms (the window size) between them. In other words, the window
// starts at the lower of aT1 and aT2, and we only want to respect
// timestamps within the window (and pick the max of those).
//
// This approach handles the edge case of a late wakeup: where there was
// more than Nms after one (of aT1 or aT2) without the other, but the other
// happened after Nms and before we woke up. For example, if aT1 was 10
// seconds after aT2, but we woke up late (after aT1) we don't want to
// return aT1 if the window is 5 seconds.
static const TimeStamp&
MaxWithinWindowBeginningAtMin(const TimeStamp& aT1, const TimeStamp& aT2,
const TimeDuration& aWindowSize)
{
if (aT2.IsNull()) {
return aT1;
} else if (aT1.IsNull()) {
return aT2;
}
if (aT1 > aT2) {
if ((aT1 - aT2) > aWindowSize) {
return aT2;
}
return aT1;
}
if ((aT2 - aT1) > aWindowSize) {
return aT1;
}
return aT2;
}
#define TTI_WINDOW_SIZE_MS (5 * 1000)
void
nsDOMNavigationTiming::TTITimeout(nsITimer* aTimer)
{
// Check TTI: see if it's been 5 seconds since the last Long Task
TimeStamp now = TimeStamp::Now();
MOZ_RELEASE_ASSERT(!mNonBlankPaint.IsNull(), "TTI timeout with no non-blank-paint?");
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
TimeStamp lastLongTaskEnded;
mainThread->GetLastLongNonIdleTaskEnd(&lastLongTaskEnded);
if (!lastLongTaskEnded.IsNull()) {
TimeDuration delta = now - lastLongTaskEnded;
if (delta.ToMilliseconds() < TTI_WINDOW_SIZE_MS) {
// Less than 5 seconds since the last long task. Schedule another check
aTimer->InitWithNamedFuncCallback(TTITimeoutCallback, this, TTI_WINDOW_SIZE_MS,
nsITimer::TYPE_ONE_SHOT_LOW_PRIORITY,
"nsDOMNavigationTiming::TTITimeout");
return;
}
}
// To correctly implement TTI/TTFI as proposed, we'd need to use
// FirstContentfulPaint (FCP, which we have not yet implemented) instead
// of FirstNonBlankPaing (FNBP) to start at, and not fire it until there
// are no more than 2 network loads. By the proposed definition, without
// that we're closer to TimeToFirstInteractive.
// XXX check number of network loads, and if > 2 mark to check if loads
// decreases to 2 (or record that point and let the normal timer here
// handle it)
// TTI has occurred! TTI is either FCP (if there are no longtasks and no
// DCLEnd in the window that starts at FCP), or at the end of the last
// Long Task or DOMContentLoadedEnd (whichever is later).
if (mTTFI.IsNull()) {
mTTI = MaxWithinWindowBeginningAtMin(lastLongTaskEnded, mDOMContentLoadedEventEnd,
TimeDuration::FromMilliseconds(TTI_WINDOW_SIZE_MS));
if (mTTFI.IsNull()) {
mTTFI = mNonBlankPaint;
}
}
// XXX Implement TTI via check number of network loads, and if > 2 mark
// to check if loads decreases to 2 (or record that point and let the
// normal timer here handle it)
mTTITimer = nullptr;
#ifdef MOZ_GECKO_PROFILER
if (profiler_is_active()) {
TimeDuration elapsed = mTTFI - mNavigationStart;
TimeDuration elapsedLongTask = lastLongTaskEnded.IsNull() ? 0 : lastLongTaskEnded - mNavigationStart;
nsAutoCString spec;
if (mLoadedURI) {
mLoadedURI->GetSpec(spec);
}
nsPrintfCString marker("TTFI after %dms (LongTask after %dms) for URL %s",
int(elapsed.ToMilliseconds()),
int(elapsedLongTask.ToMilliseconds()),spec.get());
profiler_add_marker(
"TTI", MakeUnique<UserTimingMarkerPayload>(NS_ConvertASCIItoUTF16(marker), mTTFI));
}
#endif
return;
}
void
nsDOMNavigationTiming::NotifyNonBlankPaintForRootContentDocument()
{
@ -387,15 +279,6 @@ nsDOMNavigationTiming::NotifyNonBlankPaintForRootContentDocument()
}
#endif
if (!mTTITimer) {
mTTITimer = NS_NewTimer();
}
// TTI is first checked 5 seconds after the FCP (non-blank-paint is very close to FCP).
mTTITimer->InitWithNamedFuncCallback(TTITimeoutCallback, this, TTI_WINDOW_SIZE_MS,
nsITimer::TYPE_ONE_SHOT_LOW_PRIORITY,
"nsDOMNavigationTiming::TTITimeout");
if (mDocShellHasBeenActiveSinceNavigationStart) {
if (net::nsHttp::IsBeforeLastActiveTabLoadOptimization(mNavigationStart)) {
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_NON_BLANK_PAINT_NETOPT_MS,

View File

@ -12,7 +12,6 @@
#include "mozilla/WeakPtr.h"
#include "mozilla/RelativeTimeline.h"
#include "mozilla/TimeStamp.h"
#include "nsITimer.h"
class nsDocShell;
class nsIURI;
@ -97,10 +96,6 @@ public:
{
return TimeStampToDOM(mNonBlankPaint);
}
DOMTimeMilliSec GetTimeToTTFI() const
{
return TimeStampToDOM(mTTFI);
}
DOMTimeMilliSec GetTimeToDOMContentFlushed() const
{
return TimeStampToDOM(mDOMContentFlushed);
@ -169,10 +164,6 @@ public:
void NotifyDOMContentLoadedStart(nsIURI* aURI);
void NotifyDOMContentLoadedEnd(nsIURI* aURI);
static void TTITimeoutCallback(nsITimer* aTimer, void *aClosure);
void TTITimeout(nsITimer* aTimer);
void NotifyLongTask(mozilla::TimeStamp aWhen);
void NotifyNonBlankPaintForRootContentDocument();
void NotifyDOMContentFlushedForRootContentDocument();
void NotifyDocShellStateChanged(DocShellState aDocShellState);
@ -203,7 +194,6 @@ private:
nsCOMPtr<nsIURI> mUnloadedURI;
nsCOMPtr<nsIURI> mLoadedURI;
nsCOMPtr<nsITimer> mTTITimer;
Type mNavigationType;
DOMHighResTimeStamp mNavigationStartHighRes;
@ -223,8 +213,6 @@ private:
mozilla::TimeStamp mDOMContentLoadedEventEnd;
mozilla::TimeStamp mDOMComplete;
mozilla::TimeStamp mTTFI;
bool mDocShellHasBeenActiveSinceNavigationStart : 1;
};

View File

@ -454,20 +454,6 @@ public:
mPerformance->GetRandomTimelineSeed());
}
DOMTimeMilliSec TimeToFirstInteractive() const
{
if (!nsContentUtils::IsPerformanceTimingEnabled() ||
nsContentUtils::ShouldResistFingerprinting()) {
return 0;
}
if (mPerformance->IsSystemPrincipal()) {
return GetDOMTiming()->GetTimeToTTFI();
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetTimeToTTFI(),
mPerformance->GetRandomTimelineSeed());
}
PerformanceTimingData* Data() const
{
return mTimingData.get();

View File

@ -45,11 +45,5 @@ interface PerformanceTiming {
[Pref="dom.performance.time_to_dom_content_flushed.enabled"]
readonly attribute unsigned long long timeToDOMContentFlushed;
// This is a Chrome proprietary extension and not part of the
// performance/navigation timing specification.
// Returns 0 if a time-to-interactive measurement has not happened.
[Pref="dom.performance.time_to_first_interactive.enabled"]
readonly attribute unsigned long long timeToFirstInteractive;
[Default] object toJSON();
};

View File

@ -182,9 +182,6 @@ pref("dom.performance.time_to_non_blank_paint.enabled", false);
// Enable exposing timeToDOMContentFlushed
pref("dom.performance.time_to_dom_content_flushed.enabled", false);
// Enable exposing timeToFirstInteractive
pref("dom.performance.time_to_first_interactive.enabled", false);
// Enable requestIdleCallback API
pref("dom.requestIdleCallback.enabled", true);

View File

@ -37,7 +37,7 @@ raptor-tp6-firefox:
try-name: raptor-tp6-firefox
treeherder-symbol: Rap(tp6)
run-on-projects: ['try', 'mozilla-central']
max-run-time: 1800
max-run-time: 1200
mozharness:
extra-options:
- --test=raptor-tp6

View File

@ -2,7 +2,6 @@
/* globals user_pref */
user_pref("dom.performance.time_to_non_blank_paint.enabled", true);
user_pref("dom.performance.time_to_dom_content_flushed.enabled", true);
user_pref("dom.performance.time_to_first_interactive.enabled", true);
// required for geckoview logging
user_pref("geckoview.console.enabled", true);

View File

@ -84,8 +84,6 @@ def write_test_settings_json(test_details, oskey):
test_settings['raptor-options']['measure']['fcp'] = True
if "hero" in test_details['measure']:
test_settings['raptor-options']['measure']['hero'] = test_details['hero'].split()
if "ttfi" in test_details['measure']:
test_settings['raptor-options']['measure']['ttfi'] = True
if test_details.get("page_timeout", None) is not None:
test_settings['raptor-options']['page_timeout'] = int(test_details['page_timeout'])
test_settings['raptor-options']['unit'] = test_details.get("unit", "ms")

View File

@ -14,22 +14,19 @@ page_cycles = 25
unit = ms
lower_is_better = true
alert_threshold = 2.0
# TTI/TTFI can take a while on some pages, and requires at least 5 seconds
# beyond typical pageload time
page_timeout = 30000
[raptor-tp6-amazon-firefox]
apps = firefox
test_url = https://www.amazon.com/s/url=search-alias%3Daps&field-keywords=laptop
playback_recordings = amazon.mp
measure = fnbpaint, hero, dcf, ttfi
measure = fnbpaint, hero, dcf
hero = hero1
[raptor-tp6-facebook-firefox]
apps = firefox
test_url = https://www.facebook.com
playback_recordings = facebook.mp
measure = fnbpaint, hero, dcf, ttfi
measure = fnbpaint, hero, dcf
hero = hero1
[raptor-tp6-google-firefox]
@ -39,7 +36,7 @@ apps = firefox
# to be loaded into that page also; resulting in 2 fnbpaint values etc.
test_url = https://www.google.com/search?hl=en&q=barack+obama&cad=h
playback_recordings = google-search.mp
measure = fnbpaint, hero, dcf, ttfi
measure = fnbpaint, hero, dcf
hero = hero1
[raptor-tp6-youtube-firefox]

View File

@ -23,12 +23,6 @@ var getFNBPaint = false;
// default only; this is set via control server settings json
var getDCF = false;
// measure firefox TTFI
// note: this browser pref must be enabled:
// dom.performance.time_to_first_interactive.enabled = True
// default only; this is set via control server settings json
var getTTFI = false;
// measure google's first-contentful-paint
// default only; this is set via control server settings json
var getFCP = false;
@ -93,14 +87,6 @@ function setup(settings) {
measureHero();
}
}
if (settings.measure.ttfi !== undefined) {
getTTFI = settings.measure.ttfi;
if (getTTFI) {
console.log("will be measuring ttfi");
measureTTFI();
}
}
}
function measureHero() {
@ -193,37 +179,6 @@ function measureDCF() {
}
}
function measureTTFI() {
var x = window.performance.timing.timeToFirstInteractive;
if (typeof(x) == "undefined") {
console.log("ERROR: timeToFirstInteractive is undefined; ensure the pref is enabled");
return;
}
if (x > 0) {
console.log("got timeToFirstInteractive: " + x);
gRetryCounter = 0;
var startTime = perfData.timing.fetchStart;
sendResult("ttfi", x - startTime);
} else {
gRetryCounter += 1;
// NOTE: currently the gecko implementation doesn't look at network
// requests, so this is closer to TimeToFirstInteractive than
// TimeToInteractive. Also, we use FNBP instead of FCP as the start
// point. TTFI/TTI requires running at least 5 seconds past last
// "busy" point, give 25 seconds here (overall the harness times out at
// 30 seconds). Some pages will never get 5 seconds without a busy
// period!
if (gRetryCounter <= 25*(1000/200)) {
console.log("\TTFI is not yet available (0), retry number " + gRetryCounter + "...\n");
window.setTimeout(measureTTFI, 200);
} else {
// unable to get a value for TTFI - filter out later
sendResult("ttfi", 0);
}
}
}
function measureFirstContentfulPaint() {
// see https://developer.mozilla.org/en-US/docs/Web/API/PerformancePaintTiming
var resultType = "fcp";

View File

@ -37,14 +37,12 @@ var getHero = false;
var getFNBPaint = false;
var getFCP = false;
var getDCF = false;
var getTTFI = false;
var isHeroPending = false;
var pendingHeroes = [];
var settings = {};
var isFNBPaintPending = false;
var isFCPPending = false;
var isDCFPending = false;
var isTTFIPending = false;
var isBenchmarkPending = false;
var pageTimeout = 10000; // default pageload timeout
@ -108,9 +106,6 @@ function getTestSettings() {
getHero = true;
}
}
if (settings.measure.ttfi !== undefined) {
getTTFI = settings.measure.ttfi;
}
} else {
console.log("abort: 'measure' key not found in test settings");
cleanUp();
@ -182,7 +177,7 @@ function waitForResult() {
return new Promise(resolve => {
function checkForResult() {
if (testType == "pageload") {
if (!isHeroPending && !isFNBPaintPending && !isFCPPending && !isDCFPending && !isTTFIPending) {
if (!isHeroPending && !isFNBPaintPending && !isFCPPending && !isDCFPending) {
cancelTimeoutAlarm("raptor-page-timeout");
resolve();
} else {
@ -227,8 +222,6 @@ function nextCycle() {
isFCPPending = true;
if (getDCF)
isDCFPending = true;
if (getTTFI)
isTTFIPending = true;
} else if (testType == "benchmark") {
isBenchmarkPending = true;
}
@ -305,9 +298,6 @@ function resultListener(request, sender, sendResponse) {
} else if (request.type == "dcf") {
results.measurements.dcf.push(request.value);
isDCFPending = false;
} else if (request.type == "ttfi") {
results.measurements.ttfi.push(request.value);
isTTFIPending = false;
} else if (request.type == "fcp") {
results.measurements.fcp.push(request.value);
isFCPPending = false;

View File

@ -264,12 +264,3 @@ StyleMarkerPayload::StreamPayload(SpliceableJSONWriter& aWriter,
aWriter.IntProperty("stylesShared", mStats.mStylesShared);
aWriter.IntProperty("stylesReused", mStats.mStylesReused);
}
void
LongTaskMarkerPayload::StreamPayload(SpliceableJSONWriter& aWriter,
const TimeStamp& aProcessStartTime,
UniqueStacks& aUniqueStacks)
{
StreamCommonProps("MainThreadLongTask", aWriter, aProcessStartTime, aUniqueStacks);
aWriter.StringProperty("category", "LongTask");
}

View File

@ -347,16 +347,4 @@ private:
mozilla::ServoTraversalStatistics mStats;
};
class LongTaskMarkerPayload : public ProfilerMarkerPayload
{
public:
LongTaskMarkerPayload(const mozilla::TimeStamp& aStartTime,
const mozilla::TimeStamp& aEndTime)
: ProfilerMarkerPayload(aStartTime, aEndTime)
{
}
DECL_STREAM_PAYLOAD
};
#endif // ProfilerMarkerPayload_h

View File

@ -472,16 +472,6 @@ LazyIdleThread::SetCanInvokeJS(bool aCanInvokeJS)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
LazyIdleThread::GetLastLongTaskEnd(TimeStamp* _retval) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
LazyIdleThread::GetLastLongNonIdleTaskEnd(TimeStamp* _retval) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
LazyIdleThread::AsyncShutdown()
{

View File

@ -8,16 +8,12 @@
%{C++
#include "mozilla/AlreadyAddRefed.h"
namespace mozilla {
class TimeStamp;
}
%}
[ptr] native PRThread(PRThread);
native nsIEventTargetPtr(nsIEventTarget*);
native nsISerialEventTargetPtr(nsISerialEventTarget*);
native TimeStamp(mozilla::TimeStamp);
/**
* This interface provides a high-level abstraction for an operating system
@ -157,11 +153,4 @@ interface nsIThread : nsISerialEventTarget
* target is an nsISerialEventTarget and then returns it.
*/
[noscript,notxpcom] nsISerialEventTargetPtr SerialEventTarget();
/**
* This is set to the end of the last 50+ms event that was executed on
* this thread (for MainThread only). Otherwise returns a null TimeStamp.
*/
[noscript] readonly attribute TimeStamp lastLongTaskEnd;
[noscript] readonly attribute TimeStamp lastLongNonIdleTaskEnd;
};

View File

@ -44,9 +44,6 @@
#include "nsThreadSyncDispatch.h"
#include "nsServiceManagerUtils.h"
#include "GeckoProfiler.h"
#ifdef MOZ_GECKO_PROFILER
#include "ProfilerMarkerPayload.h"
#endif
#include "InputEventStatistics.h"
#include "ThreadEventTarget.h"
#include "ThreadDelay.h"
@ -653,8 +650,6 @@ nsThread::nsThread(NotNull<SynchronizedEventQueue*> aQueue,
, mCurrentEventStart(TimeStamp::Now())
, mCurrentPerformanceCounter(nullptr)
{
mLastLongTaskEnd = mCurrentEventStart;
mLastLongNonIdleTaskEnd = mCurrentEventStart;
}
@ -675,8 +670,6 @@ nsThread::nsThread()
, mCurrentEventStart(TimeStamp::Now())
, mCurrentPerformanceCounter(nullptr)
{
mLastLongTaskEnd = mCurrentEventStart;
mLastLongNonIdleTaskEnd = mCurrentEventStart;
MOZ_ASSERT(!NS_IsMainThread());
}
@ -822,18 +815,6 @@ nsThread::SetCanInvokeJS(bool aCanInvokeJS)
return NS_OK;
}
NS_IMETHODIMP
nsThread::GetLastLongTaskEnd(TimeStamp* _retval) {
*_retval = mLastLongTaskEnd;
return NS_OK;
}
NS_IMETHODIMP
nsThread::GetLastLongNonIdleTaskEnd(TimeStamp* _retval) {
*_retval = mLastLongNonIdleTaskEnd;
return NS_OK;
}
NS_IMETHODIMP
nsThread::AsyncShutdown()
{
@ -1236,42 +1217,19 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
}
// The event starts to run, storing the timestamp.
bool recursiveEvent = mNestedEventLoopDepth > mCurrentEventLoopDepth;
mCurrentEventLoopDepth = mNestedEventLoopDepth;
if (IsMainThread() && !recursiveEvent) {
mCurrentEventStart = mozilla::TimeStamp::Now();
}
bool recursiveEvent = false;
RefPtr<mozilla::PerformanceCounter> currentPerformanceCounter;
if (schedulerLoggingEnabled) {
recursiveEvent = mNestedEventLoopDepth > mCurrentEventLoopDepth;
mCurrentEventStart = mozilla::TimeStamp::Now();
mCurrentEvent = event;
mCurrentEventLoopDepth = mNestedEventLoopDepth;
mCurrentPerformanceCounter = GetPerformanceCounter(event);
currentPerformanceCounter = mCurrentPerformanceCounter;
}
event->Run();
mozilla::TimeDuration duration;
// Remember the last 50ms+ task on mainthread for Long Task.
if (IsMainThread() && !recursiveEvent) {
TimeStamp now = TimeStamp::Now();
duration = now - mCurrentEventStart;
if (duration.ToMilliseconds() > LONGTASK_BUSY_WINDOW_MS) {
// Idle events (gc...) don't *really* count here
if (priority != EventPriority::Idle) {
mLastLongNonIdleTaskEnd = now;
}
mLastLongTaskEnd = now;
#ifdef MOZ_GECKO_PROFILER
if (profiler_is_active()) {
profiler_add_marker(
(priority != EventPriority::Idle) ? "LongTask" : "LongIdleTask",
MakeUnique<LongTaskMarkerPayload>(mCurrentEventStart, now));
}
#endif
}
}
// End of execution, we can send the duration for the group
if (schedulerLoggingEnabled) {
if (recursiveEvent) {

View File

@ -35,9 +35,6 @@ using mozilla::NotNull;
class nsThreadEnumerator;
// See https://www.w3.org/TR/longtasks
#define LONGTASK_BUSY_WINDOW_MS 50
// A native thread
class nsThread
: public nsIThreadInternal
@ -155,9 +152,6 @@ public:
static uint32_t MaxActiveThreads();
const mozilla::TimeStamp& LastLongTaskEnd() { return mLastLongTaskEnd; }
const mozilla::TimeStamp& LastLongNonIdleTaskEnd() { return mLastLongNonIdleTaskEnd; }
private:
void DoMainThreadSpecificProcessing(bool aReallyWait);
@ -219,9 +213,6 @@ protected:
uint32_t mNestedEventLoopDepth;
uint32_t mCurrentEventLoopDepth;
mozilla::TimeStamp mLastLongTaskEnd;
mozilla::TimeStamp mLastLongNonIdleTaskEnd;
mozilla::Atomic<bool> mShutdownRequired;
int8_t mPriority;