Bug 1200469 part 2 - Discard cursor image urgently. r?tnikkel draft
authorXidorn Quan <me@upsuper.org>
Fri, 19 Aug 2016 23:43:11 +1000
changeset 403272 dc0b5152cbee667a90982891b6a570865040cd89
parent 403271 5216d958e60a31a847925562b249f914f87765ec
child 528872 6f0cb9d28b20651bbab0ce0043269755d215421a
push id26876
push usermozilla@upsuper.org
push dateFri, 19 Aug 2016 13:43:49 +0000
reviewerstnikkel
bugs1200469
milestone51.0a1
Bug 1200469 part 2 - Discard cursor image urgently. r?tnikkel Given that script may change cursor image in a high frequency, and it is usually small, it is probably better discarding it urgently. MozReview-Commit-ID: J6tqIODXykg
layout/style/nsStyleStruct.h
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -3348,24 +3348,21 @@ struct nsCursorImage
   bool mHaveHotspot;
   float mHotspotX, mHotspotY;
 
   nsCursorImage();
   nsCursorImage(const nsCursorImage& aOther);
   ~nsCursorImage();
 
   nsCursorImage& operator=(const nsCursorImage& aOther);
-  /*
-   * We hide mImage and force access through the getter and setter so that we
-   * can lock the images we use. Cursor images are likely to be small, so we
-   * don't care about discarding them. See bug 512260.
-   * */
+
   void SetImage(imgIRequest *aImage) {
     if (mImage) {
       mImage->UnlockImage();
+      mImage->RequestDiscard();
     }
     mImage = aImage;
     if (mImage) {
       mImage->LockImage();
     }
   }
   imgIRequest* GetImage() const {
     return mImage;