Bug 214171 - Rename createBoxPtr into adoptBoxPtr
Summary: Rename createBoxPtr into adoptBoxPtr
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Xabier Rodríguez Calvar
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-09 21:35 PDT by Xabier Rodríguez Calvar
Modified: 2020-07-16 22:20 PDT (History)
11 users (show)

See Also:


Attachments
Patch (6.49 KB, patch)
2020-07-09 21:38 PDT, Xabier Rodríguez Calvar
no flags Details | Formatted Diff | Diff
Patch (8.16 KB, patch)
2020-07-10 08:24 PDT, Xabier Rodríguez Calvar
darin: review+
Details | Formatted Diff | Diff
Patch (8.18 KB, patch)
2020-07-16 09:40 PDT, Xabier Rodríguez Calvar
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Xabier Rodríguez Calvar 2020-07-09 21:35:04 PDT
Rename createBoxPtr into adoptBoxPtr
Comment 1 Xabier Rodríguez Calvar 2020-07-09 21:38:31 PDT
Created attachment 403943 [details]
Patch

Address comments by Darin in bug 214144
Comment 2 Xabier Rodríguez Calvar 2020-07-10 08:24:01 PDT
Created attachment 403968 [details]
Patch

I also changed a call to createBoxPtr that was already in trunk.
Comment 3 Darin Adler 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.
Comment 4 Xabier Rodríguez Calvar 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.
Comment 5 Darin Adler 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?
Comment 6 Xabier Rodríguez Calvar 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.
Comment 7 Darin Adler 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"?
Comment 8 Darin Adler 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.
Comment 9 Xabier Rodríguez Calvar 2020-07-16 09:40:32 PDT
Created attachment 404453 [details]
Patch

Landing this tomorrow morning CEST.
Comment 10 EWS 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].
Comment 11 Radar WebKit Bug Importer 2020-07-16 22:20:14 PDT
<rdar://problem/65707686>