Bug 234477 - Use smart pointers for WebCoreNSURLSessionDataTask ObjC members
Summary: Use smart pointers for WebCoreNSURLSessionDataTask ObjC members
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-12-18 09:23 PST by Alex Christensen
Modified: 2021-12-19 15:53 PST (History)
3 users (show)

See Also:


Attachments
Patch (4.51 KB, patch)
2021-12-18 09:24 PST, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (5.50 KB, patch)
2021-12-18 12:45 PST, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2021-12-18 09:23:45 PST
Use smart pointers for WebCoreNSURLSessionDataTask ObjC members
Comment 1 Alex Christensen 2021-12-18 09:24:16 PST
Created attachment 447521 [details]
Patch
Comment 2 Alex Christensen 2021-12-18 09:24:20 PST
<rdar://problem/79224869>
Comment 3 Alex Christensen 2021-12-18 12:44:43 PST
These properties are marked as (copy).  Will do copying and autoreleasing.
Comment 4 Alex Christensen 2021-12-18 12:45:07 PST
Created attachment 447528 [details]
Patch
Comment 5 EWS 2021-12-18 13:35:17 PST
Committed r287230 (245391@main): <https://commits.webkit.org/245391@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 447528 [details].
Comment 6 Darin Adler 2021-12-19 15:53:16 PST
Comment on attachment 447528 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=447528&action=review

> Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm:803
> +- (NSURLRequest *)originalRequest
> +{
> +    return adoptNS([_originalRequest copy]).autorelease();
> +}
> +
> +- (NSURLRequest *)currentRequest
> +{
> +    return adoptNS([_currentRequest copy]).autorelease();
> +}
> +
> +- (NSError *)error
> +{
> +    return adoptNS([_error copy]).autorelease();
> +}
> +
> +- (NSString *)taskDescription
> +{
> +    return adoptNS([_taskDescription copy]).autorelease();
> +}
> +
> +- (void)setTaskDescription:(NSString *)description
> +{
> +    _taskDescription = adoptNS([description copy]);
> +}

Was the old code doing these copies and autoreleases? It’s not a given that they must be done just because a smart pointer is involved. They might be good changes in their own right, but need to explain why typically.