Commit ddcf1299 authored by Liquan(Max) Gu's avatar Liquan(Max) Gu Committed by Commit Bot

[EventTiming] Remove the check of processing start being before onload

Due to the possible absence of frame or document loader from the
performance object, it's not guaranteed that processing start would be
always earlier than onload.

Reuse existing code to refactor the buffering-before-onload logic.

Bug: 847496
Change-Id: If3fae54e90747572956610bedadd7963463a5dcc
Reviewed-on: https://chromium-review.googlesource.com/1080131
Commit-Queue: Liquan (Max) Gǔ <maxlg@chromium.org>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Cr-Commit-Position: refs/heads/master@{#564736}
parent 08ad1f41
......@@ -24,12 +24,8 @@
assert_greater_than(entry.processingStart, processingStartMin,
"The entry should be processed later than processingStartMin.");
assert_greater_than(onloadTime, entry.processingStart,
"Onload should occur later than the entry's processing start.");
assert_greater_than(entry.startTime, clickTimeMin,
"The entry's start time should be later than clickTimeMin.");
assert_greater_than(onloadTime, entry.startTime,
"onload should occur later than the entry's start time.");
const entriesAfterOnload = entries.filter(
e => e.startTime > onloadTime);
......
......@@ -296,19 +296,10 @@ void WindowPerformance::ReportLongTask(
}
}
// We buffer Long-latency events until onload, i.e., LoadEventStar is not
// We buffer long-latency events until onload, i.e., LoadEventStart is not
// reached yet.
bool WindowPerformance::ShouldBufferEventTiming() {
if (!GetFrame())
return true;
const DocumentLoader* loader = GetFrame()->Loader().GetDocumentLoader();
// Document loader will only be nullptr for a brief window
// during creation (i.e., until the initial empty document is committed) and
// after detach.
if (!loader)
return true;
TimeTicks load_start = loader->GetTiming().LoadEventStart();
return load_start.is_null();
return !timing() || !timing()->loadEventStart();
}
bool WindowPerformance::ObservingEventTimingEntries() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment