Bug 1359833 - Part 7. nsImageLoadingContent native observers should use the new API. r=tnikkel
authorAndrew Osmond <aosmond@mozilla.com>
Wed, 19 Jul 2017 14:15:12 -0400
changeset 418440 e1c0cf283703be49353269ce24d5806968204bdd
parent 418439 deb1ed01ba9dfe85efdcb7c9af97478f24c87e65
child 418441 b63d906a88b55c62d0fe3eafc09a5a0c1da3bc03
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1359833
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 1359833 - Part 7. nsImageLoadingContent native observers should use the new API. r=tnikkel
dom/html/ImageDocument.cpp
layout/generic/nsImageFrame.cpp
layout/svg/nsSVGImageFrame.cpp
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -116,17 +116,17 @@ ImageListener::OnStartRequest(nsIRequest
     request->Cancel(NS_ERROR_CONTENT_BLOCKED);
     return NS_OK;
   }
 
   if (!imgDoc->mObservingImageLoader) {
     nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(imgDoc->mImageContent);
     NS_ENSURE_TRUE(imageLoader, NS_ERROR_UNEXPECTED);
 
-    imageLoader->AddObserver(imgDoc);
+    imageLoader->AddNativeObserver(imgDoc);
     imgDoc->mObservingImageLoader = true;
     imageLoader->LoadImageWithChannel(channel, getter_AddRefs(mNextStream));
   }
 
   return MediaDocumentStreamListener::OnStartRequest(request, ctxt);
 }
 
 NS_IMETHODIMP
@@ -227,17 +227,17 @@ ImageDocument::Destroy()
     nsCOMPtr<EventTarget> target = do_QueryInterface(mImageContent);
     target->RemoveEventListener(NS_LITERAL_STRING("load"), this, false);
     target->RemoveEventListener(NS_LITERAL_STRING("click"), this, false);
 
     // Break reference cycle with mImageContent, if we have one
     if (mObservingImageLoader) {
       nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mImageContent);
       if (imageLoader) {
-        imageLoader->RemoveObserver(this);
+        imageLoader->RemoveNativeObserver(this);
       }
     }
 
     mImageContent = nullptr;
   }
 
   MediaDocument::Destroy();
 }
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -207,17 +207,17 @@ nsImageFrame::DestroyFrom(nsIFrame* aDes
   // set the frame to null so we don't send messages to a dead object.
   if (mListener) {
     nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
     if (imageLoader) {
       // Notify our image loading content that we are going away so it can
       // deregister with our refresh driver.
       imageLoader->FrameDestroyed(this);
 
-      imageLoader->RemoveObserver(mListener);
+      imageLoader->RemoveNativeObserver(mListener);
     }
 
     reinterpret_cast<nsImageListener*>(mListener.get())->SetFrame(nullptr);
   }
 
   mListener = nullptr;
 
   // If we were displaying an icon, take ourselves off the list
@@ -264,17 +264,17 @@ nsImageFrame::Init(nsIContent*       aCo
 
   mListener = new nsImageListener(this);
 
   nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(aContent);
   if (!imageLoader) {
     MOZ_CRASH("Why do we have an nsImageFrame here at all?");
   }
 
-  imageLoader->AddObserver(mListener);
+  imageLoader->AddNativeObserver(mListener);
 
   nsPresContext *aPresContext = PresContext();
 
   if (!gIconLoad)
     LoadIcons(aPresContext);
 
   // We have a PresContext now, so we need to notify the image content node
   // that it can register images.
--- a/layout/svg/nsSVGImageFrame.cpp
+++ b/layout/svg/nsSVGImageFrame.cpp
@@ -46,17 +46,17 @@ NS_NewSVGImageFrame(nsIPresShell* aPresS
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGImageFrame)
 
 nsSVGImageFrame::~nsSVGImageFrame()
 {
   // set the frame to null so we don't send messages to a dead object.
   if (mListener) {
     nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
     if (imageLoader) {
-      imageLoader->RemoveObserver(mListener);
+      imageLoader->RemoveNativeObserver(mListener);
     }
     reinterpret_cast<nsSVGImageListener*>(mListener.get())->SetFrame(nullptr);
   }
   mListener = nullptr;
 }
 
 void
 nsSVGImageFrame::Init(nsIContent*       aContent,
@@ -85,17 +85,17 @@ nsSVGImageFrame::Init(nsIContent*       
   if (!imageLoader) {
     MOZ_CRASH("Why is this not an image loading content?");
   }
 
   // We should have a PresContext now, so let's notify our image loader that
   // we need to register any image animations with the refresh driver.
   imageLoader->FrameCreated(this);
 
-  imageLoader->AddObserver(mListener);
+  imageLoader->AddNativeObserver(mListener);
 }
 
 /* virtual */ void
 nsSVGImageFrame::DestroyFrom(nsIFrame* aDestructRoot)
 {
   if (GetStateBits() & NS_FRAME_IS_NONDISPLAY) {
     DecApproximateVisibleCount();
   }