Bug 1446954: Remove ImageCacheKey styloToGecko hack. r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 19 Mar 2018 14:22:03 +0100
changeset 408963 68011d9bb81941327c36ae7ef67b9ffe821a047a
parent 408962 d5b647ddf8e504798ba7c2acb5c9660c774bebfa
child 408964 bc054c5c8cc82aab0b86a579dd951e97966b38ba
push id101080
push userecoal95@gmail.com
push dateTue, 20 Mar 2018 10:30:54 +0000
treeherdermozilla-inbound@c5186bbee6e5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1446954
milestone61.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 1446954: Remove ImageCacheKey styloToGecko hack. r=xidorn MozReview-Commit-ID: LiHH5T4XlnI
image/ImageCacheKey.cpp
image/ImageCacheKey.h
--- a/image/ImageCacheKey.cpp
+++ b/image/ImageCacheKey.cpp
@@ -49,75 +49,66 @@ BlobSerial(ImageURL* aURI)
 ImageCacheKey::ImageCacheKey(nsIURI* aURI,
                              const OriginAttributes& aAttrs,
                              nsIDocument* aDocument,
                              nsresult& aRv)
   : mURI(new ImageURL(aURI, aRv))
   , mOriginAttributes(aAttrs)
   , mControlledDocument(GetControlledDocumentToken(aDocument))
   , mIsChrome(URISchemeIs(mURI, "chrome"))
-  , mIsStyloEnabled(nsLayoutUtils::StyloEnabled())
 {
   NS_ENSURE_SUCCESS_VOID(aRv);
 
   MOZ_ASSERT(NS_IsMainThread());
 
   if (URISchemeIs(mURI, "blob")) {
     mBlobSerial = BlobSerial(mURI);
   }
 
-  mHash = ComputeHash(mURI, mBlobSerial, mOriginAttributes, mControlledDocument,
-                      mIsStyloEnabled);
+  mHash = ComputeHash(mURI, mBlobSerial, mOriginAttributes, mControlledDocument);
 }
 
 ImageCacheKey::ImageCacheKey(ImageURL* aURI,
                              const OriginAttributes& aAttrs,
                              nsIDocument* aDocument)
   : mURI(aURI)
   , mOriginAttributes(aAttrs)
   , mControlledDocument(GetControlledDocumentToken(aDocument))
   , mIsChrome(URISchemeIs(mURI, "chrome"))
-  , mIsStyloEnabled(nsLayoutUtils::StyloEnabled())
 {
   MOZ_ASSERT(aURI);
 
   if (URISchemeIs(mURI, "blob")) {
     mBlobSerial = BlobSerial(mURI);
   }
 
-  mHash = ComputeHash(mURI, mBlobSerial, mOriginAttributes, mControlledDocument,
-                      mIsStyloEnabled);
+  mHash = ComputeHash(mURI, mBlobSerial, mOriginAttributes, mControlledDocument);
 }
 
 ImageCacheKey::ImageCacheKey(const ImageCacheKey& aOther)
   : mURI(aOther.mURI)
   , mBlobSerial(aOther.mBlobSerial)
   , mOriginAttributes(aOther.mOriginAttributes)
   , mControlledDocument(aOther.mControlledDocument)
   , mHash(aOther.mHash)
   , mIsChrome(aOther.mIsChrome)
-  , mIsStyloEnabled(aOther.mIsStyloEnabled)
 { }
 
 ImageCacheKey::ImageCacheKey(ImageCacheKey&& aOther)
   : mURI(Move(aOther.mURI))
   , mBlobSerial(Move(aOther.mBlobSerial))
   , mOriginAttributes(aOther.mOriginAttributes)
   , mControlledDocument(aOther.mControlledDocument)
   , mHash(aOther.mHash)
   , mIsChrome(aOther.mIsChrome)
-  , mIsStyloEnabled(aOther.mIsStyloEnabled)
 { }
 
 bool
 ImageCacheKey::operator==(const ImageCacheKey& aOther) const
 {
-  if (mIsStyloEnabled != aOther.mIsStyloEnabled) {
-    return false;
-  }
   // Don't share the image cache between a controlled document and anything else.
   if (mControlledDocument != aOther.mControlledDocument) {
     return false;
   }
   // The origin attributes always have to match.
   if (mOriginAttributes != aOther.mOriginAttributes) {
     return false;
   }
@@ -137,29 +128,27 @@ ImageCacheKey::Spec() const
 {
   return mURI->Spec();
 }
 
 /* static */ PLDHashNumber
 ImageCacheKey::ComputeHash(ImageURL* aURI,
                            const Maybe<uint64_t>& aBlobSerial,
                            const OriginAttributes& aAttrs,
-                           void* aControlledDocument,
-                           bool aIsStyloEnabled)
+                           void* aControlledDocument)
 {
   // Since we frequently call Hash() several times in a row on the same
   // ImageCacheKey, as an optimization we compute our hash once and store it.
 
   nsPrintfCString ptr("%p", aControlledDocument);
   nsAutoCString suffix;
   aAttrs.CreateSuffix(suffix);
 
   return AddToHash(0, aURI->ComputeHash(aBlobSerial),
-                   HashString(suffix), HashString(ptr),
-                   aIsStyloEnabled);
+                   HashString(suffix), HashString(ptr));
 }
 
 /* static */ void*
 ImageCacheKey::GetControlledDocumentToken(nsIDocument* aDocument)
 {
   // For non-controlled documents, we just return null.  For controlled
   // documents, we cast the pointer into a void* to avoid dereferencing
   // it (since we only use it for comparisons), and return it.
--- a/image/ImageCacheKey.h
+++ b/image/ImageCacheKey.h
@@ -54,28 +54,23 @@ public:
   /// A token indicating which service worker controlled document this entry
   /// belongs to, if any.
   void* ControlledDocument() const { return mControlledDocument; }
 
 private:
   static PLDHashNumber ComputeHash(ImageURL* aURI,
                                    const Maybe<uint64_t>& aBlobSerial,
                                    const OriginAttributes& aAttrs,
-                                   void* aControlledDocument,
-                                   bool aIsStyloEnabled);
+                                   void* aControlledDocument);
   static void* GetControlledDocumentToken(nsIDocument* aDocument);
 
   RefPtr<ImageURL> mURI;
   Maybe<uint64_t> mBlobSerial;
   OriginAttributes mOriginAttributes;
   void* mControlledDocument;
   PLDHashNumber mHash;
   bool mIsChrome;
-  // To prevent the reftests of styloVsGecko taking the same image cache after
-  // refreshing, we need to store different caches of stylo and gecko. So, we
-  // also consider the info of StyloEnabled() in ImageCacheKey.
-  bool mIsStyloEnabled;
 };
 
 } // namespace image
 } // namespace mozilla
 
 #endif // mozilla_image_src_ImageCacheKey_h