RESOLVED FIXED 171977
Stop using PassRefPtr in platform/graphics
https://bugs.webkit.org/show_bug.cgi?id=171977
Summary Stop using PassRefPtr in platform/graphics
Chris Dumez
Reported 2017-05-11 09:44:13 PDT
Stop using PassRefPtr in platform/graphics.
Attachments
WIP Patch (136.58 KB, patch)
2017-05-11 12:37 PDT, Chris Dumez
no flags
WIP Patch (138.56 KB, patch)
2017-05-11 12:53 PDT, Chris Dumez
no flags
WIP Patch (144.46 KB, patch)
2017-05-11 13:01 PDT, Chris Dumez
no flags
WIP Patch (149.90 KB, patch)
2017-05-11 13:12 PDT, Chris Dumez
no flags
Patch (172.72 KB, patch)
2017-05-11 13:25 PDT, Chris Dumez
no flags
Patch (172.73 KB, patch)
2017-05-11 13:31 PDT, Chris Dumez
no flags
Patch (173.10 KB, patch)
2017-05-11 13:47 PDT, Chris Dumez
no flags
Patch (173.12 KB, patch)
2017-05-11 13:59 PDT, Chris Dumez
no flags
Patch (175.49 KB, patch)
2017-05-11 14:57 PDT, Chris Dumez
no flags
Patch (175.52 KB, patch)
2017-05-11 15:07 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2017-05-11 12:37:50 PDT
Created attachment 309753 [details] WIP Patch
Chris Dumez
Comment 2 2017-05-11 12:53:33 PDT
Created attachment 309755 [details] WIP Patch
Chris Dumez
Comment 3 2017-05-11 13:01:35 PDT
Created attachment 309757 [details] WIP Patch
Chris Dumez
Comment 4 2017-05-11 13:12:14 PDT
Created attachment 309760 [details] WIP Patch
Chris Dumez
Comment 5 2017-05-11 13:25:40 PDT
Chris Dumez
Comment 6 2017-05-11 13:31:55 PDT
Chris Dumez
Comment 7 2017-05-11 13:47:32 PDT
Chris Dumez
Comment 8 2017-05-11 13:59:47 PDT
Chris Dumez
Comment 9 2017-05-11 14:57:49 PDT
Alex Christensen
Comment 10 2017-05-11 15:04:22 PDT
Comment on attachment 309777 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=309777&action=review > Source/WebCore/platform/graphics/filters/FilterOperation.h:182 > ASSERT_NOT_REACHED(); > - return nullptr; > + return *static_cast<FilterOperation*>(nullptr); This looks gross. It should return a RefPtr or RELEASE_ASSERT_NOT_REACHED(). We shouldn't have to check a valid Ref for a nullptr. > Source/WebCore/rendering/RenderLayer.cpp:3717 > if (renderer().document().deviceScaleFactor() >= 2) { > - static NeverDestroyed<Image*> resizeCornerImageHiRes(Image::loadPlatformResource("textAreaResizeCorner@2x").leakRef()); > + static NeverDestroyed<Image*> resizeCornerImageHiRes(&Image::loadPlatformResource("textAreaResizeCorner@2x").leakRef()); Don't we have 3x resources now? Maybe we should update this.
Chris Dumez
Comment 11 2017-05-11 15:06:33 PDT
(In reply to Alex Christensen from comment #10) > Comment on attachment 309777 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=309777&action=review > > > Source/WebCore/platform/graphics/filters/FilterOperation.h:182 > > ASSERT_NOT_REACHED(); > > - return nullptr; > > + return *static_cast<FilterOperation*>(nullptr); > > This looks gross. It should return a RefPtr or > RELEASE_ASSERT_NOT_REACHED(). We shouldn't have to check a valid Ref for a > nullptr. Sure, I do not mind making it a release assertion. It is going to crash on the next line anyway. > > > Source/WebCore/rendering/RenderLayer.cpp:3717 > > if (renderer().document().deviceScaleFactor() >= 2) { > > - static NeverDestroyed<Image*> resizeCornerImageHiRes(Image::loadPlatformResource("textAreaResizeCorner@2x").leakRef()); > > + static NeverDestroyed<Image*> resizeCornerImageHiRes(&Image::loadPlatformResource("textAreaResizeCorner@2x").leakRef()); > > Don't we have 3x resources now? Maybe we should update this. Seems out of scope.
Chris Dumez
Comment 12 2017-05-11 15:07:26 PDT
Alex Christensen
Comment 13 2017-05-11 15:29:56 PDT
> > Don't we have 3x resources now? Maybe we should update this. > > Seems out of scope. Definitely out of scope.
Alex Christensen
Comment 14 2017-05-11 15:31:17 PDT
Comment on attachment 309793 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=309793&action=review > Source/WebCore/platform/graphics/filters/FilterOperation.h:182 > + return *static_cast<FilterOperation*>(nullptr); I would prefer dereferencing this. Dereferencing nullptr feels really bad.
Chris Dumez
Comment 15 2017-05-11 15:38:08 PDT
(In reply to Alex Christensen from comment #14) > Comment on attachment 309793 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=309793&action=review > > > Source/WebCore/platform/graphics/filters/FilterOperation.h:182 > > + return *static_cast<FilterOperation*>(nullptr); > > I would prefer dereferencing this. Dereferencing nullptr feels really bad. If I return |this|, then I would need to const_cast it. Note that dereferencing nullptr is the pattern used here already: Ref<Node> ShadowRoot::cloneNodeInternal(Document&, CloningOperation) { RELEASE_ASSERT_NOT_REACHED(); return *static_cast<Node*>(nullptr); // ShadowRoots should never be cloned. }
Ryosuke Niwa
Comment 16 2017-05-11 16:38:18 PDT
Comment on attachment 309793 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=309793&action=review >>> Source/WebCore/platform/graphics/filters/FilterOperation.h:182 >>> + return *static_cast<FilterOperation*>(nullptr); >> >> I would prefer dereferencing this. Dereferencing nullptr feels really bad. > > If I return |this|, then I would need to const_cast it. Note that dereferencing nullptr is the pattern used here already: > Ref<Node> ShadowRoot::cloneNodeInternal(Document&, CloningOperation) > { > RELEASE_ASSERT_NOT_REACHED(); > return *static_cast<Node*>(nullptr); // ShadowRoots should never be cloned. > } Yeah, I think returning casted nullptr is fine. clang would be eliminating this code anyway due to reachability.
Chris Dumez
Comment 17 2017-05-11 16:40:19 PDT
Comment on attachment 309793 [details] Patch Clearing flags on attachment: 309793 Committed r216702: <http://trac.webkit.org/changeset/216702>
Chris Dumez
Comment 18 2017-05-11 16:40:21 PDT
All reviewed patches have been landed. Closing bug.
Carlos Alberto Lopez Perez
Comment 19 2017-05-11 19:58:05 PDT
Note You need to log in before you can comment on or make changes to this bug.