Bug 1357327 - use ImgIRequest.boostPriority for increasing loading priority in nsImageFrame::Init. r=tnikkel
authorShih-Chiang Chien <schien@mozilla.com>
Tue, 18 Apr 2017 16:38:23 +0800
changeset 567059 711e2fc8e48fd8801c3cabe65d6136a1e3aeffb7
parent 567058 6c4cc6a04cc44983c9c2ac19f34318adcb654d72
child 567060 991b591e9bbf611f8d01a0c1864155ea79aa6739
push id55429
push userbmo:hskupin@gmail.com
push dateMon, 24 Apr 2017 10:48:57 +0000
reviewerstnikkel
bugs1357327
milestone55.0a1
Bug 1357327 - use ImgIRequest.boostPriority for increasing loading priority in nsImageFrame::Init. r=tnikkel MozReview-Commit-ID: IpTZeMzllTZ
layout/generic/nsImageFrame.cpp
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -278,19 +278,20 @@ nsImageFrame::Init(nsIContent*       aCo
   // We have a PresContext now, so we need to notify the image content node
   // that it can register images.
   imageLoader->FrameCreated(this);
 
   // Give image loads associated with an image frame a small priority boost!
   nsCOMPtr<imgIRequest> currentRequest;
   imageLoader->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
                           getter_AddRefs(currentRequest));
-  nsCOMPtr<nsISupportsPriority> p = do_QueryInterface(currentRequest);
-  if (p)
-    p->AdjustPriority(-1);
+
+  if (currentRequest) {
+    currentRequest->BoostPriority(imgIRequest::CATEGORY_FRAME_INIT);
+  }
 }
 
 bool
 nsImageFrame::UpdateIntrinsicSize(imgIContainer* aImage)
 {
   NS_PRECONDITION(aImage, "null image");
   if (!aImage)
     return false;