Backed out changeset d46b7e02802c (bug 1315554)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Sat, 22 Jul 2017 11:03:52 +0200
changeset 370392 b6cbfeed5f34e75410645c92c6ee2633736d6d68
parent 370391 e2a6c6b64735e03bfc9bfa3975a2664419a06d9d
child 370393 e2e062406f6320a608921b0eaa0ffc95dbd9b108
push id32219
push userarchaeopteryx@coole-files.de
push dateSun, 23 Jul 2017 09:27:29 +0000
treeherdermozilla-central@fd3634c4b16d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1315554
milestone56.0a1
backs outd46b7e02802cdb35ad182705bf27dd583f5533e3
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
Backed out changeset d46b7e02802c (bug 1315554)
image/DecoderFactory.cpp
image/DecoderFactory.h
image/decoders/nsICODecoder.cpp
--- a/image/DecoderFactory.cpp
+++ b/image/DecoderFactory.cpp
@@ -231,17 +231,16 @@ DecoderFactory::CreateMetadataDecoder(De
   RefPtr<IDecodingTask> task = new MetadataDecodingTask(WrapNotNull(decoder));
   return task.forget();
 }
 
 /* static */ already_AddRefed<Decoder>
 DecoderFactory::CreateDecoderForICOResource(DecoderType aType,
                                             SourceBufferIterator&& aIterator,
                                             NotNull<nsICODecoder*> aICODecoder,
-                                            bool aIsMetadataDecode,
                                             const Maybe<IntSize>& aExpectedSize,
                                             const Maybe<uint32_t>& aDataOffset
                                               /* = Nothing() */)
 {
   // Create the decoder.
   RefPtr<Decoder> decoder;
   switch (aType) {
     case DecoderType::BMP:
@@ -257,21 +256,20 @@ DecoderFactory::CreateDecoderForICOResou
     default:
       MOZ_ASSERT_UNREACHABLE("Invalid ICO resource decoder type");
       return nullptr;
   }
 
   MOZ_ASSERT(decoder);
 
   // Initialize the decoder, copying settings from @aICODecoder.
-  decoder->SetMetadataDecode(aIsMetadataDecode);
+  MOZ_ASSERT(!aICODecoder->IsMetadataDecode());
+  decoder->SetMetadataDecode(aICODecoder->IsMetadataDecode());
   decoder->SetIterator(Forward<SourceBufferIterator>(aIterator));
-  if (!aIsMetadataDecode) {
-    decoder->SetOutputSize(aICODecoder->OutputSize());
-  }
+  decoder->SetOutputSize(aICODecoder->OutputSize());
   if (aExpectedSize) {
     decoder->SetExpectedSize(*aExpectedSize);
   }
   decoder->SetDecoderFlags(aICODecoder->GetDecoderFlags());
   decoder->SetSurfaceFlags(aICODecoder->GetSurfaceFlags());
   decoder->SetFinalizeFrames(false);
 
   if (NS_FAILED(decoder->Init())) {
--- a/image/DecoderFactory.h
+++ b/image/DecoderFactory.h
@@ -122,29 +122,25 @@ public:
    *              PNG.
    * @param aIterator The SourceBufferIterator which the decoder will read its
    *                  data from.
    * @param aICODecoder The ICO decoder which is controlling this resource
    *                    decoder. @aICODecoder's settings will be copied to the
    *                    resource decoder, so the two decoders will have the
    *                    same decoder flags, surface flags, target size, and
    *                    other parameters.
-   * @param aIsMetadataDecode Indicates whether or not this decoder is for
-   *                          metadata or not. Independent of the state of the
-   *                          parent decoder.
    * @param aExpectedSize The expected size of the resource from the ICO header.
    * @param aDataOffset If @aType is BMP, specifies the offset at which data
    *                    begins in the BMP resource. Must be Some() if and only
    *                    if @aType is BMP.
    */
   static already_AddRefed<Decoder>
   CreateDecoderForICOResource(DecoderType aType,
                               SourceBufferIterator&& aIterator,
                               NotNull<nsICODecoder*> aICODecoder,
-                              bool aIsMetadataDecode,
                               const Maybe<gfx::IntSize>& aExpectedSize,
                               const Maybe<uint32_t>& aDataOffset = Nothing());
 
   /**
    * Creates and initializes an anonymous decoder (one which isn't associated
    * with an Image object). Only the first frame of the image will be decoded.
    *
    * @param aType Which type of decoder to create - JPEG, PNG, etc.
--- a/image/decoders/nsICODecoder.cpp
+++ b/image/decoders/nsICODecoder.cpp
@@ -272,17 +272,16 @@ nsICODecoder::SniffResource(const char* 
     SourceBufferIterator containedIterator
       = mLexer.Clone(*mIterator, mDirEntry.mBytesInRes);
 
     // Create a PNG decoder which will do the rest of the work for us.
     mContainedDecoder =
       DecoderFactory::CreateDecoderForICOResource(DecoderType::PNG,
                                                   Move(containedIterator),
                                                   WrapNotNull(this),
-                                                  false,
                                                   Some(GetRealSize()));
 
     // Read in the rest of the PNG unbuffered.
     size_t toRead = mDirEntry.mBytesInRes - BITMAPINFOSIZE;
     return Transition::ToUnbuffered(ICOState::FINISHED_RESOURCE,
                                     ICOState::READ_RESOURCE,
                                     toRead);
   } else {
@@ -335,17 +334,16 @@ nsICODecoder::ReadBIH(const char* aData)
     = mLexer.Clone(*mIterator, mDirEntry.mBytesInRes);
 
   // Create a BMP decoder which will do most of the work for us; the exception
   // is the AND mask, which isn't present in standalone BMPs.
   mContainedDecoder =
     DecoderFactory::CreateDecoderForICOResource(DecoderType::BMP,
                                                 Move(containedIterator),
                                                 WrapNotNull(this),
-                                                false,
                                                 Some(GetRealSize()),
                                                 Some(dataOffset));
 
   RefPtr<nsBMPDecoder> bmpDecoder =
     static_cast<nsBMPDecoder*>(mContainedDecoder.get());
 
   // Ensure the decoder has parsed at least the BMP's bitmap info header.
   if (!FlushContainedDecoder()) {