Bug 160963 - Resource Timing: Make PerformanceEntryList a sequence as per spec
Summary: Resource Timing: Make PerformanceEntryList a sequence as per spec
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-18 10:36 PDT by Johan K. Jensen
Modified: 2016-08-19 11:31 PDT (History)
3 users (show)

See Also:


Attachments
Patch (31.62 KB, patch)
2016-08-18 12:14 PDT, Johan K. Jensen
no flags Details | Formatted Diff | Diff
Patch (32.07 KB, patch)
2016-08-18 15:47 PDT, Johan K. Jensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.