| Summary: | Manage MediaQuery and MediaQueryExp classes through std::unique_ptr instead of OwnPtr | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Zan Dobersek <zan> | ||||
| Component: | New Bugs | Assignee: | Zan Dobersek <zan> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | commit-queue, eric.carlson, esprehn+autocc, glenn, gyuyoung.kim, jer.noble, macpherson, menard, philipj | ||||
| Priority: | P2 | ||||||
| Version: | 528+ (Nightly build) | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 128007 | ||||||
| Attachments: |
|
||||||
|
Description
Zan Dobersek
2014-02-03 12:46:29 PST
Created attachment 223011 [details]
Patch
Comment on attachment 223011 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=223011&action=review > Source/WebCore/css/CSSGrammar.y.in:522 > - $$ = MediaQueryExp::create(emptyString(), nullptr).leakPtr(); > + $$ = std::make_unique<MediaQueryExp>(emptyString(), nullptr).release(); Elsewhere in this file we just use new for this sort of thing. Not sure how we decide when to do make_unique/release vs. new. > Source/WebCore/css/CSSGrammar.y.in:543 > + $$ = new Vector<std::unique_ptr<MediaQueryExp>>; Here’s an example where we are using new (see comment above). > Source/WebCore/css/MediaList.cpp:252 > + const Vector<std::unique_ptr<MediaQuery>>& queries = m_mediaQueries->queryVector(); I suggest "auto&" here instead of "const Vector<std::unique_ptr<MediaQuery>>&". > Source/WebCore/css/MediaList.cpp:321 > + const Vector<std::unique_ptr<MediaQuery>>& mediaQueries = mediaQuerySet->queryVector(); I suggest "auto&" here instead of "const Vector<std::unique_ptr<MediaQuery>>&". > Source/WebCore/css/MediaList.cpp:331 > + const Vector<std::unique_ptr<MediaQueryExp>>& expressions = query->expressions(); I suggest "auto&" here instead of "const Vector<std::unique_ptr<MediaQueryExp>>&". > Source/WebCore/css/MediaQueryEvaluator.cpp:137 > + const Vector<std::unique_ptr<MediaQuery>>& queries = querySet->queryVector(); auto& would be better here > Source/WebCore/css/MediaQueryEvaluator.cpp:150 > + const Vector<std::unique_ptr<MediaQueryExp>>& expressions = query->expressions(); auto& would be better here Comment on attachment 223011 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=223011&action=review >> Source/WebCore/css/CSSGrammar.y.in:522 >> + $$ = std::make_unique<MediaQueryExp>(emptyString(), nullptr).release(); > > Elsewhere in this file we just use new for this sort of thing. Not sure how we decide when to do make_unique/release vs. new. I'll revert to using 'new' until more rigid guidelines are established for such cases (and will adjust accordingly at that point, if necessary). >> Source/WebCore/css/MediaList.cpp:252 >> + const Vector<std::unique_ptr<MediaQuery>>& queries = m_mediaQueries->queryVector(); > > I suggest "auto&" here instead of "const Vector<std::unique_ptr<MediaQuery>>&". OK, m_mediaQueries->queryVector() does note, to some degree, what type the method call returns. Committed r163385: <http://trac.webkit.org/changeset/163385> |