WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 222439
Reduce explicit usage of [objC retain] in WebKit
https://bugs.webkit.org/show_bug.cgi?id=222439
Summary
Reduce explicit usage of [objC retain] in WebKit
Chris Dumez
Reported
2021-02-25 14:35:19 PST
Reduce explicit usage of [objC retain] in WebKit.
Attachments
Patch
(74.37 KB, patch)
2021-02-25 15:57 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(74.60 KB, patch)
2021-02-25 19:08 PST
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(74.81 KB, patch)
2021-02-25 19:20 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(74.81 KB, patch)
2021-02-25 19:22 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(83.71 KB, patch)
2021-02-26 15:31 PST
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(83.92 KB, patch)
2021-02-26 15:54 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2021-02-25 15:57:17 PST
Created
attachment 421580
[details]
Patch
Darin Adler
Comment 2
2021-02-25 16:18:23 PST
Comment on
attachment 421580
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=421580&action=review
I did not manage to spot the pattern for when you chose to use auto/retainPtr
> Source/WebCore/platform/ios/WebCoreMotionManager.mm:182 > + if (!m_updateTimer) > + m_updateTimer = [NSTimer scheduledTimerWithTimeInterval:kMotionUpdateInterval target:self selector:@selector(update) userInfo:nil repeats:YES];
Looks like you fixed a leak here. Maybe land this separately?
> Source/WebCore/platform/ios/wak/WebCoreThread.mm:219 > +static void SendDelegateMessage(RetainPtr<NSInvocation> invocation)
Why not RetainPtr&&?
Chris Dumez
Comment 3
2021-02-25 16:24:10 PST
(In reply to Darin Adler from
comment #2
)
> Comment on
attachment 421580
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=421580&action=review
> > I did not manage to spot the pattern for when you chose to use auto/retainPtr > > > Source/WebCore/platform/ios/WebCoreMotionManager.mm:182 > > + if (!m_updateTimer) > > + m_updateTimer = [NSTimer scheduledTimerWithTimeInterval:kMotionUpdateInterval target:self selector:@selector(update) userInfo:nil repeats:YES]; > > Looks like you fixed a leak here. Maybe land this separately?
A lot of my RetainPtr patches fixed leaks or over-releases. I usually have not split those into separate patches but I can if you feel this is better.
> > > Source/WebCore/platform/ios/wak/WebCoreThread.mm:219 > > +static void SendDelegateMessage(RetainPtr<NSInvocation> invocation) > > Why not RetainPtr&&?
I'll update.
Darin Adler
Comment 4
2021-02-25 16:28:50 PST
Comment on
attachment 421580
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=421580&action=review
>>> Source/WebCore/platform/ios/WebCoreMotionManager.mm:182 >>> + m_updateTimer = [NSTimer scheduledTimerWithTimeInterval:kMotionUpdateInterval target:self selector:@selector(update) userInfo:nil repeats:YES]; >> >> Looks like you fixed a leak here. Maybe land this separately? > > A lot of my RetainPtr patches fixed leaks or over-releases. I usually have not split those into separate patches but I can if you feel this is better.
I don’t feel strongly. Generally I like the idea of separating bug fixes from refactoring, even if we discover the bug fixes while refactoring.
Chris Dumez
Comment 5
2021-02-25 16:29:55 PST
(In reply to Darin Adler from
comment #4
)
> Comment on
attachment 421580
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=421580&action=review
> > >>> Source/WebCore/platform/ios/WebCoreMotionManager.mm:182 > >>> + m_updateTimer = [NSTimer scheduledTimerWithTimeInterval:kMotionUpdateInterval target:self selector:@selector(update) userInfo:nil repeats:YES]; > >> > >> Looks like you fixed a leak here. Maybe land this separately? > > > > A lot of my RetainPtr patches fixed leaks or over-releases. I usually have not split those into separate patches but I can if you feel this is better. > > I don’t feel strongly. > > Generally I like the idea of separating bug fixes from refactoring, even if > we discover the bug fixes while refactoring.
The whole point of this refactoring is to find & fix those bugs though :)
Chris Dumez
Comment 6
2021-02-25 19:08:05 PST
Created
attachment 421596
[details]
Patch
Chris Dumez
Comment 7
2021-02-25 19:20:56 PST
Created
attachment 421598
[details]
Patch
Chris Dumez
Comment 8
2021-02-25 19:22:19 PST
Created
attachment 421599
[details]
Patch
Darin Adler
Comment 9
2021-02-26 13:35:25 PST
Comment on
attachment 421599
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=421599&action=review
> Tools/DumpRenderTree/mac/DumpRenderTree.mm:286 > + static RetainPtr<NSSet> fontFamilySet = [NSSet setWithObjects:
Why not use NeverDestroyed here? I know we don’t have this project set up to fail to build if we have exit-time destructors, but such destructors still aren’t desirable. Same for all the other globals. Otherwise, this patch adds a lot of exit time code to DumpRenderTree and other tools; the code is cleaner without NeverDestroyed, but the binary is a tiny bit bigger and exit might even be a little bit slower. The old code we are replacing did not release these objects on exit.
Chris Dumez
Comment 10
2021-02-26 15:31:58 PST
Created
attachment 421714
[details]
Patch
Chris Dumez
Comment 11
2021-02-26 15:32:56 PST
(In reply to Darin Adler from
comment #9
)
> Comment on
attachment 421599
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=421599&action=review
> > > Tools/DumpRenderTree/mac/DumpRenderTree.mm:286 > > + static RetainPtr<NSSet> fontFamilySet = [NSSet setWithObjects: > > Why not use NeverDestroyed here? I know we don’t have this project set up to > fail to build if we have exit-time destructors, but such destructors still > aren’t desirable. Same for all the other globals. Otherwise, this patch adds > a lot of exit time code to DumpRenderTree and other tools; the code is > cleaner without NeverDestroyed, but the binary is a tiny bit bigger and exit > might even be a little bit slower. > > The old code we are replacing did not release these objects on exit.
I figured it may not be worth the trouble for testing code but I updated the patch as suggested.
Chris Dumez
Comment 12
2021-02-26 15:54:15 PST
Created
attachment 421721
[details]
Patch
EWS
Comment 13
2021-02-26 17:55:01 PST
Committed
r273610
: <
https://commits.webkit.org/r273610
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 421721
[details]
.
Radar WebKit Bug Importer
Comment 14
2021-02-26 17:56:16 PST
<
rdar://problem/74816519
>
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