Title: [213354] trunk/Source/WebKit2
- Revision
- 213354
- Author
- [email protected]
- Date
- 2017-03-02 22:10:27 -0800 (Thu, 02 Mar 2017)
Log Message
[Mac] Set the NSURLSessionTask priority to match the request's priority
https://bugs.webkit.org/show_bug.cgi?id=169115
<rdar://problem/28881392>
Patch by Joseph Pecoraro <[email protected]> on 2017-03-02
Reviewed by Alex Christensen.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::toNSURLSessionTaskPriority):
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
Set the priority on the task based on the ResourceRequest's priority.
This is used for HTTP/2 request prioritization.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (213353 => 213354)
--- trunk/Source/WebKit2/ChangeLog 2017-03-03 05:53:34 UTC (rev 213353)
+++ trunk/Source/WebKit2/ChangeLog 2017-03-03 06:10:27 UTC (rev 213354)
@@ -1,3 +1,17 @@
+2017-03-02 Joseph Pecoraro <[email protected]>
+
+ [Mac] Set the NSURLSessionTask priority to match the request's priority
+ https://bugs.webkit.org/show_bug.cgi?id=169115
+ <rdar://problem/28881392>
+
+ Reviewed by Alex Christensen.
+
+ * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+ (WebKit::toNSURLSessionTaskPriority):
+ (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
+ Set the priority on the task based on the ResourceRequest's priority.
+ This is used for HTTP/2 request prioritization.
+
2017-03-02 Mark Lam <[email protected]>
Add WebKit2 hooks to notify the VM that the user has requested a debugger break.
Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (213353 => 213354)
--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2017-03-03 05:53:34 UTC (rev 213353)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2017-03-03 06:10:27 UTC (rev 213354)
@@ -46,6 +46,7 @@
#import <wtf/text/Base64.h>
namespace WebKit {
+
#if USE(CREDENTIAL_STORAGE_WITH_NETWORK_SESSION)
static void applyBasicAuthorizationHeader(WebCore::ResourceRequest& request, const WebCore::Credential& credential)
{
@@ -54,6 +55,25 @@
}
#endif
+static float toNSURLSessionTaskPriority(WebCore::ResourceLoadPriority priority)
+{
+ switch (priority) {
+ case WebCore::ResourceLoadPriority::VeryLow:
+ return 0;
+ case WebCore::ResourceLoadPriority::Low:
+ return 0.25;
+ case WebCore::ResourceLoadPriority::Medium:
+ return 0.5;
+ case WebCore::ResourceLoadPriority::High:
+ return 0.75;
+ case WebCore::ResourceLoadPriority::VeryHigh:
+ return 1;
+ }
+
+ ASSERT_NOT_REACHED();
+ return NSURLSessionTaskPriorityDefault;
+}
+
NetworkDataTaskCocoa::NetworkDataTaskCocoa(NetworkSession& session, NetworkDataTaskClient& client, const WebCore::ResourceRequest& requestWithCredentials, WebCore::StoredCredentials storedCredentials, WebCore::ContentSniffingPolicy shouldContentSniff, bool shouldClearReferrerOnHTTPSToHTTPRedirect)
: NetworkDataTask(session, client, requestWithCredentials, storedCredentials, shouldClearReferrerOnHTTPSToHTTPRedirect)
{
@@ -107,6 +127,9 @@
if (!storagePartition.isEmpty())
m_task.get()._storagePartitionIdentifier = storagePartition;
#endif
+
+ if (WebCore::ResourceRequest::resourcePrioritiesEnabled())
+ m_task.get().priority = toNSURLSessionTaskPriority(request.priority());
}
NetworkDataTaskCocoa::~NetworkDataTaskCocoa()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes