Commit 1fe0ceb5 authored by Nicolás Peña Moreno's avatar Nicolás Peña Moreno Committed by Commit Bot

[ElementTiming] Set startTime

Bug: 879270, 942033
Change-Id: I2cf90c23c3e1e3c81850bcb40e54e2ae39117dd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1719407Reviewed-by: default avatarYoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681101}
parent f7fdb2ff
...@@ -26,13 +26,15 @@ PerformanceElementTiming* PerformanceElementTiming::Create( ...@@ -26,13 +26,15 @@ PerformanceElementTiming* PerformanceElementTiming::Create(
DCHECK_GE(naturalWidth, 0); DCHECK_GE(naturalWidth, 0);
DCHECK_GE(naturalHeight, 0); DCHECK_GE(naturalHeight, 0);
DCHECK(element); DCHECK(element);
double start_time = render_time != 0.0 ? render_time : load_time;
return MakeGarbageCollected<PerformanceElementTiming>( return MakeGarbageCollected<PerformanceElementTiming>(
name, url, intersection_rect, render_time, load_time, identifier, name, start_time, url, intersection_rect, render_time, load_time,
naturalWidth, naturalHeight, id, element); identifier, naturalWidth, naturalHeight, id, element);
} }
PerformanceElementTiming::PerformanceElementTiming( PerformanceElementTiming::PerformanceElementTiming(
const AtomicString& name, const AtomicString& name,
DOMHighResTimeStamp start_time,
const String& url, const String& url,
const FloatRect& intersection_rect, const FloatRect& intersection_rect,
DOMHighResTimeStamp render_time, DOMHighResTimeStamp render_time,
...@@ -42,7 +44,7 @@ PerformanceElementTiming::PerformanceElementTiming( ...@@ -42,7 +44,7 @@ PerformanceElementTiming::PerformanceElementTiming(
int naturalHeight, int naturalHeight,
const AtomicString& id, const AtomicString& id,
Element* element) Element* element)
: PerformanceEntry(name, 0, 0), : PerformanceEntry(name, start_time, start_time),
element_(element), element_(element),
intersection_rect_(DOMRectReadOnly::FromFloatRect(intersection_rect)), intersection_rect_(DOMRectReadOnly::FromFloatRect(intersection_rect)),
render_time_(render_time), render_time_(render_time),
......
...@@ -32,6 +32,7 @@ class CORE_EXPORT PerformanceElementTiming final : public PerformanceEntry { ...@@ -32,6 +32,7 @@ class CORE_EXPORT PerformanceElementTiming final : public PerformanceEntry {
const AtomicString& id, const AtomicString& id,
Element*); Element*);
PerformanceElementTiming(const AtomicString& name, PerformanceElementTiming(const AtomicString& name,
DOMHighResTimeStamp start_time,
const String& url, const String& url,
const FloatRect& intersection_rect, const FloatRect& intersection_rect,
DOMHighResTimeStamp render_time, DOMHighResTimeStamp render_time,
......
...@@ -4,7 +4,13 @@ function checkElementInternal(entry, expectedUrl, expectedIdentifier, expectedID ...@@ -4,7 +4,13 @@ function checkElementInternal(entry, expectedUrl, expectedIdentifier, expectedID
assert_equals(entry.entryType, 'element'); assert_equals(entry.entryType, 'element');
assert_equals(entry.url, expectedUrl); assert_equals(entry.url, expectedUrl);
assert_equals(entry.identifier, expectedIdentifier); assert_equals(entry.identifier, expectedIdentifier);
assert_equals(entry.startTime, 0); if (beforeRender != 0) {
// In this case, renderTime is not 0.
assert_equals(entry.startTime, entry.renderTime);
} else {
// In this case, renderTime is 0, so compare to loadTime.
assert_equals(entry.startTime, entry.loadTime);
}
assert_equals(entry.duration, 0); assert_equals(entry.duration, 0);
assert_equals(entry.id, expectedID); assert_equals(entry.id, expectedID);
assert_greater_than_equal(entry.renderTime, beforeRender); assert_greater_than_equal(entry.renderTime, beforeRender);
......
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