RESOLVED FIXED 216945
Get rid of AudioNode::RefType
https://bugs.webkit.org/show_bug.cgi?id=216945
Summary Get rid of AudioNode::RefType
Chris Dumez
Reported 2020-09-24 15:12:43 PDT
Get rid of AudioNode::RefType. Try to make AudioNode refcounting clearer and less leak-prone.
Attachments
Patch (41.99 KB, patch)
2020-09-24 17:45 PDT, Chris Dumez
ews-feeder: commit-queue-
Patch (46.97 KB, patch)
2020-09-24 18:09 PDT, Chris Dumez
no flags
Patch (49.06 KB, patch)
2020-09-24 18:37 PDT, Chris Dumez
no flags
Patch (48.89 KB, patch)
2020-09-24 18:49 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2020-09-24 17:45:14 PDT
Chris Dumez
Comment 2 2020-09-24 18:09:02 PDT
Chris Dumez
Comment 3 2020-09-24 18:37:12 PDT
Chris Dumez
Comment 4 2020-09-24 18:49:47 PDT
Chris Dumez
Comment 5 2020-09-25 12:05:56 PDT
Any thoughts on this?
Darin Adler
Comment 6 2020-09-25 12:15:22 PDT
Comment on attachment 409648 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=409648&action=review > Source/WTF/ChangeLog:11 > + Add third template parameter to RefPtr allowing to define the traits > + from incrementing / decrementing the refcount. The default traits > + call ref() / deref() but this can now be customized to call other > + functions. What about all the other RefPtr-like classes? Could RetainPtr be defined like this, or does it have features that are too fancy? WKRetainPtr? JSRetainPtr? NakedPtr? OSObjectPtr? > Source/WTF/wtf/RefPtr.h:49 > +template<typename T, typename _PtrTraits, typename _RefDerefTraits> Why the leading underscores? I think that’s technically reserved for the standard library.
Chris Dumez
Comment 7 2020-09-25 12:20:12 PDT
(In reply to Darin Adler from comment #6) > Comment on attachment 409648 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=409648&action=review > > > Source/WTF/ChangeLog:11 > > + Add third template parameter to RefPtr allowing to define the traits > > + from incrementing / decrementing the refcount. The default traits > > + call ref() / deref() but this can now be customized to call other > > + functions. > > What about all the other RefPtr-like classes? Could RetainPtr be defined > like this, or does it have features that are too fancy? WKRetainPtr? > JSRetainPtr? NakedPtr? OSObjectPtr? We don't have such need for the other classes yet. I had initially written my own class to wrap an AudioNode and call incrementConnectionCount() in constructor and decrementConnectionCount() in the destructor. I eventually realized I was duplicating a lot of the RefPtr code so I decided to make RefPtr more flexible so that I can reuse it instead. If you don't like this approach though, I can try and go back to my original idea. I do want the calls to incrementConnectionCount() / decrementConnectionCount() to be abstracted away though to reduce the chance of leaks. > > Source/WTF/wtf/RefPtr.h:49 > > +template<typename T, typename _PtrTraits, typename _RefDerefTraits> > > Why the leading underscores? I think that’s technically reserved for the > standard library. I could not do: using PtrTraits = PtrTraits; So I needed a way to differentiate the template parameter. I decided to use an underscore but I am open to suggestions.
EWS
Comment 8 2020-09-25 13:36:55 PDT
Committed r267591: <https://trac.webkit.org/changeset/267591> All reviewed patches have been landed. Closing bug and clearing flags on attachment 409648 [details].
Radar WebKit Bug Importer
Comment 9 2020-09-25 13:37:21 PDT
Myles C. Maxfield
Comment 10 2021-01-13 10:30:55 PST
By the way, it looks like this has broken binary compatibility with open-source builds (because those builds use the system WebInspector.framework).
Chris Dumez
Comment 11 2021-01-13 10:34:41 PST
(In reply to Myles C. Maxfield from comment #10) > By the way, it looks like this has broken binary compatibility with > open-source builds (because those builds use the system > WebInspector.framework). I am unclear what this change has to do with WebInspector.framework? I do not see any changes to inspector bits in this patch.
Darin Adler
Comment 12 2021-01-13 10:35:10 PST
I’m guessing it’s the change to RefPtr template arguments.
Chris Dumez
Comment 13 2021-01-13 10:35:44 PST
(In reply to Darin Adler from comment #12) > I’m guessing it’s the change to RefPtr template arguments. Oh, that makes sense indeed.
Darin Adler
Comment 14 2021-01-13 10:36:16 PST
I don’t understand how mismatched WebKit and WebInspector frameworks is expected to work. It’s untenable to have such a fragile API contract between them; not sure when we decided on this strategy.
Note You need to log in before you can comment on or make changes to this bug.