Bug 146556

Summary: Drop RefPtr::clear() method
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Web Template FrameworkAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, beidson, commit-queue, darin, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
WIP Patch
none
WIP Patch
none
WIP Patch
none
Patch
none
WIP Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Chris Dumez
Reported 2015-07-02 12:39:43 PDT
Drop RefPtr::clear() method as we are instructing people to use "= nullptr" pattern instead.
Attachments
WIP Patch (79.19 KB, patch)
2015-07-02 12:41 PDT, Chris Dumez
no flags
WIP Patch (79.80 KB, patch)
2015-07-02 13:02 PDT, Chris Dumez
no flags
WIP Patch (80.48 KB, patch)
2015-07-02 13:14 PDT, Chris Dumez
no flags
Patch (105.03 KB, patch)
2015-07-02 13:54 PDT, Chris Dumez
no flags
WIP Patch (163.25 KB, patch)
2015-07-03 19:09 PDT, Chris Dumez
no flags
Patch (175.97 KB, patch)
2015-07-03 19:36 PDT, Chris Dumez
no flags
Patch (177.09 KB, patch)
2015-07-03 20:13 PDT, Chris Dumez
no flags
Patch (177.72 KB, patch)
2015-07-03 20:36 PDT, Chris Dumez
no flags
Patch (178.59 KB, patch)
2015-07-03 20:40 PDT, Chris Dumez
no flags
Patch (178.98 KB, patch)
2015-07-03 20:52 PDT, Chris Dumez
no flags
Patch (180.05 KB, patch)
2015-07-03 21:05 PDT, Chris Dumez
no flags
Patch (180.89 KB, patch)
2015-07-03 21:22 PDT, Chris Dumez
no flags
Patch (181.50 KB, patch)
2015-07-03 21:28 PDT, Chris Dumez
no flags
Patch (170.38 KB, patch)
2015-07-03 21:36 PDT, Chris Dumez
no flags
Patch (173.58 KB, patch)
2015-07-03 23:34 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2015-07-02 12:41:03 PDT
Created attachment 256024 [details] WIP Patch
Chris Dumez
Comment 2 2015-07-02 13:02:54 PDT
Created attachment 256026 [details] WIP Patch
Chris Dumez
Comment 3 2015-07-02 13:14:49 PDT
Created attachment 256027 [details] WIP Patch
Chris Dumez
Comment 4 2015-07-02 13:54:17 PDT
Brady Eidson
Comment 5 2015-07-02 14:20:38 PDT
I think this is a super great thing to do, and even started poking around it myself. I did notice that the mechanics behind operator=(T*) and .clear() are subtly different, and I wasn't able to immediately convince myself there was 0-risk of a change in performance characteristics. I brought this up to Chris on IRC, and I believe he's digging in more detail.
Darin Adler
Comment 6 2015-07-02 14:27:34 PDT
If there is any performance cost to using operator= we can overload it for std::nullptr_t.
Chris Dumez
Comment 7 2015-07-02 14:28:55 PDT
(In reply to comment #6) > If there is any performance cost to using operator= we can overload it for > std::nullptr_t. Right. I'll benchmark locally to confirm if there is a noticeable performance difference between clear() and our current operator=(T*).
Chris Dumez
Comment 8 2015-07-03 19:09:38 PDT
Created attachment 256126 [details] WIP Patch
WebKit Commit Bot
Comment 9 2015-07-03 19:12:40 PDT
Attachment 256126 [details] did not pass style-queue: ERROR: Source/WebKit/Storage/StorageAreaSync.cpp:91: One space before end of line comments [whitespace/comments] [5] Total errors found: 1 in 187 files If any of these errors are false positives, please file a bug against check-webkit-style.
Chris Dumez
Comment 10 2015-07-03 19:36:37 PDT
Chris Dumez
Comment 11 2015-07-03 20:13:58 PDT
Chris Dumez
Comment 12 2015-07-03 20:36:29 PDT
Chris Dumez
Comment 13 2015-07-03 20:40:43 PDT
Chris Dumez
Comment 14 2015-07-03 20:52:39 PDT
Chris Dumez
Comment 15 2015-07-03 21:05:06 PDT
Chris Dumez
Comment 16 2015-07-03 21:22:45 PDT
Chris Dumez
Comment 17 2015-07-03 21:28:15 PDT
Chris Dumez
Comment 18 2015-07-03 21:36:34 PDT
Brady Eidson
Comment 19 2015-07-03 22:19:37 PDT
GETTING SO CLOSE! Damned Windows build!
Chris Dumez
Comment 20 2015-07-03 22:21:33 PDT
(In reply to comment #19) > GETTING SO CLOSE! > > Damned Windows build! No no, the Windows EWS issue is unrelated :) The patch is ready.
Brady Eidson
Comment 21 2015-07-03 23:11:03 PDT
Really? https://webkit-queues.appspot.com/results/5659624707457024 c:\cygwin\home\buildbot\webkit\source\webcore\dom\Position.h(95): error C2039: 'clear' : is not a member of 'WTF::RefPtr<WebCore::Node>' (..\page\win\EventHandlerWin.cpp) [C:\cygwin\home\buildbot\WebKit\Source\WebCore\WebCore.vcxproj\WebCore.vcxproj] c:\cygwin\home\buildbot\webkit\source\webcore\dom\RangeBoundaryPoint.h(115): error C2039: 'clear' : is not a member of 'WTF::RefPtr<WebCore::Node>' (..\page\win\EventHandlerWin.cpp) [C:\cygwin\home\buildbot\WebKit\Source\WebCore\WebCore.vcxproj\WebCore.vcxproj] c:\cygwin\home\buildbot\webkit\source\webcore\dom\RangeBoundaryPoint.h(117): error C2593: 'operator =' is ambiguous (..\page\win\EventHandlerWin.cpp) [C:\cygwin\home\buildbot\WebKit\Source\WebCore\WebCore.vcxproj\WebCore.vcxproj] etc etc.
Chris Dumez
Comment 22 2015-07-03 23:17:30 PDT
(In reply to comment #21) > Really? > > https://webkit-queues.appspot.com/results/5659624707457024 > > c:\cygwin\home\buildbot\webkit\source\webcore\dom\Position.h(95): error > C2039: 'clear' : is not a member of 'WTF::RefPtr<WebCore::Node>' > (..\page\win\EventHandlerWin.cpp) > [C:\cygwin\home\buildbot\WebKit\Source\WebCore\WebCore.vcxproj\WebCore. > vcxproj] > c:\cygwin\home\buildbot\webkit\source\webcore\dom\RangeBoundaryPoint.h(115): > error C2039: 'clear' : is not a member of 'WTF::RefPtr<WebCore::Node>' > (..\page\win\EventHandlerWin.cpp) > [C:\cygwin\home\buildbot\WebKit\Source\WebCore\WebCore.vcxproj\WebCore. > vcxproj] > c:\cygwin\home\buildbot\webkit\source\webcore\dom\RangeBoundaryPoint.h(117): > error C2593: 'operator =' is ambiguous (..\page\win\EventHandlerWin.cpp) > [C:\cygwin\home\buildbot\WebKit\Source\WebCore\WebCore.vcxproj\WebCore. > vcxproj] > > etc etc. Weird, I missed those when I looked. I'll fix them, thanks.
Chris Dumez
Comment 23 2015-07-03 23:34:17 PDT
Brady Eidson
Comment 24 2015-07-04 08:08:29 PDT
Comment on attachment 256139 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256139&action=review > Source/JavaScriptCore/parser/Parser.cpp:494 > + lastPattern = TreeDestructuringPattern(0); Is this one necessary? > Source/JavaScriptCore/parser/Parser.cpp:897 > + pattern = TreeDestructuringPattern(0); Or this one?
Brady Eidson
Comment 25 2015-07-04 08:09:19 PDT
Comment on attachment 256139 [details] Patch r+ but please make sure it won't break anything else.
Chris Dumez
Comment 26 2015-07-04 09:17:50 PDT
(In reply to comment #24) > Comment on attachment 256139 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=256139&action=review > > > Source/JavaScriptCore/parser/Parser.cpp:494 > > + lastPattern = TreeDestructuringPattern(0); > > Is this one necessary? > > > Source/JavaScriptCore/parser/Parser.cpp:897 > > + pattern = TreeDestructuringPattern(0); > > Or this one? The reason I did this is because the functions are templated and depending on the template parameter, lastPattern / pattern can be either an int or a RefPtr. Therefore, using eight "= 0;" or "= nullptr;" wouldn't build. Calling the TreeDestructuringPattern constructor explicitly is the simplest workaround I found.
Chris Dumez
Comment 27 2015-07-04 12:43:21 PDT
Comment on attachment 256139 [details] Patch Clearing flags on attachment: 256139 Committed r186279: <http://trac.webkit.org/changeset/186279>
Chris Dumez
Comment 28 2015-07-04 12:43:29 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.