Bug 162518 - Refactor URLParser
Summary: Refactor URLParser
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-23 16:23 PDT by Alex Christensen
Modified: 2016-09-23 16:43 PDT (History)
1 user (show)

See Also:


Attachments
Patch (33.81 KB, patch)
2016-09-23 16:27 PDT, Alex Christensen
beidson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2016-09-23 16:23:37 PDT
Refactor URLParser
Comment 1 Alex Christensen 2016-09-23 16:27:30 PDT
Created attachment 289717 [details]
Patch
Comment 2 Brady Eidson 2016-09-23 16:30:54 PDT
Comment on attachment 289717 [details]
Patch

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

> Source/WebCore/platform/URLParser.h:86
> +    using IPv4Address = uint32_t;

Is 'using' preferred over typedef?

> Source/WebCore/platform/URLParser.h:89
> +    using IPv6Address = std::array<uint16_t, 8>;

Why std::array instead of Vector?
Comment 3 Alex Christensen 2016-09-23 16:32:43 PDT
(In reply to comment #2)
> Comment on attachment 289717 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=289717&action=review
> 
> > Source/WebCore/platform/URLParser.h:86
> > +    using IPv4Address = uint32_t;
> 
> Is 'using' preferred over typedef?
Yes.  It works better with templates.
> 
> > Source/WebCore/platform/URLParser.h:89
> > +    using IPv6Address = std::array<uint16_t, 8>;
> 
> Why std::array instead of Vector?
We know it will have exactly 8 and only 8 elements.  No reason to keep track of size, and no reason to have capability of having more or less.  I would use an array, but that doesn't work as a template parameter.
Comment 4 Brady Eidson 2016-09-23 16:42:14 PDT
(In reply to comment #3)
> (In reply to comment #2)
> > Comment on attachment 289717 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=289717&action=review
> > 
> > > Source/WebCore/platform/URLParser.h:86
> > > +    using IPv4Address = uint32_t;
> > 
> > Is 'using' preferred over typedef?
> Yes.  It works better with templates.
> > 
> > > Source/WebCore/platform/URLParser.h:89
> > > +    using IPv6Address = std::array<uint16_t, 8>;
> > 
> > Why std::array instead of Vector?
> We know it will have exactly 8 and only 8 elements. 

Vector with inline capacity accomplishes the same thing, no?
Comment 5 Alex Christensen 2016-09-23 16:43:18 PDT
http://trac.webkit.org/changeset/206337
Comment 6 Alex Christensen 2016-09-23 16:43:44 PDT
(In reply to comment #4)
> Vector with inline capacity accomplishes the same thing, no?
This has an unneeded unsigned value next to the values I care about.