RESOLVED FIXED 214171
Rename createBoxPtr into adoptBoxPtr
https://bugs.webkit.org/show_bug.cgi?id=214171
Summary Rename createBoxPtr into adoptBoxPtr
Xabier Rodríguez Calvar
Reported 2020-07-09 21:35:04 PDT
Rename createBoxPtr into adoptBoxPtr
Attachments
Patch (6.49 KB, patch)
2020-07-09 21:38 PDT, Xabier Rodríguez Calvar
no flags
Patch (8.16 KB, patch)
2020-07-10 08:24 PDT, Xabier Rodríguez Calvar
darin: review+
Patch (8.18 KB, patch)
2020-07-16 09:40 PDT, Xabier Rodríguez Calvar
no flags
Xabier Rodríguez Calvar
Comment 1 2020-07-09 21:38:31 PDT
Created attachment 403943 [details] Patch Address comments by Darin in bug 214144
Xabier Rodríguez Calvar
Comment 2 2020-07-10 08:24:01 PDT
Created attachment 403968 [details] Patch I also changed a call to createBoxPtr that was already in trunk.
Darin Adler
Comment 3 2020-07-10 08:28:50 PDT
Comment on attachment 403968 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=403968&action=review > Source/WTF/wtf/BoxPtr.h:49 > +template<typename T> BoxPtr<T> adoptBoxPtr(T* ptr) I don’t think adoptBoxPtr is quite the right name. The return value is a BoxPtr, the thing being adopted is not a BoxPtr. Maybe the name needs both the words create (for the BoxPtr) and adopt (for the thing it’s taking)? > Source/WTF/wtf/BoxPtr.h:51 > return BoxPtr<T>::create(ptr); I think Box::create also needs to be renamed for the same reason; as with this function, it takes ownership of a raw pointer and so needs a special name making that clear.
Xabier Rodríguez Calvar
Comment 4 2020-07-13 08:31:29 PDT
(In reply to Darin Adler from comment #3) > Comment on attachment 403968 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=403968&action=review > > > Source/WTF/wtf/BoxPtr.h:49 > > +template<typename T> BoxPtr<T> adoptBoxPtr(T* ptr) > > I don’t think adoptBoxPtr is quite the right name. The return value is a > BoxPtr, the thing being adopted is not a BoxPtr. Maybe the name needs both > the words create (for the BoxPtr) and adopt (for the thing it’s taking)? I guess it could be do something like adoptPointerIntoBoxPtr ? I cannot get a better name, but I guess we should iron it out before writing another patch, wdyt? > > Source/WTF/wtf/BoxPtr.h:51 > > return BoxPtr<T>::create(ptr); > > I think Box::create also needs to be renamed for the same reason; as with > this function, it takes ownership of a raw pointer and so needs a special > name making that clear. This create comes from Box class, something I don't think we should rename.
Darin Adler
Comment 5 2020-07-13 09:23:52 PDT
(In reply to Xabier Rodríguez Calvar from comment #4) > (In reply to Darin Adler from comment #3) > > I think Box::create also needs to be renamed for the same reason; as with > > this function, it takes ownership of a raw pointer and so needs a special > > name making that clear. > > This create comes from Box class, something I don't think we should rename. Why? What makes the Box class immune to naming considerations?
Xabier Rodríguez Calvar
Comment 6 2020-07-13 22:30:17 PDT
(In reply to Darin Adler from comment #5) > (In reply to Xabier Rodríguez Calvar from comment #4) > > (In reply to Darin Adler from comment #3) > > > I think Box::create also needs to be renamed for the same reason; as with > > > this function, it takes ownership of a raw pointer and so needs a special > > > name making that clear. > > > > This create comes from Box class, something I don't think we should rename. > > Why? What makes the Box class immune to naming considerations? Well, yes, we could, but wouldn't recommend it here since Box does create objects in place.
Darin Adler
Comment 7 2020-07-14 10:50:56 PDT
(In reply to Xabier Rodríguez Calvar from comment #6) > Well, yes, we could, but wouldn't recommend it here since Box does create > objects in place. Doesn’t that function take ownership of a pointer? How is that "creating an object in place"?
Darin Adler
Comment 8 2020-07-14 10:51:29 PDT
(In reply to Darin Adler from comment #7) > (In reply to Xabier Rodríguez Calvar from comment #6) > > Well, yes, we could, but wouldn't recommend it here since Box does create > > objects in place. > > Doesn’t that function take ownership of a pointer? How is that "creating an > object in place"? Oh, OK, I guess not. My bad. I misunderstood.
Xabier Rodríguez Calvar
Comment 9 2020-07-16 09:40:32 PDT
Created attachment 404453 [details] Patch Landing this tomorrow morning CEST.
EWS
Comment 10 2020-07-16 22:19:02 PDT
Committed r264499: <https://trac.webkit.org/changeset/264499> All reviewed patches have been landed. Closing bug and clearing flags on attachment 404453 [details].
Radar WebKit Bug Importer
Comment 11 2020-07-16 22:20:14 PDT
Note You need to log in before you can comment on or make changes to this bug.