Bug 160963

Summary: Resource Timing: Make PerformanceEntryList a sequence as per spec
Product: WebKit Reporter: Johan K. Jensen <jj>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, commit-queue
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Johan K. Jensen 2016-08-18 10:36:29 PDT
PerformanceEntryList should be iterable as per the current spec: https://www.w3.org/TR/2016/WD-performance-timeline-2-20160421/#idl-def-performanceentrylist.
Comment 1 Johan K. Jensen 2016-08-18 12:14:14 PDT
Created attachment 286385 [details]
Patch
Comment 2 Alex Christensen 2016-08-18 14:01:04 PDT
Comment on attachment 286385 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=286385&action=review

> Source/WebCore/page/Performance.cpp:92
> -RefPtr<PerformanceEntryList> Performance::getEntries() const
> +Vector<RefPtr<PerformanceEntry>> Performance::getEntries() const

Could these be Ref<PerformanceEntry>s?

> Source/WebCore/page/Performance.cpp:105
> +    std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompareLessThan);

do we have to sort everything?
Comment 3 Chris Dumez 2016-08-18 14:04:10 PDT
Comment on attachment 286385 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=286385&action=review

> LayoutTests/http/tests/performance/performance-resource-timing-entries-iterable-expected.txt:1
> +PASS resources is an instance of Array

Would be nice if this test had a description.

> LayoutTests/http/tests/performance/performance-resource-timing-entries-iterable.html:3
> +<script>

description("....");
Comment 4 Chris Dumez 2016-08-18 14:05:56 PDT
Comment on attachment 286385 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=286385&action=review

> Source/WebCore/page/Performance.h:67
> +    Vector<RefPtr<PerformanceEntry>> getEntriesByType(const String& entryType);

Why is this not const?

> Source/WebCore/page/Performance.h:68
> +    Vector<RefPtr<PerformanceEntry>> getEntriesByName(const String& name, const String& entryType);

Why is this not const?
Comment 5 Johan K. Jensen 2016-08-18 15:46:58 PDT
(In reply to comment #2)
> > Source/WebCore/page/Performance.cpp:92
> > -RefPtr<PerformanceEntryList> Performance::getEntries() const
> > +Vector<RefPtr<PerformanceEntry>> Performance::getEntries() const
> 
> Could these be Ref<PerformanceEntry>s?
Some of the User Timing code uses PassRefPtr, so it should probably be updated in another patch.
> 
> > Source/WebCore/page/Performance.cpp:105
> > +    std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompareLessThan);
> 
> do we have to sort everything?
Yes, per the spec we should sort them by start time. Entries gets added according to responseEnd.

(In reply to comment #3)
> > LayoutTests/http/tests/performance/performance-resource-timing-entries-iterable-expected.txt:1
> > +PASS resources is an instance of Array
> 
> Would be nice if this test had a description.
Ah, yeah.

(In reply to comment #4)
> > Source/WebCore/page/Performance.h:67
> > +    Vector<RefPtr<PerformanceEntry>> getEntriesByType(const String& entryType);
> 
> Why is this not const?
Hm... Don’t see any reason why it isn’t.
Comment 6 Johan K. Jensen 2016-08-18 15:47:13 PDT
Created attachment 286406 [details]
Patch
Comment 7 Chris Dumez 2016-08-18 15:49:06 PDT
Comment on attachment 286406 [details]
Patch

lgtm
Comment 8 WebKit Commit Bot 2016-08-19 11:31:49 PDT
Comment on attachment 286406 [details]
Patch

Clearing flags on attachment: 286406

Committed r204641: <http://trac.webkit.org/changeset/204641>
Comment 9 WebKit Commit Bot 2016-08-19 11:31:53 PDT
All reviewed patches have been landed.  Closing bug.