WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
129058
Move to using std::unique_ptr for Element, Node and related classes
https://bugs.webkit.org/show_bug.cgi?id=129058
Summary
Move to using std::unique_ptr for Element, Node and related classes
Zan Dobersek
Reported
2014-02-19 13:50:21 PST
Move to using std::unique_ptr for Element, Node and related classes
Attachments
Patch
(24.63 KB, patch)
2014-02-19 13:56 PST
,
Zan Dobersek
no flags
Details
Formatted Diff
Diff
Patch
(24.59 KB, patch)
2014-02-19 14:00 PST
,
Zan Dobersek
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Zan Dobersek
Comment 1
2014-02-19 13:56:04 PST
Created
attachment 224671
[details]
Patch
WebKit Commit Bot
Comment 2
2014-02-19 13:58:43 PST
Attachment 224671
[details]
did not pass style-queue: ERROR: Source/WebCore/dom/ElementIteratorAssertions.h:57: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] Total errors found: 1 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Zan Dobersek
Comment 3
2014-02-19 14:00:32 PST
Created
attachment 224672
[details]
Patch
WebKit Commit Bot
Comment 4
2014-02-19 14:03:22 PST
Attachment 224672
[details]
did not pass style-queue: ERROR: Source/WebCore/dom/ElementIteratorAssertions.h:57: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] Total errors found: 1 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Anders Carlsson
Comment 5
2014-02-24 08:31:49 PST
Comment on
attachment 224672
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=224672&action=review
> Source/WebCore/dom/Node.cpp:344 > - data = ElementRareData::create(toRenderElement(m_data.m_renderer)).leakPtr(); > + data = new ElementRareData(toRenderElement(m_data.m_renderer)); > else > - data = NodeRareData::create(m_data.m_renderer).leakPtr(); > + data = new NodeRareData(m_data.m_renderer);
I think you should use std::make_unique with release() here to avoid the ugly new expressions.
Zan Dobersek
Comment 6
2014-02-24 11:48:24 PST
Comment on
attachment 224672
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=224672&action=review
>> Source/WebCore/dom/Node.cpp:344 >> + data = new NodeRareData(m_data.m_renderer); > > I think you should use std::make_unique with release() here to avoid the ugly new expressions.
Should this be a general rule or just a one-time exception? Should we rigorously try to remove any use of new?
Zan Dobersek
Comment 7
2014-02-25 00:42:54 PST
Comment on
attachment 224672
[details]
Patch Clearing flags on attachment: 224672 Committed
r164638
: <
http://trac.webkit.org/changeset/164638
>
Zan Dobersek
Comment 8
2014-02-25 00:43:11 PST
All reviewed patches have been landed. Closing bug.
Brent Fulgham
Comment 9
2014-02-25 11:57:03 PST
This broke the Windows build: 1>c:\cygwin\home\buildbot\slave\win-debug\build\source\webcore\dom\DocumentOrderedMap.cpp(227): error C2280: 'std::unique_ptr<WebCore::NoEventDispatchAssertion,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)' : attempting to reference a deleted function with [ _Ty=WebCore::NoEventDispatchAssertion ] (..\dom\DOMAllInOne.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\memory(1486) : see declaration of 'std::unique_ptr<WebCore::NoEventDispatchAssertion,std::default_delete<_Ty>>::unique_ptr' with [ _Ty=WebCore::NoEventDispatchAssertion ] This diagnostic occurred in the compiler generated function 'WebCore::ElementIteratorAssertions::ElementIteratorAssertions(const WebCore::ElementIteratorAssertions &)'
Brent Fulgham
Comment 10
2014-02-25 12:25:14 PST
(In reply to
comment #9
)
> This broke the Windows build: > > 1>c:\cygwin\home\buildbot\slave\win-debug\build\source\webcore\dom\DocumentOrderedMap.cpp(227): error C2280: 'std::unique_ptr<WebCore::NoEventDispatchAssertion,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)' : attempting to reference a deleted function > with > [ > _Ty=WebCore::NoEventDispatchAssertion > ] (..\dom\DOMAllInOne.cpp) > C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\memory(1486) : see declaration of 'std::unique_ptr<WebCore::NoEventDispatchAssertion,std::default_delete<_Ty>>::unique_ptr' > with > [ > _Ty=WebCore::NoEventDispatchAssertion > ] > This diagnostic occurred in the compiler generated function 'WebCore::ElementIteratorAssertions::ElementIteratorAssertions(const WebCore::ElementIteratorAssertions &)'
It's trying to copy the unique_ptr in this routine.
WebKit Commit Bot
Comment 11
2014-02-25 12:33:08 PST
Re-opened since this is blocked by
bug 129321
Brent Fulgham
Comment 12
2014-02-25 12:51:12 PST
Windows is complaining because it doesn't like this line: auto it = entry.element ? elementDescandents.beginAt(*entry.element) : elementDescandents.begin(); You can establish the value of 'it' using either elementDescandents.begin(), or elementDescandents.beginAt(*entry.element), and everything is fine. But if you attempt to use the ternary operator you get the build error. If you attempt to do it without the ternary operator: auto it = elementDescandents.begin(); if (entry.element) it = elementDescandents.beginAT(*entryElement) You also get the error.
Darin Adler
Comment 13
2015-04-20 10:05:52 PDT
This was all done eventually; the code in question is gone.
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