WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
221914
Reduce explicit usage of [objC release] in WebKit even more
https://bugs.webkit.org/show_bug.cgi?id=221914
Summary
Reduce explicit usage of [objC release] in WebKit even more
Chris Dumez
Reported
2021-02-15 12:16:13 PST
Reduce explicit usage of [objC release] in WebKit even more.
Attachments
Patch
(117.77 KB, patch)
2021-02-15 14:50 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(124.06 KB, patch)
2021-02-16 10:00 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(124.79 KB, patch)
2021-02-16 10:06 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2021-02-15 14:50:10 PST
Created
attachment 420379
[details]
Patch
EWS Watchlist
Comment 2
2021-02-15 14:50:58 PST
This patch modifies the inspector protocol generator. Please ensure that you have rebaselined any generator test results (i.e., by running `Tools/Scripts/run-inspector-generator-tests --reset-results`)
Alex Christensen
Comment 3
2021-02-16 09:31:40 PST
Comment on
attachment 420379
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=420379&action=review
> Source/WebKitLegacy/mac/History/WebHistory.mm:664 > + _sharedHistory = retainPtr(history).leakRef();
I think it would be nicer to change the type of _sharedHistory to a function-scoped NeverDestroyed<RetainPtr>
> Source/WebKitLegacy/mac/Plugins/WebPluginDatabase.mm:195 > + auto oldPaths = adoptNS(additionalWebPlugInPaths);
Ditto. additionalWebPlugInPaths should be a RetainPtr.
Chris Dumez
Comment 4
2021-02-16 09:34:16 PST
(In reply to Alex Christensen from
comment #3
)
> Comment on
attachment 420379
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=420379&action=review
> > > Source/WebKitLegacy/mac/History/WebHistory.mm:664 > > + _sharedHistory = retainPtr(history).leakRef(); > > I think it would be nicer to change the type of _sharedHistory to a > function-scoped NeverDestroyed<RetainPtr>
Same comment as below. _sharedHistory is a global static.
> > > Source/WebKitLegacy/mac/Plugins/WebPluginDatabase.mm:195 > > + auto oldPaths = adoptNS(additionalWebPlugInPaths); > > Ditto. additionalWebPlugInPaths should be a RetainPtr.
additionalWebPlugInPaths is a global static. If I use a RetainPtr<> then the compiler complains about having an exit-time destructor. We usually use NeverDestroyed<> but it does not seem to fit the bill here since we want to update the pointer and release the previous value.
Darin Adler
Comment 5
2021-02-16 09:36:06 PST
(In reply to Chris Dumez from
comment #4
)
> additionalWebPlugInPaths is a global static. If I use a RetainPtr<> then the > compiler complains about having an exit-time destructor. We usually use > NeverDestroyed<> but it does not seem to fit the bill here since we want to > update the pointer and release the previous value.
NeverDestroyed<RetainPtr<>> should work fine for that. Despite its name, assigning something to such a variable would update the pointer and release the previous value. That’s *assigning*, not *destroying*.
Chris Dumez
Comment 6
2021-02-16 09:39:24 PST
(In reply to Darin Adler from
comment #5
)
> (In reply to Chris Dumez from
comment #4
) > > additionalWebPlugInPaths is a global static. If I use a RetainPtr<> then the > > compiler complains about having an exit-time destructor. We usually use > > NeverDestroyed<> but it does not seem to fit the bill here since we want to > > update the pointer and release the previous value. > > NeverDestroyed<RetainPtr<>> should work fine for that. Despite its name, > assigning something to such a variable would update the pointer and release > the previous value. That’s *assigning*, not *destroying*.
Hmm. I did not see an operator=() in NeverDestroyed<>.
Darin Adler
Comment 7
2021-02-16 09:47:41 PST
You have to write .get() on the left side of the "=" operator. Adding operator= to NeverDestroyed would eliminate the need to write .get().
Chris Dumez
Comment 8
2021-02-16 10:00:34 PST
Created
attachment 420484
[details]
Patch
Chris Dumez
Comment 9
2021-02-16 10:06:57 PST
Created
attachment 420487
[details]
Patch
EWS
Comment 10
2021-02-16 11:26:55 PST
Committed
r272919
: <
https://commits.webkit.org/r272919
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 420487
[details]
.
Radar WebKit Bug Importer
Comment 11
2021-02-16 11:27:21 PST
<
rdar://problem/74399599
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug