Bug 1429979 Part 3 - Use nsClassHashtable::Get() which directly returns the value. r=heycam
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 11 Jan 2018 18:08:51 +0800
changeset 450771 4a9f600f565806c895708e43ffda1baa8d5888fc
parent 450770 0cef7b376e37af3c31efce8323fd3aa52e710c1b
child 450772 914fce4a03e31172958705299a83128633911d48
push id8543
push userryanvm@gmail.com
push dateTue, 16 Jan 2018 14:33:22 +0000
treeherdermozilla-beta@a6525ed16a32 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1429979
milestone59.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 1429979 Part 3 - Use nsClassHashtable::Get() which directly returns the value. r=heycam MozReview-Commit-ID: 7yVbVxMqEde
layout/style/ImageLoader.cpp
--- a/layout/style/ImageLoader.cpp
+++ b/layout/style/ImageLoader.cpp
@@ -428,18 +428,18 @@ ImageLoader::OnSizeAvailable(imgIRequest
 {
   nsPresContext* presContext = GetPresContext();
   if (!presContext) {
     return NS_OK;
   }
 
   aImage->SetAnimationMode(presContext->ImageAnimationMode());
 
-  FrameSet* frameSet = nullptr;
-  if (!mRequestToFrameMap.Get(aRequest, &frameSet)) {
+  FrameSet* frameSet = mRequestToFrameMap.Get(aRequest);
+  if (!frameSet) {
     return NS_OK;
   }
 
   for (nsIFrame* frame : *frameSet) {
     if (frame->StyleVisibility()->IsVisible()) {
       frame->MarkNeedsDisplayItemRebuild();
     }
   }
@@ -449,18 +449,18 @@ ImageLoader::OnSizeAvailable(imgIRequest
 
 nsresult
 ImageLoader::OnImageIsAnimated(imgIRequest* aRequest)
 {
   if (!mDocument) {
     return NS_OK;
   }
 
-  FrameSet* frameSet = nullptr;
-  if (!mRequestToFrameMap.Get(aRequest, &frameSet)) {
+  FrameSet* frameSet = mRequestToFrameMap.Get(aRequest);
+  if (!frameSet) {
     return NS_OK;
   }
 
   // Register with the refresh driver now that we are aware that
   // we are animated.
   nsPresContext* presContext = GetPresContext();
   if (presContext) {
     nsLayoutUtils::RegisterImageRequest(presContext,
@@ -473,45 +473,41 @@ ImageLoader::OnImageIsAnimated(imgIReque
 
 nsresult
 ImageLoader::OnFrameComplete(imgIRequest* aRequest)
 {
   if (!mDocument || mInClone) {
     return NS_OK;
   }
 
-  FrameSet* frameSet = nullptr;
-  if (!mRequestToFrameMap.Get(aRequest, &frameSet)) {
+  FrameSet* frameSet = mRequestToFrameMap.Get(aRequest);
+  if (!frameSet) {
     return NS_OK;
   }
 
-  NS_ASSERTION(frameSet, "This should never be null!");
-
   // Since we just finished decoding a frame, we always want to paint, in case
   // we're now able to paint an image that we couldn't paint before (and hence
   // that we don't have retained data for).
   DoRedraw(frameSet, /* aForcePaint = */ true);
 
   return NS_OK;
 }
 
 nsresult
 ImageLoader::OnFrameUpdate(imgIRequest* aRequest)
 {
   if (!mDocument || mInClone) {
     return NS_OK;
   }
 
-  FrameSet* frameSet = nullptr;
-  if (!mRequestToFrameMap.Get(aRequest, &frameSet)) {
+  FrameSet* frameSet = mRequestToFrameMap.Get(aRequest);
+  if (!frameSet) {
     return NS_OK;
   }
 
-  NS_ASSERTION(frameSet, "This should never be null!");
-
   DoRedraw(frameSet, /* aForcePaint = */ false);
 
   return NS_OK;
 }
 
 void
 ImageLoader::FlushUseCounters()
 {