Title: [287230] trunk/Source/WebCore
- Revision
- 287230
- Author
- [email protected]
- Date
- 2021-12-18 13:34:02 -0800 (Sat, 18 Dec 2021)
Log Message
Use smart pointers for WebCoreNSURLSessionDataTask ObjC members
https://bugs.webkit.org/show_bug.cgi?id=234477
<rdar://79224869>
Patch by Alex Christensen <[email protected]> on 2021-12-18
Reviewed by Brady Eidson.
Seems like a smart thing to do.
* platform/network/cocoa/WebCoreNSURLSession.h:
* platform/network/cocoa/WebCoreNSURLSession.mm:
(-[WebCoreNSURLSessionDataTask originalRequest]):
(-[WebCoreNSURLSessionDataTask setOriginalRequest:]):
(-[WebCoreNSURLSessionDataTask currentRequest]):
(-[WebCoreNSURLSessionDataTask setCurrentRequest:]):
(-[WebCoreNSURLSessionDataTask error]):
(-[WebCoreNSURLSessionDataTask setError:]):
(-[WebCoreNSURLSessionDataTask taskDescription]):
(-[WebCoreNSURLSessionDataTask setTaskDescription:]):
(-[WebCoreNSURLSessionDataTask dealloc]):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (287229 => 287230)
--- trunk/Source/WebCore/ChangeLog 2021-12-18 20:30:27 UTC (rev 287229)
+++ trunk/Source/WebCore/ChangeLog 2021-12-18 21:34:02 UTC (rev 287230)
@@ -1,3 +1,25 @@
+2021-12-18 Alex Christensen <[email protected]>
+
+ Use smart pointers for WebCoreNSURLSessionDataTask ObjC members
+ https://bugs.webkit.org/show_bug.cgi?id=234477
+ <rdar://79224869>
+
+ Reviewed by Brady Eidson.
+
+ Seems like a smart thing to do.
+
+ * platform/network/cocoa/WebCoreNSURLSession.h:
+ * platform/network/cocoa/WebCoreNSURLSession.mm:
+ (-[WebCoreNSURLSessionDataTask originalRequest]):
+ (-[WebCoreNSURLSessionDataTask setOriginalRequest:]):
+ (-[WebCoreNSURLSessionDataTask currentRequest]):
+ (-[WebCoreNSURLSessionDataTask setCurrentRequest:]):
+ (-[WebCoreNSURLSessionDataTask error]):
+ (-[WebCoreNSURLSessionDataTask setError:]):
+ (-[WebCoreNSURLSessionDataTask taskDescription]):
+ (-[WebCoreNSURLSessionDataTask setTaskDescription:]):
+ (-[WebCoreNSURLSessionDataTask dealloc]):
+
2021-12-17 Simon Fraser <[email protected]>
Read the default value of the ScrollAnimatorEnabled setting from NSUserDefaults
Modified: trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h (287229 => 287230)
--- trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h 2021-12-18 20:30:27 UTC (rev 287229)
+++ trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h 2021-12-18 21:34:02 UTC (rev 287230)
@@ -125,29 +125,29 @@
RefPtr<WebCore::PlatformMediaResource> _resource;
RetainPtr<NSURLResponse> _response;
NSUInteger _taskIdentifier;
- NSURLRequest *_originalRequest;
- NSURLRequest *_currentRequest;
+ RetainPtr<NSURLRequest> _originalRequest;
+ RetainPtr<NSURLRequest> _currentRequest;
int64_t _countOfBytesReceived;
int64_t _countOfBytesSent;
int64_t _countOfBytesExpectedToSend;
int64_t _countOfBytesExpectedToReceive;
NSURLSessionTaskState _state;
- NSError *_error;
- NSString *_taskDescription;
+ RetainPtr<NSError> _error;
+ RetainPtr<NSString> _taskDescription;
float _priority;
}
@property NSUInteger taskIdentifier;
-@property (copy) NSURLRequest *originalRequest;
-@property (copy) NSURLRequest *currentRequest;
-@property (readonly, copy) NSURLResponse *response;
+@property (nullable, readonly, copy) NSURLRequest *originalRequest;
+@property (nullable, readonly, copy) NSURLRequest *currentRequest;
+@property (nullable, readonly, copy) NSURLResponse *response;
@property (assign, atomic) int64_t countOfBytesReceived;
@property int64_t countOfBytesSent;
@property int64_t countOfBytesExpectedToSend;
@property int64_t countOfBytesExpectedToReceive;
@property NSURLSessionTaskState state;
-@property (copy) NSError *error;
-@property (copy) NSString *taskDescription;
+@property (nullable, readonly, copy) NSError *error;
+@property (nullable, copy) NSString *taskDescription;
@property float priority;
- (void)cancel;
- (void)suspend;
Modified: trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm (287229 => 287230)
--- trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm 2021-12-18 20:30:27 UTC (rev 287229)
+++ trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm 2021-12-18 21:34:02 UTC (rev 287230)
@@ -721,7 +721,7 @@
request = mutableRequest.get();
}
- self.originalRequest = self.currentRequest = request;
+ self->_originalRequest = self->_currentRequest = request;
return self;
}
@@ -770,17 +770,38 @@
#pragma mark - NSURLSession API
@synthesize taskIdentifier = _taskIdentifier;
-@synthesize originalRequest = _originalRequest;
-@synthesize currentRequest = _currentRequest;
@synthesize countOfBytesReceived = _countOfBytesReceived;
@synthesize countOfBytesSent = _countOfBytesSent;
@synthesize countOfBytesExpectedToSend = _countOfBytesExpectedToSend;
@synthesize countOfBytesExpectedToReceive = _countOfBytesExpectedToReceive;
@synthesize state = _state;
-@synthesize error = _error;
-@synthesize taskDescription = _taskDescription;
@synthesize priority = _priority;
+- (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]);
+}
+
- (WebCoreNSURLSession *)session
{
return _session.get().get();
@@ -831,11 +852,6 @@
- (void)dealloc
{
- [_originalRequest release];
- [_currentRequest release];
- [_error release];
- [_taskDescription release];
-
if (!isMainThread() && _resource) {
if (auto* client = _resource->client())
static_cast<WebCoreNSURLSessionDataTaskClient*>(client)->clearTask();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes