Title: [264054] trunk/Source/WebCore
- Revision
- 264054
- Author
- [email protected]
- Date
- 2020-07-07 18:56:20 -0700 (Tue, 07 Jul 2020)
Log Message
Allow WebCoreNSURLSession sendH2Ping:pongHandler: to be called from any thread like the rest of WebCoreNSURLSession methods
https://bugs.webkit.org/show_bug.cgi?id=214065
Patch by Alex Christensen <[email protected]> on 2020-07-07
Reviewed by Jer Noble.
Otherwise horrible crashes happen.
The WebCore function calls and loading IPC calls need to happen on the main thread,
and the callback should happen on the NSOperationQueue given when constructing the WebCoreNSURLSession.
* platform/network/cocoa/WebCoreNSURLSession.mm:
(-[WebCoreNSURLSession sendH2Ping:pongHandler:]):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (264053 => 264054)
--- trunk/Source/WebCore/ChangeLog 2020-07-08 01:14:17 UTC (rev 264053)
+++ trunk/Source/WebCore/ChangeLog 2020-07-08 01:56:20 UTC (rev 264054)
@@ -1,3 +1,17 @@
+2020-07-07 Alex Christensen <[email protected]>
+
+ Allow WebCoreNSURLSession sendH2Ping:pongHandler: to be called from any thread like the rest of WebCoreNSURLSession methods
+ https://bugs.webkit.org/show_bug.cgi?id=214065
+
+ Reviewed by Jer Noble.
+
+ Otherwise horrible crashes happen.
+ The WebCore function calls and loading IPC calls need to happen on the main thread,
+ and the callback should happen on the NSOperationQueue given when constructing the WebCoreNSURLSession.
+
+ * platform/network/cocoa/WebCoreNSURLSession.mm:
+ (-[WebCoreNSURLSession sendH2Ping:pongHandler:]):
+
2020-07-07 Sam Weinig <[email protected]>
Part 2 of SimpleColor and SRGBA<uint8_t> are essentially the same - let's converge them
Modified: trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm (264053 => 264054)
--- trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm 2020-07-08 01:14:17 UTC (rev 264053)
+++ trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm 2020-07-08 01:56:20 UTC (rev 264054)
@@ -468,14 +468,22 @@
- (void)sendH2Ping:(NSURL *)url pongHandler:(void (^)(NSError *error, NSTimeInterval interval))pongHandler
{
- if (_invalidated)
- return pongHandler(adoptNS([[NSError alloc] initWithDomain:NSURLErrorDomain code:NSURLErrorUnknown userInfo:nil]).get(), 0);
+ callOnMainThread([self, strongSelf = retainPtr(self), url = "" pongHandler = makeBlockPtr(pongHandler)] () mutable {
- self.loader.sendH2Ping(url, [pongHandler = makeBlockPtr(pongHandler)] (Expected<Seconds, ResourceError>&& result) {
- if (result)
- pongHandler(nil, result.value().value());
- else
- pongHandler(result.error(), 0);
+ if (_invalidated)
+ return pongHandler(adoptNS([[NSError alloc] initWithDomain:NSURLErrorDomain code:NSURLErrorUnknown userInfo:nil]).get(), 0);
+
+ self.loader.sendH2Ping(url.get(), [self, strongSelf = WTFMove(strongSelf), pongHandler = WTFMove(pongHandler)] (Expected<Seconds, ResourceError>&& result) mutable {
+ NSTimeInterval interval = 0;
+ RetainPtr<NSError> error;
+ if (result)
+ interval = result.value().value();
+ else
+ error = result.error();
+ [self addDelegateOperation:[pongHandler = WTFMove(pongHandler), error = WTFMove(error), interval] {
+ pongHandler(error.get(), interval);
+ }];
+ });
});
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes