Bug 1377205 - Functionality to explicitly disallow throttle of HTTP responses. r=hurley
authorHonza Bambas <honzab.moz@firemni.cz>
Tue, 01 Aug 2017 13:01:00 -0400
changeset 372459 61faef4994ac9acbe248ad4b22dc18db0faca721
parent 372458 2dfcfd0eb52d09d6e92b6a02394e61d9b449ac8b
child 372460 4047292ad65cb5e0255b80cb971aac0505855402
push id32275
push userkwierso@gmail.com
push dateThu, 03 Aug 2017 00:12:02 +0000
treeherdermozilla-central@6f1914a4f241 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershurley
bugs1377205
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1377205 - Functionality to explicitly disallow throttle of HTTP responses. r=hurley
netwerk/base/nsIClassOfService.idl
netwerk/protocol/http/nsHttpTransaction.cpp
--- a/netwerk/base/nsIClassOfService.idl
+++ b/netwerk/base/nsIClassOfService.idl
@@ -39,9 +39,10 @@ interface nsIClassOfService : nsISupport
 
   const unsigned long Leader = 1 << 0;
   const unsigned long Follower = 1 << 1;
   const unsigned long Speculative = 1 << 2;
   const unsigned long Background = 1 << 3;
   const unsigned long Unblocked = 1 << 4;
   const unsigned long Throttleable = 1 << 5;
   const unsigned long UrgentStart = 1 << 6;
+  const unsigned long DontThrottle = 1 << 7;
 };
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -171,16 +171,17 @@ void nsHttpTransaction::ResumeReading()
             LOG(("  resume failed with rv=%" PRIx32, static_cast<uint32_t>(rv)));
         }
     }
 }
 
 bool nsHttpTransaction::EligibleForThrottling()
 {
   return (mClassOfService & (nsIClassOfService::Throttleable |
+                             nsIClassOfService::DontThrottle |
                              nsIClassOfService::Leader |
                              nsIClassOfService::Unblocked)) ==
     nsIClassOfService::Throttleable;
 }
 
 void nsHttpTransaction::SetClassOfService(uint32_t cos)
 {
     bool wasThrottling = EligibleForThrottling();
@@ -839,16 +840,20 @@ bool nsHttpTransaction::ShouldStopReadin
 {
     if (mActivatedAsH2) {
         // Throttling feature is now disabled for http/2 transactions
         // because of bug 1367861.  The logic around mActivatedAsH2
         // will be removed when that is fixed
         return false;
     }
 
+    if (mClassOfService & nsIClassOfService::DontThrottle) {
+        return false;
+    }
+
     if (!gHttpHandler->ConnMgr()->ShouldStopReading(this, EligibleForThrottling())) {
         // We are not obligated to throttle
         return false;
     }
 
     if (mContentRead < 16000) {
         // Let the first bytes go, it may also well be all the content we get
         LOG(("nsHttpTransaction::ShouldStopReading too few content (%" PRIi64 ") this=%p", mContentRead, this));