Bug 1207355 (Part 8) - Remove imgIContainer::RequestDecode() and imgIRequest::RequestDecode(). r=tn
☠☠ backed out by b4c323832f31 ☠ ☠
authorSeth Fowler <mark.seth.fowler@gmail.com>
Wed, 28 Oct 2015 16:40:43 -0700
changeset 270127 aafd6db2fbb452350c42a1d839ce96ec6e183b53
parent 270126 9dd950b837fb0759ac94e33506b0ca375b19d893
child 270128 6f659dd470d83d23024bf1bcc173614cb8a12643
push id29599
push usercbook@mozilla.com
push dateThu, 29 Oct 2015 10:49:48 +0000
treeherdermozilla-central@67a788db9f07 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1207355
milestone44.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 1207355 (Part 8) - Remove imgIContainer::RequestDecode() and imgIRequest::RequestDecode(). r=tn
image/DynamicImage.cpp
image/ImageWrapper.cpp
image/RasterImage.cpp
image/VectorImage.cpp
image/imgIContainer.idl
image/imgIRequest.idl
image/imgLoader.cpp
image/imgRequest.cpp
image/imgRequest.h
image/imgRequestProxy.cpp
image/test/unit/image_load_helpers.js
layout/style/nsStyleStruct.h
--- a/image/DynamicImage.cpp
+++ b/image/DynamicImage.cpp
@@ -242,22 +242,16 @@ DynamicImage::Draw(gfxContext* aContext,
   aContext->Multiply(gfxMatrix::Scaling(scale.width, scale.height));
 
   gfxUtils::DrawPixelSnapped(aContext, mDrawable, drawableSize, region,
                              SurfaceFormat::B8G8R8A8, aFilter);
   return DrawResult::SUCCESS;
 }
 
 NS_IMETHODIMP
-DynamicImage::RequestDecode()
-{
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 DynamicImage::StartDecoding()
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DynamicImage::RequestDecodeForSize(const nsIntSize& aSize, uint32_t aFlags)
 {
--- a/image/ImageWrapper.cpp
+++ b/image/ImageWrapper.cpp
@@ -210,22 +210,16 @@ ImageWrapper::Draw(gfxContext* aContext,
                    const Maybe<SVGImageContext>& aSVGContext,
                    uint32_t aFlags)
 {
   return mInnerImage->Draw(aContext, aSize, aRegion, aWhichFrame,
                            aFilter, aSVGContext, aFlags);
 }
 
 NS_IMETHODIMP
-ImageWrapper::RequestDecode()
-{
-  return mInnerImage->RequestDecode();
-}
-
-NS_IMETHODIMP
 ImageWrapper::StartDecoding()
 {
   return mInnerImage->StartDecoding();
 }
 
 NS_IMETHODIMP
 ImageWrapper::RequestDecodeForSize(const nsIntSize& aSize, uint32_t aFlags)
 {
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -1161,25 +1161,16 @@ RasterImage::Discard()
 }
 
 bool
 RasterImage::CanDiscard() {
   return mHasSourceData &&       // ...have the source data...
          !mAnim;                 // Can never discard animated images
 }
 
-//******************************************************************************
-
-NS_IMETHODIMP
-RasterImage::RequestDecode()
-{
-  return RequestDecodeForSize(mSize, DECODE_FLAGS_DEFAULT);
-}
-
-
 NS_IMETHODIMP
 RasterImage::StartDecoding()
 {
   if (mError) {
     return NS_ERROR_FAILURE;
   }
 
   if (!mHasSize) {
@@ -1794,17 +1785,17 @@ RasterImage::FinalizeDecoder(Decoder* aD
       mLoadProgress = Nothing();
       NotifyProgress(FLAG_ONLOAD_UNBLOCKED);
     }
   }
 
   // If we were a metadata decode and a full decode was requested, do it.
   if (done && wasMetadata && mWantFullDecode) {
     mWantFullDecode = false;
-    RequestDecode();
+    RequestDecodeForSize(mSize, DECODE_FLAGS_DEFAULT);
   }
 }
 
 void
 RasterImage::ReportDecoderError(Decoder* aDecoder)
 {
   nsCOMPtr<nsIConsoleService> consoleService =
     do_GetService(NS_CONSOLESERVICE_CONTRACTID);
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -959,25 +959,16 @@ void
 VectorImage::RecoverFromLossOfSurfaces()
 {
   NS_WARNING("An imgFrame became invalid. Attempting to recover...");
 
   // Discard all existing frames, since they're probably all now invalid.
   SurfaceCache::RemoveImage(ImageKey(this));
 }
 
-//******************************************************************************
-
-NS_IMETHODIMP
-VectorImage::RequestDecode()
-{
-  // Nothing to do for SVG images
-  return NS_OK;
-}
-
 NS_IMETHODIMP
 VectorImage::StartDecoding()
 {
   // Nothing to do for SVG images
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/image/imgIContainer.idl
+++ b/image/imgIContainer.idl
@@ -70,17 +70,17 @@ native nsIntSizeByVal(nsIntSize);
 
 /**
  * imgIContainer is the interface that represents an image. It allows
  * access to frames as Thebes surfaces. It also allows drawing of images
  * onto Thebes contexts.
  *
  * Internally, imgIContainer also manages animation of images.
  */
-[scriptable, builtinclass, uuid(7c795421-a79c-43ac-9e20-6d4e8a9dfb76)]
+[scriptable, builtinclass, uuid(a8dbee24-ff86-4755-b40e-51175caf31af)]
 interface imgIContainer : nsISupports
 {
   /**
    * The width of the container rectangle.  In the case of any error,
    * zero is returned, and an exception will be thrown.
    */
   readonly attribute int32_t width;
 
@@ -378,32 +378,26 @@ interface imgIContainer : nsISupports
        [const] in ImageRegion aRegion,
        in uint32_t aWhichFrame,
        in Filter aFilter,
        [const] in MaybeSVGImageContext aSVGContext,
        in uint32_t aFlags);
 
   /*
    * Ensures that an image is decoding. Calling this function guarantees that
-   * the image will at some point fire off decode notifications. Calling draw()
-   * or getFrame() triggers the same mechanism internally. Thus, if you want to
-   * be sure that the image will be decoded but don't want to access it until
-   * then, you must call requestDecode().
-   */
-  void requestDecode();
-
-  /*
-   * This is equivalent to requestDecode() but it also synchronously decodes
-   * images that can be decoded "quickly" according to some heuristic.
+   * the image will at some point fire off decode notifications. Images that
+   * can be decoded "quickly" according to some heuristic will be decoded
+   * synchronously.
    */
   [noscript] void startDecoding();
 
   /*
-   * This method is equivalent to requestDecode(), but enables the caller to
-   * provide more detailed information about the decode request.
+   * This method triggers decoding for an image, but unlike startDecoding() it
+   * enables the caller to provide more detailed information about the decode
+   * request.
    *
    * @param aSize The size to which the image should be scaled while decoding,
    *              if possible. If the image cannot be scaled to this size while
    *              being decoded, it will be decoded at its intrinsic size.
    * @param aFlags Flags of the FLAG_* variety. Only the decode flags
    *               (FLAG_DECODE_*) and FLAG_SYNC_DECODE (which will
    *               synchronously decode images that can be decoded "quickly",
    *               just like startDecoding() does) are accepted; others will be
--- a/image/imgIRequest.idl
+++ b/image/imgIRequest.idl
@@ -14,17 +14,17 @@ interface nsIPrincipal;
 
 /**
  * imgIRequest interface
  *
  * @author Stuart Parmenter <stuart@mozilla.com>
  * @version 0.1
  * @see imagelib2
  */
-[scriptable, builtinclass, uuid(4cb01f0a-ef94-4345-a8d7-1a93f15ff548)]
+[scriptable, builtinclass, uuid(db0a945c-3883-424a-98d0-2ee0523b0255)]
 interface imgIRequest : nsIRequest
 {
   /**
    * the image container...
    * @return the image object associated with the request.
    * @attention NEED DOCS
    */
   readonly attribute imgIContainer image;
@@ -140,25 +140,24 @@ interface imgIRequest : nsIRequest
    * NOTE: You should not use this in any new code; instead, use cancel(). Note
    * that cancel() is asynchronous, which means that some time after you call
    * it, the listener/observer will get an OnStopRequest(). This means that, if
    * you're the observer, you can't call cancel() from your destructor.
    */
   void cancelAndForgetObserver(in nsresult aStatus);
 
   /**
-   * Requests a decode for the image.
+   * Requests a synchronous decode for the image.
    *
-   * imgIContainer has a requestDecode() method, but callers may want to request
+   * imgIContainer has a startDecoding() method, but callers may want to request
    * a decode before the container has necessarily been instantiated. Calling
-   * requestDecode() on the imgIRequest simply forwards along the request if the
-   * container already exists, or calls it once it gets OnStartContainer if the
-   * container does not yet exist.
+   * startDecoding() on the imgIRequest simply forwards along the request if the
+   * container already exists, or calls it once the container becomes available
+   * if it does not yet exist.
    */
-  void requestDecode();
   void startDecoding();
 
   /**
    * Locks an image. If the image does not exist yet, locks it once it becomes
    * available. The lock persists for the lifetime of the imgIRequest (until
    * unlockImage is called) even if the underlying image changes.
    *
    * If you don't call unlockImage() by the time this imgIRequest goes away, it
--- a/image/imgLoader.cpp
+++ b/image/imgLoader.cpp
@@ -1585,17 +1585,17 @@ imgLoader::ValidateRequestWithNewChannel
     }
 
     if (*aProxyRequest) {
       imgRequestProxy* proxy = static_cast<imgRequestProxy*>(*aProxyRequest);
 
       // We will send notifications from imgCacheValidator::OnStartRequest().
       // In the mean time, we must defer notifications because we are added to
       // the imgRequest's proxy list, and we can get extra notifications
-      // resulting from methods such as RequestDecode(). See bug 579122.
+      // resulting from methods such as StartDecoding(). See bug 579122.
       proxy->SetNotificationsDeferred(true);
 
       // Attach the proxy without notifying
       request->GetValidator()->AddProxy(proxy);
     }
 
     return NS_SUCCEEDED(rv);
 
@@ -1661,17 +1661,17 @@ imgLoader::ValidateRequestWithNewChannel
       listener = corsproxy;
     }
 
     request->SetValidator(hvc);
 
     // We will send notifications from imgCacheValidator::OnStartRequest().
     // In the mean time, we must defer notifications because we are added to
     // the imgRequest's proxy list, and we can get extra notifications
-    // resulting from methods such as RequestDecode(). See bug 579122.
+    // resulting from methods such as StartDecoding(). See bug 579122.
     req->SetNotificationsDeferred(true);
 
     // Add the proxy without notifying
     hvc->AddProxy(req);
 
     mozilla::net::PredictorLearn(aURI, aInitialDocumentURI,
         nsINetworkPredictor::LEARN_LOAD_SUBRESOURCE, aLoadGroup);
 
--- a/image/imgRequest.cpp
+++ b/image/imgRequest.cpp
@@ -408,17 +408,17 @@ void
 imgRequest::ContinueEvict()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   RemoveFromCache();
 }
 
 void
-imgRequest::RequestDecode()
+imgRequest::StartDecoding()
 {
   MutexAutoLock lock(mMutex);
   mDecodeRequested = true;
 }
 
 bool
 imgRequest::IsDecodeRequested() const
 {
--- a/image/imgRequest.h
+++ b/image/imgRequest.h
@@ -90,17 +90,17 @@ public:
 
   // Called or dispatched by cancel for main thread only execution.
   void ContinueCancel(nsresult aStatus);
 
   // Called or dispatched by EvictFromCache for main thread only execution.
   void ContinueEvict();
 
   // Request that we start decoding the image as soon as data becomes available.
-  void RequestDecode();
+  void StartDecoding();
 
   inline uint64_t InnerWindowID() const {
     return mInnerWindowId;
   }
 
   // Set the cache validation information (expiry time, whether we must
   // validate, etc) on the cache entry based on the request information.
   // If this function is called multiple times, the information set earliest
@@ -215,17 +215,17 @@ private:
 
   void FinishPreparingForNewPart(const NewPartResult& aResult);
 
   void Cancel(nsresult aStatus);
 
   // Update the cache entry size based on the image container.
   void UpdateCacheEntrySize();
 
-  /// Returns true if RequestDecode() was called.
+  /// Returns true if StartDecoding() was called.
   bool IsDecodeRequested() const;
 
   // Weak reference to parent loader; this request cannot outlive its owner.
   imgLoader* mLoader;
   nsCOMPtr<nsIRequest> mRequest;
   // The original URI we were loaded with. This is the same as the URI we are
   // keyed on in the cache. We store a string here to avoid off main thread
   // refcounting issues with nsStandardURL.
--- a/image/imgRequestProxy.cpp
+++ b/image/imgRequestProxy.cpp
@@ -366,30 +366,23 @@ imgRequestProxy::StartDecoding()
   mDecodeRequested = true;
 
   RefPtr<Image> image = GetImage();
   if (image) {
     return image->StartDecoding();
   }
 
   if (GetOwner()) {
-    GetOwner()->RequestDecode();
+    GetOwner()->StartDecoding();
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-imgRequestProxy::RequestDecode()
-{
-  return NS_OK;
-}
-
-
-NS_IMETHODIMP
 imgRequestProxy::LockImage()
 {
   mLockCount++;
   RefPtr<Image> image = GetImage();
   if (image) {
     return image->LockImage();
   }
   return NS_OK;
--- a/image/test/unit/image_load_helpers.js
+++ b/image/test/unit/image_load_helpers.js
@@ -43,22 +43,16 @@ function ImageListener(start_callback, s
     do_check_false(this.synchronous);
 
     this.state |= DECODE_COMPLETE;
   }
   this.loadComplete = function onLoadcomplete(aRequest)
   {
     do_check_false(this.synchronous);
 
-    try {
-      aRequest.requestDecode();
-    } catch (e) {
-      do_print("requestDecode threw " + e);
-    }
-
     this.state |= LOAD_COMPLETE;
 
     if (this.stop_callback)
       this.stop_callback(this, aRequest);
   }
   this.frameUpdate = function onFrameUpdate(aRequest)
   {
   }
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -957,19 +957,16 @@ struct nsStyleBorder {
       (HasVisibleStyle(aSide) ? mBorder.Side(aSide) : 0);
   }
 
   inline bool IsBorderImageLoaded() const
   {
     return mBorderImageSource.IsLoaded();
   }
 
-  // Defined in nsStyleStructInlines.h
-  inline nsresult RequestDecode();
-
   void GetBorderColor(mozilla::css::Side aSide, nscolor& aColor,
                       bool& aForeground) const
   {
     aForeground = false;
     NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
     if ((mBorderStyle[aSide] & BORDER_COLOR_SPECIAL) == 0)
       aColor = mBorderColor[aSide];
     else if (mBorderStyle[aSide] & BORDER_COLOR_FOREGROUND)