Bug 128116

Summary: Manage RuleSet and RuleData classes through std::unique_ptr instead of OwnPtr
Product: WebKit Reporter: Zan Dobersek <zan>
Component: New BugsAssignee: Zan Dobersek <zan>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, esprehn+autocc, glenn, gyuyoung.kim, macpherson, menard
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 128007    
Attachments:
Description Flags
Patch none

Description Zan Dobersek 2014-02-03 12:43:08 PST
Manage RuleSet and RuleData classes through std::unique_ptr instead of OwnPtr
Comment 1 Zan Dobersek 2014-02-03 12:44:20 PST
Created attachment 223010 [details]
Patch
Comment 2 WebKit Commit Bot 2014-02-03 12:47:03 PST
Attachment 223010 [details] did not pass style-queue:


ERROR: Source/WebCore/css/RuleSet.h:131:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 1 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Darin Adler 2014-02-03 14:57:07 PST
Comment on attachment 223010 [details]
Patch

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

> Source/WebCore/css/CSSDefaultStyleSheets.cpp:111
> +        defaultStyle = std::make_unique<RuleSet>().release();
> +        defaultPrintStyle = std::make_unique<RuleSet>().release();

I know that Anders likes this, but I think it’s pretty strange to write a plain old “new” this way.
Comment 4 Zan Dobersek 2014-02-04 05:20:57 PST
Comment on attachment 223010 [details]
Patch

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

>> Source/WebCore/css/CSSDefaultStyleSheets.cpp:111
>> +        defaultPrintStyle = std::make_unique<RuleSet>().release();
> 
> I know that Anders likes this, but I think it’s pretty strange to write a plain old “new” this way.

The idea behind std::make_unique in general is to hide the use of 'new'. std::make_unique<T>().release() doesn't look pretty or make sense, but I guess ideally the code should be organized in a way where this doesn't need to be used.
Comment 5 Zan Dobersek 2014-02-04 07:50:35 PST
(In reply to comment #4)
> (From update of attachment 223010 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=223010&action=review
> 
> >> Source/WebCore/css/CSSDefaultStyleSheets.cpp:111
> >> +        defaultPrintStyle = std::make_unique<RuleSet>().release();
> > 
> > I know that Anders likes this, but I think it’s pretty strange to write a plain old “new” this way.
> 
> The idea behind std::make_unique in general is to hide the use of 'new'. std::make_unique<T>().release() doesn't look pretty or make sense, but I guess ideally the code should be organized in a way where this doesn't need to be used.

That said, and while I do prefer std::make_unique<T>().release(), I'm willing to use `new` if the style guidelines are agreed to favor that option.
Comment 6 Zan Dobersek 2014-02-04 07:52:33 PST
Comment on attachment 223010 [details]
Patch

Clearing flags on attachment: 223010

Committed r163378: <http://trac.webkit.org/changeset/163378>
Comment 7 Zan Dobersek 2014-02-04 07:52:39 PST
All reviewed patches have been landed.  Closing bug.