WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
128117
Manage MediaQuery and MediaQueryExp classes through std::unique_ptr instead of OwnPtr
https://bugs.webkit.org/show_bug.cgi?id=128117
Summary
Manage MediaQuery and MediaQueryExp classes through std::unique_ptr instead o...
Zan Dobersek
Reported
2014-02-03 12:46:29 PST
Manage MediaQuery and MediaQueryExp classes through std::unique_ptr instead of OwnPtr
Attachments
Patch
(20.94 KB, patch)
2014-02-03 12:47 PST
,
Zan Dobersek
darin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Zan Dobersek
Comment 1
2014-02-03 12:47:24 PST
Created
attachment 223011
[details]
Patch
Darin Adler
Comment 2
2014-02-03 15:52:42 PST
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
Zan Dobersek
Comment 3
2014-02-04 09:41:52 PST
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.
Zan Dobersek
Comment 4
2014-02-04 09:55:23 PST
Committed
r163385
: <
http://trac.webkit.org/changeset/163385
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug