Bug 1348053 - add the UrgentStart flag to the channel when the loading is initiated by a user interaction for quicker network response. r=cpearce
MozReview-Commit-ID: 1tk9k8u1zTu
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIClassOfService.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsSize.h"
|
||||
@@ -1159,6 +1160,12 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIClassOfService> cos;
|
||||
if (aElement->mUseUrgentStartForChannel &&
|
||||
(cos = do_QueryInterface(channel))) {
|
||||
cos->AddClassFlags(nsIClassOfService::UrgentStart);
|
||||
}
|
||||
|
||||
// The listener holds a strong reference to us. This creates a
|
||||
// reference cycle, once we've set mChannel, which is manually broken
|
||||
// in the listener's OnStartRequest method after it is finished with
|
||||
@@ -3891,6 +3898,14 @@ HTMLMediaElement::PlayInternal(ErrorResult& aRv)
|
||||
// Play was not blocked so assume user interacted with the element.
|
||||
mHasUserInteraction = true;
|
||||
|
||||
if (mPreloadAction == HTMLMediaElement::PRELOAD_NONE) {
|
||||
// The media load algorithm will be initiated by a user interaction.
|
||||
// We want to boost the channel priority for better responsiveness.
|
||||
// Note this must be done before UpdatePreloadAction() which will
|
||||
// update |mPreloadAction|.
|
||||
mUseUrgentStartForChannel = true;
|
||||
}
|
||||
|
||||
StopSuspendingAfterFirstFrame();
|
||||
SetPlayedOrSeeked(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user