summaryrefslogtreecommitdiffstats
path: root/netwerk/protocol/http/nsHttpHandler.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /netwerk/protocol/http/nsHttpHandler.cpp
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/protocol/http/nsHttpHandler.cpp')
-rw-r--r--netwerk/protocol/http/nsHttpHandler.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp
index 4861b45466..b6440c88b5 100644
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -714,6 +714,34 @@ nsresult nsHttpHandler::GenerateHostPort(const nsCString& host, int32_t port,
return NS_GenerateHostPort(host, port, hostLine);
}
+// static
+uint8_t nsHttpHandler::UrgencyFromCoSFlags(uint32_t cos) {
+ uint8_t urgency;
+ if (cos & nsIClassOfService::UrgentStart) {
+ // coming from an user interaction => response should be the highest
+ // priority
+ urgency = 1;
+ } else if (cos & nsIClassOfService::Leader) {
+ // main html document normal priority
+ urgency = 2;
+ } else if (cos & nsIClassOfService::Unblocked) {
+ urgency = 3;
+ } else if (cos & nsIClassOfService::Follower) {
+ urgency = 4;
+ } else if (cos & nsIClassOfService::Speculative) {
+ urgency = 6;
+ } else if (cos & nsIClassOfService::Background) {
+ // background tasks can be deprioritzed to the lowest priority
+ urgency = 6;
+ } else if (cos & nsIClassOfService::Tail) {
+ urgency = 6;
+ } else {
+ // all others get a lower priority than the main html document
+ urgency = 4;
+ }
+ return urgency;
+}
+
//-----------------------------------------------------------------------------
// nsHttpHandler <private>
//-----------------------------------------------------------------------------